Class: AutoTagger::Git::RefSet
- Inherits:
-
Object
- Object
- AutoTagger::Git::RefSet
- Defined in:
- lib/auto_tagger/git/ref_set.rb
Instance Method Summary collapse
- #all ⇒ Object
-
#create(sha, name) ⇒ Object
name = refs/autotags/2009857463 returns a ref should un-cache the refs in refset, or never memoize.
-
#fetch(pattern, remote = "origin") ⇒ Object
pattern = refs/auto_tags/*.
- #find_by_sha(sha) ⇒ Object
-
#initialize(repo) ⇒ RefSet
constructor
A new instance of RefSet.
-
#push(pattern, remote = "origin") ⇒ Object
pattern = refs/autotags/*.
Constructor Details
#initialize(repo) ⇒ RefSet
Returns a new instance of RefSet.
5 6 7 |
# File 'lib/auto_tagger/git/ref_set.rb', line 5 def initialize(repo) @repo = repo end |
Instance Method Details
#all ⇒ Object
9 10 11 12 13 14 |
# File 'lib/auto_tagger/git/ref_set.rb', line 9 def all @repo.read("show-ref").split(/\n/).map do |line| sha, name = line.split Ref.new(@repo, sha, name) end end |
#create(sha, name) ⇒ Object
name = refs/autotags/2009857463 returns a ref should un-cache the refs in refset, or never memoize
25 26 27 |
# File 'lib/auto_tagger/git/ref_set.rb', line 25 def create(sha, name) Ref.new(@repo, sha, name).save end |
#fetch(pattern, remote = "origin") ⇒ Object
pattern = refs/auto_tags/*
35 36 37 |
# File 'lib/auto_tagger/git/ref_set.rb', line 35 def fetch(pattern, remote = "origin") @repo.exec "fetch #{remote} #{pattern}:#{pattern}" end |
#find_by_sha(sha) ⇒ Object
16 17 18 19 20 |
# File 'lib/auto_tagger/git/ref_set.rb', line 16 def find_by_sha(sha) all.detect do |ref| ref.sha == sha end end |
#push(pattern, remote = "origin") ⇒ Object
pattern = refs/autotags/*
30 31 32 |
# File 'lib/auto_tagger/git/ref_set.rb', line 30 def push(pattern, remote = "origin") @repo.exec "push #{remote} #{pattern}:#{pattern}" end |