Module: Cerberus::SCM
- Defined in:
- lib/cerberus/scm/base.rb,
lib/cerberus/component_lazy_loader.rb
Defined Under Namespace
Classes: Base, Bazaar, CVS, Darcs, Git, Mercurial, Perforce, SVN
Constant Summary
collapse
- TYPES =
{
:svn => 'SVN', :darcs => 'Darcs',
:perforce => 'Perforce',
:cvs => 'CVS',
:bzr => 'Bazaar',
:git => 'Git',
:hg => 'Mercurial'
}
Class Method Summary
collapse
Class Method Details
.get(type) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/cerberus/component_lazy_loader.rb', line 13
def self.get(type)
class_name = TYPES[type.to_sym]
say "SCM #{type} not supported" unless class_name
require "cerberus/scm/#{type}"
const_get(class_name)
end
|
.guess_type(path) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/cerberus/component_lazy_loader.rb', line 21
def self.guess_type(path)
if test(?d, path)
case
when test(?d, path+'/.svn')
'svn'
when test(?d, path+'/_darcs')
'darcs'
when test(?d, path+'/.cvs')
'cvs'
when test(?d, path+'/.bzr')
'bzr'
when test(?d, path+'/.git')
'git'
when test(?d, path+'/.hg')
'hg'
end
else
case path
when /^:(pserver|ext|local):/
'cvs'
when /^(bzr+ssh|bzr)/
'bzr'
end
end
end
|