Class: Fiveruns::Dash::SCM
- Includes:
- Typable
- Defined in:
- lib/fiveruns/dash/scm.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ SCM
constructor
A new instance of SCM.
- #revision ⇒ Object
- #time ⇒ Object
Methods included from Typable
Constructor Details
#initialize(path) ⇒ SCM
Returns a new instance of SCM.
29 30 31 32 |
# File 'lib/fiveruns/dash/scm.rb', line 29 def initialize(path) @path = path require_binding end |
Class Method Details
.best_match(scm_paths) ⇒ Object
25 26 27 |
# File 'lib/fiveruns/dash/scm.rb', line 25 def self.best_match( scm_paths ) scm_paths.max{|a,b| a.split("/").length <=> b.split("/").length} end |
.matching(startpath) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fiveruns/dash/scm.rb', line 6 def self.matching(startpath) scm_hash = {} types.each do |name, klass| if path = locate_upwards(startpath, ".#{name}") Fiveruns::Dash.logger.info "SCM: Found #{name} in #{path}" scm_hash[path] = klass end end winning_path = best_match(scm_hash.keys) return nil if winning_path.nil? Fiveruns::Dash.logger.info "SCM: Using #{scm_hash[winning_path].name} in #{winning_path}" begin scm_hash[winning_path].new(winning_path) rescue Exception => e Fiveruns::Dash.logger.warn "WARNING: #{e.}" nil end end |