Class: BuildTool::VCS::Base
- Inherits:
-
Object
- Object
- BuildTool::VCS::Base
- Includes:
- MJ::Tools::SubProcess
- Defined in:
- lib/build-tool/vcs/base.rb
Overview
Base class for Version Control System implementations
Defined Under Namespace
Classes: VcsError
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
ATTRIBUTES.
Instance Method Summary collapse
- #apply_patches_after_rebase? ⇒ Boolean
- #configure ⇒ Object
-
#gc ⇒ Object
Collect garbage, do maintenance …
-
#initialize(config) ⇒ Base
constructor
# Create a repository.
- #local_path ⇒ Object
-
#local_path_exist? ⇒ Boolean
checks if path exists and is a directory.
-
#patches_supported? ⇒ Boolean
CAPABILITIES.
- #prepare_for_vcs_access ⇒ Object
- #recipe ⇒ Object
Constructor Details
#initialize(config) ⇒ Base
# Create a repository
35 36 37 |
# File 'lib/build-tool/vcs/base.rb', line 35 def initialize( config ) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
ATTRIBUTES
42 43 44 |
# File 'lib/build-tool/vcs/base.rb', line 42 def config @config end |
Instance Method Details
#apply_patches_after_rebase? ⇒ Boolean
50 51 52 |
# File 'lib/build-tool/vcs/base.rb', line 50 def apply_patches_after_rebase? false end |
#configure ⇒ Object
73 74 75 |
# File 'lib/build-tool/vcs/base.rb', line 73 def configure logger.debug "VCS #{name} did not implement configure!" end |
#gc ⇒ Object
Collect garbage, do maintenance …
55 56 |
# File 'lib/build-tool/vcs/base.rb', line 55 def gc end |
#local_path ⇒ Object
58 59 60 61 62 |
# File 'lib/build-tool/vcs/base.rb', line 58 def local_path local_path = @config.local_path raise ConfigurationError, "#{self.class}.local_path not set" if local_path.nil? local_path end |
#local_path_exist? ⇒ Boolean
checks if path exists and is a directory
69 70 71 |
# File 'lib/build-tool/vcs/base.rb', line 69 def local_path_exist? !local_path.nil? and File.exist? local_path and File.directory? local_path end |
#patches_supported? ⇒ Boolean
CAPABILITIES
46 47 48 |
# File 'lib/build-tool/vcs/base.rb', line 46 def patches_supported? false end |
#prepare_for_vcs_access ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/build-tool/vcs/base.rb', line 77 def prepare_for_vcs_access if key = repository.ssh_key and !MJ::Tools::SSH::has_key? key.file logger.info "" logger.info "#### Adding required ssh-key #{key.file} to ssh-agent." MJ::Tools::SSH::add_key key.file end return true end |
#recipe ⇒ Object
86 87 88 |
# File 'lib/build-tool/vcs/base.rb', line 86 def recipe Application::instance.recipe end |