Class: AutoTagger::Git::Ref
- Inherits:
-
Object
- Object
- AutoTagger::Git::Ref
- Defined in:
- lib/auto_tagger/git/ref.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #delete_locally ⇒ Object
- #delete_on_remote(remote = "origin") ⇒ Object
-
#initialize(repo, sha, name) ⇒ Ref
constructor
name is refs/autotags/2009292827.
- #save ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(repo, sha, name) ⇒ Ref
name is refs/autotags/2009292827
7 8 9 |
# File 'lib/auto_tagger/git/ref.rb', line 7 def initialize(repo, sha, name) @repo, @sha, @name = repo, sha, name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/auto_tagger/git/ref.rb', line 4 def name @name end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
4 5 6 |
# File 'lib/auto_tagger/git/ref.rb', line 4 def sha @sha end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 |
# File 'lib/auto_tagger/git/ref.rb', line 11 def ==(other) other.is_a?(self.class) && other.sha == sha && other.name == name end |
#delete_locally ⇒ Object
19 20 21 |
# File 'lib/auto_tagger/git/ref.rb', line 19 def delete_locally @repo.exec "update-ref -d #{name}" end |
#delete_on_remote(remote = "origin") ⇒ Object
23 24 25 |
# File 'lib/auto_tagger/git/ref.rb', line 23 def delete_on_remote(remote = "origin") @repo.exec "push #{remote} :#{name}" end |
#save ⇒ Object
27 28 29 30 |
# File 'lib/auto_tagger/git/ref.rb', line 27 def save @repo.exec "update-ref #{name} #{sha}" self end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/auto_tagger/git/ref.rb', line 15 def to_s "%s %s" % [sha, name] end |