Module: Capistrano::Deploy::SCM

Defined in:
lib/alpha_omega/deploy/scm.rb,
lib/alpha_omega/deploy/scm/git.rb,
lib/alpha_omega/deploy/scm/base.rb

Defined Under Namespace

Classes: Base, Git

Class Method Summary collapse

Class Method Details

.new(scm, config = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/alpha_omega/deploy/scm.rb', line 4

def self.new(scm, config={})
  scm_file = "alpha_omega/deploy/scm/#{scm}"
  require(scm_file)

  scm_const = scm.to_s.capitalize.gsub(/_(.)/) { $1.upcase }
  if const_defined?(scm_const)
    const_get(scm_const).new(config)
  else
    raise Capistrano::Error, "could not find `#{name}::#{scm_const}' in `#{scm_file}'"
  end
rescue LoadError
  raise Capistrano::Error, "could not find any SCM named `#{scm}'"
end