Class: Esvien::Repo
- Inherits:
-
Object
- Object
- Esvien::Repo
- Defined in:
- lib/esvien/repo.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #commits(range = nil) ⇒ Object
- #head ⇒ Object
-
#initialize(uri) ⇒ Repo
constructor
A new instance of Repo.
- #pretty_print(pp) ⇒ Object
Constructor Details
#initialize(uri) ⇒ Repo
Returns a new instance of Repo.
6 7 8 9 |
# File 'lib/esvien/repo.rb', line 6 def initialize(uri) @uri = uri get_repository_info end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
3 4 5 |
# File 'lib/esvien/repo.rb', line 3 def uri @uri end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
4 5 6 |
# File 'lib/esvien/repo.rb', line 4 def uuid @uuid end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 |
# File 'lib/esvien/repo.rb', line 28 def ==(other) uuid == other.uuid end |
#commits(range = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/esvien/repo.rb', line 11 def commits(range=nil) return [] if @revision == 0 doc = svnxml(:log, '-r', svn_range_string(range) || '1:HEAD', uri) elems = doc.search('/log/logentry') elems.map do |elem| commit = Commit.new(elem.attributes['revision'].to_i, self) commit. = elem.children_of_type('author').first.inner_text commit.date = Time.parse(elem.children_of_type('date').first.inner_text) commit end end |
#head ⇒ Object
24 25 26 |
# File 'lib/esvien/repo.rb', line 24 def head commits('HEAD').first end |
#pretty_print(pp) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/esvien/repo.rb', line 32 def pretty_print(pp) pp.group(1, %{#<#{self.class}}, %{>}) do pp.breakable pp.seplist(%w[uri uuid], lambda { pp.comma_breakable }) do |attr| pp.text(attr) pp.text("=") pp.pp(send(attr)) end end end |