Class: GitMQ::Storage
- Inherits:
-
Object
- Object
- GitMQ::Storage
- Defined in:
- lib/storage.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
- #branch(name) ⇒ Object
- #branches ⇒ Object
- #commits(branch, tag) ⇒ Object
-
#initialize(path) ⇒ Storage
constructor
A new instance of Storage.
- #tag(label, commit) ⇒ Object
- #tree ⇒ Object
Constructor Details
#initialize(path) ⇒ Storage
Returns a new instance of Storage.
10 11 12 13 |
# File 'lib/storage.rb', line 10 def initialize(path) @path = path @repo = read_or_create_repo end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/storage.rb', line 8 def path @path end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
8 9 10 |
# File 'lib/storage.rb', line 8 def repo @repo end |
Instance Method Details
#branch(name) ⇒ Object
19 20 21 |
# File 'lib/storage.rb', line 19 def branch(name) branches[name] end |
#branches ⇒ Object
15 16 17 |
# File 'lib/storage.rb', line 15 def branches repo.branches end |
#commits(branch, tag) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/storage.rb', line 27 def commits(branch, tag) walker = Rugged::Walker.new(repo) walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE) walker.push(branch(branch).target) tag = repo.[tag] walker.hide(tag.target) if tag walker end |
#tag(label, commit) ⇒ Object
37 38 39 |
# File 'lib/storage.rb', line 37 def tag(label, commit) repo..create(label, commit, true) end |
#tree ⇒ Object
23 24 25 |
# File 'lib/storage.rb', line 23 def tree Rugged::Tree::Builder.new(repo).write end |