module Pullr::SCM
Constants
Public Class Methods
infer_from_dir(path)
click to toggle source
Attempts to infer the SCM
used to manage a given directory.
@param [String] path
The path to the directory.
@return [Symbol]
The name of the infered SCM.
# File lib/pullr/scm/scm.rb, line 75 def SCM.infer_from_dir(path) SCM::DIRS.each do |name,scm| if File.directory?(File.join(path,name)) return scm end end return nil end
infer_from_uri(uri)
click to toggle source
Attempts to infer the SCM
used for the remote repository.
@param [Addressable::URI] uri
The URI to infer the SCM from.
@return [Symbol]
The name of the infered SCM.
# File lib/pullr/scm/scm.rb, line 50 def SCM.infer_from_uri(uri) uri_scheme = uri.scheme if (scm = SCM::SCHEMES[uri_scheme]) return scm end uri_ext = File.extname(uri.path) if (scm = SCM::EXTS[uri_ext]) return scm end return nil end
lookup(name)
click to toggle source
Finds the SCM
mixin for a given SCM
name.
@param [Symbol, String] name
The name of the SCM.
@return [Module]
The SCM mixin.
@raise [UnknownSCM]
The SCM name did not map to a known SCM mixin.
# File lib/pullr/scm/scm.rb, line 97 def SCM.lookup(name) name = name.to_sym unless NAMES.has_key?(name) raise(UnknownSCM,"unknown SCM #{name}",caller) end return NAMES[name] end