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



43
44
45
# File 'lib/build-tool/vcs/base.rb', line 43

def initialize( config )
    @config = config
end

Instance Attribute Details

#configObject (readonly)

ATTRIBUTES



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

def config
  @config
end

Instance Method Details

#apply_patches_after_rebase?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/build-tool/vcs/base.rb', line 58

def apply_patches_after_rebase?
    false
end

#configureObject



93
94
95
# File 'lib/build-tool/vcs/base.rb', line 93

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

#gcObject

Collect garbage, do maintenance …



63
64
# File 'lib/build-tool/vcs/base.rb', line 63

def gc
end

#local_pathObject

Raises:



66
67
68
69
70
# File 'lib/build-tool/vcs/base.rb', line 66

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)


89
90
91
# File 'lib/build-tool/vcs/base.rb', line 89

def local_path_exist?
    !local_path.nil? and File.exist? local_path and File.directory? local_path
end

#patches_supported?Boolean

CAPABILITIES

Returns:

  • (Boolean)


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

def patches_supported?
    false
end

#recipeObject



97
98
99
# File 'lib/build-tool/vcs/base.rb', line 97

def recipe
    Application::instance.recipe
end

#remote_pathObject

Raises:



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

def remote_path
    remote_path = @config.remote_path
    raise ConfigurationError, "#{self.class}.remote_path not set" if remote_path.nil?
    remote_path
end

#repositoryObject

Raises:



78
79
80
81
82
# File 'lib/build-tool/vcs/base.rb', line 78

def repository
    repository = @config.repository
    raise ConfigurationError, "#{self.class}.repository not set" if repository.nil?
    repository
end