Class: BuildTool::VCS::Base

Inherits:
Object
  • Object
show all
Includes:
MJ::Tools::SubProcess
Defined in:
lib/build-tool/vcs/base.rb

Overview

Base class for Version Control System implementations

Direct Known Subclasses

Archive, Git, GitSvn, Mercurial, Svn

Defined Under Namespace

Classes: VcsError

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configObject (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

Returns:

  • (Boolean)


50
51
52
# File 'lib/build-tool/vcs/base.rb', line 50

def apply_patches_after_rebase?
    false
end

#configureObject



73
74
75
# File 'lib/build-tool/vcs/base.rb', line 73

def configure
    logger.debug "VCS #{name} did not implement configure!"
end

#gcObject

Collect garbage, do maintenance …



55
56
# File 'lib/build-tool/vcs/base.rb', line 55

def gc
end

#local_pathObject

Raises:



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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


46
47
48
# File 'lib/build-tool/vcs/base.rb', line 46

def patches_supported?
    false
end

#prepare_for_vcs_accessObject



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

#recipeObject



86
87
88
# File 'lib/build-tool/vcs/base.rb', line 86

def recipe
    Application::instance.recipe
end