Class: Tag
- Inherits:
-
Object
- Object
- Tag
- Defined in:
- lib/auto_tagger/tag.rb
Overview
git –no-pager log –pretty=oneline -1 git tag -a -m ‘Successful continuous integration build on #timestamp’ #tag_name“
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #create(stage, commit = nil) ⇒ Object
- #fetch ⇒ Object
- #find_all ⇒ Object
-
#initialize(repository) ⇒ Tag
constructor
A new instance of Tag.
- #latest_from(stage) ⇒ Object
- #push ⇒ Object
Constructor Details
#initialize(repository) ⇒ Tag
Returns a new instance of Tag.
7 8 9 |
# File 'lib/auto_tagger/tag.rb', line 7 def initialize(repository) @repository = repository end |
Instance Attribute Details
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
5 6 7 |
# File 'lib/auto_tagger/tag.rb', line 5 def repository @repository end |
Instance Method Details
#create(stage, commit = nil) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/auto_tagger/tag.rb', line 27 def create(stage, commit = nil) tag_name = name_for(stage) cmd = "git tag #{tag_name}" cmd += " #{commit}" if commit repository.run! cmd tag_name end |
#fetch ⇒ Object
15 16 17 |
# File 'lib/auto_tagger/tag.rb', line 15 def fetch repository.run! "git fetch origin --tags" end |
#find_all ⇒ Object
11 12 13 |
# File 'lib/auto_tagger/tag.rb', line 11 def find_all repository.run("git tag").split("\n") end |
#latest_from(stage) ⇒ Object
19 20 21 |
# File 'lib/auto_tagger/tag.rb', line 19 def latest_from(stage) find_all.select{|tag| tag =~ /^#{stage}/}.sort.last end |
#push ⇒ Object
23 24 25 |
# File 'lib/auto_tagger/tag.rb', line 23 def push repository.run! "git push origin --tags" end |