Module: Blastr::SourceControl

Defined in:
lib/scm/hg.rb,
lib/scm/git.rb,
lib/scm/scm.rb,
lib/scm/svn.rb

Defined Under Namespace

Classes: Git, GitLogEntry, GitRevision, LogEntry, Mercurial, MercurialRevision, Subversion, SubversionRevision

Constant Summary collapse

@@implementations =
[]

Class Method Summary collapse

Class Method Details

.implementation_for(url) ⇒ Object



24
25
26
27
28
29
# File 'lib/scm/scm.rb', line 24

def self.implementation_for(url)
  matching_implementations = @@implementations.find_all { |impl| impl.understands_url?(url) }
  raise "No SCM implementation found that would understand #{url}" if matching_implementations.empty?
  raise "Ambiguous SCM URL #{url} - please prefix it with the type of repository ('svn:', 'git:', 'hg:')" if matching_implementations.size > 1
  return matching_implementations.first.new(url)
end

.register_implementation(implementation) ⇒ Object



31
32
33
# File 'lib/scm/scm.rb', line 31

def self.register_implementation(implementation)
  @@implementations << implementation unless @@implementations.include?(implementation)
end