Class: LetItCrash::Matchers::Git
- Defined in:
- lib/letitcrash/matchers/git.rb
Constant Summary collapse
- STATUS_CMD =
'git status'
- BRANCH_CMD =
'git rev-parse --abbrev-ref HEAD'
- SHA_CMD =
'git rev-parse HEAD'
Instance Method Summary collapse
-
#branch ⇒ Object
This method reeks of :reek:UtilityFunction.
-
#matches? ⇒ Boolean
This method reeks of :reek:UtilityFunction.
-
#sha ⇒ Object
This method reeks of :reek:UtilityFunction.
Methods inherited from Base
Constructor Details
This class inherits a constructor from LetItCrash::Matchers::Base
Instance Method Details
#branch ⇒ Object
This method reeks of :reek:UtilityFunction.
16 17 18 19 |
# File 'lib/letitcrash/matchers/git.rb', line 16 def branch ret = IO.popen(BRANCH_CMD).read.strip ret == 'HEAD' ? 'master' : ret end |
#matches? ⇒ Boolean
This method reeks of :reek:UtilityFunction.
11 12 13 |
# File 'lib/letitcrash/matchers/git.rb', line 11 def matches? IO.popen(STATUS_CMD).read.start_with?('On branch') end |
#sha ⇒ Object
This method reeks of :reek:UtilityFunction.
22 23 24 |
# File 'lib/letitcrash/matchers/git.rb', line 22 def sha IO.popen(SHA_CMD).read.strip end |