Class: Cucumber::Pro::Scm::WorkingCopy

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/pro/scm/working_copy.rb

Constant Summary collapse

NoGitRepoFound =
Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.detect(path = Dir.pwd) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/cucumber/pro/scm/working_copy.rb', line 12

def self.detect(path = Dir.pwd)
  if Dir.entries(path).include? '.git'
    GitWorkingCopy.new(path)
  else
    # TODO (aslak): This is likely to loop indefinitely on Windows - it's never '/'
    # Maybe use Pathname?
    raise NoGitRepoFound if path == '/'
    detect File.expand_path(path + '/..')
  end
end