Class: Rubbr::Scm::Subversion

Inherits:
Base
  • Object
show all
Defined in:
lib/rubbr/scm/subversion.rb

Instance Attribute Summary

Attributes inherited from Base

#date, #executable, #name, #revision

Instance Method Summary collapse

Methods inherited from Base

#collect_scm_stats

Methods included from Cli

#color?, #disable_stderr, #disable_stdinn, #disable_stdout, #error, #executable?, #notice, #valid_executable, #warning

Methods included from OS

#os

Constructor Details

#initialize {|_self| ... } ⇒ Subversion

Returns a new instance of Subversion.

Yields:

  • (_self)

Yield Parameters:



9
10
11
12
13
14
15
16
17
18
# File 'lib/rubbr/scm/subversion.rb', line 9

def initialize
  super

  @name = 'Subversion'
  @executable = valid_executable :svn

  @revision, @date = parse_scm_stats

  yield self if block_given?
end

Instance Method Details

#parse_scm_statsObject



20
21
22
23
24
25
26
27
28
# File 'lib/rubbr/scm/subversion.rb', line 20

def parse_scm_stats
  return [nil, nil] unless @executable

  raw_stats = `#@executable info`
  revision = raw_stats.scan(/^Revision: (\d+)/).first.first
  date = raw_stats.scan(/^Last Changed Date: (.+)/).first.first

  [revision, date]
end