Class: Cucumber::Pro::Scm::Repo
- Inherits:
-
Object
- Object
- Cucumber::Pro::Scm::Repo
- Defined in:
- lib/cucumber/pro/scm.rb
Constant Summary collapse
- NoGitRepoFound =
Class.new(StandardError)
Class Method Summary collapse
Instance Method Summary collapse
- #branch ⇒ Object
-
#initialize(path) ⇒ Repo
constructor
A new instance of Repo.
- #remote ⇒ Object
- #rev ⇒ Object
Constructor Details
#initialize(path) ⇒ Repo
Returns a new instance of Repo.
19 20 21 |
# File 'lib/cucumber/pro/scm.rb', line 19 def initialize(path) @path = path end |
Class Method Details
.find(path = Dir.pwd) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/cucumber/pro/scm.rb', line 10 def self.find(path = Dir.pwd) if Dir.entries(path).include? '.git' new(path) else raise NoGitRepoFound if path == '/' find File.(path + '/..') end end |
Instance Method Details
#branch ⇒ Object
27 28 29 |
# File 'lib/cucumber/pro/scm.rb', line 27 def branch cmd("git branch --contains #{rev}") end |
#remote ⇒ Object
23 24 25 |
# File 'lib/cucumber/pro/scm.rb', line 23 def remote cmd('git config --get remote.origin.url') end |
#rev ⇒ Object
31 32 33 |
# File 'lib/cucumber/pro/scm.rb', line 31 def rev cmd("git rev-parse HEAD") end |