Class: Rubbr::Scm::Mercurial
Instance Attribute Summary
Attributes inherited from Base
#date, #executable, #name, #revision
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Mercurial
constructor
A new instance of Mercurial.
- #parse_scm_stats ⇒ Object
Methods inherited from Base
Methods included from Cli
#color?, #disable_stderr, #disable_stdinn, #disable_stdout, #error, #executable?, #notice, #valid_executable, #warning
Constructor Details
#initialize {|_self| ... } ⇒ Mercurial
Returns a new instance of Mercurial.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rubbr/scm/mercurial.rb', line 9 def initialize super @name = 'Mercurial' @executable = valid_executable :hg @revision, @date = parse_scm_stats yield self if block_given? end |
Instance Method Details
#parse_scm_stats ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/rubbr/scm/mercurial.rb', line 20 def parse_scm_stats return [nil, nil] unless @executable raw_stats = `#@executable tip` revision = raw_stats.scan(/^changeset: +(.+)/).first.first date = raw_stats.scan(/^date: +(.+)/).first.first [revision, date] end |