Module: Employ::Git
Instance Method Summary collapse
- #last_tag(env) ⇒ Object
- #penultimate_tag(env) ⇒ Object
- #retag!(env, tag) ⇒ Object
- #tag!(env, tag = nil) ⇒ Object
- #tag_sha(tag) ⇒ Object
- #tags(env) ⇒ Object
Instance Method Details
#last_tag(env) ⇒ Object
19 20 21 |
# File 'lib/employ/git.rb', line 19 def last_tag(env) (env).max end |
#penultimate_tag(env) ⇒ Object
23 24 25 |
# File 'lib/employ/git.rb', line 23 def penultimate_tag(env) (env).sort.tap(&:pop).last end |
#retag!(env, tag) ⇒ Object
10 11 12 |
# File 'lib/employ/git.rb', line 10 def retag!(env, tag) Git.tag! env, tag end |
#tag!(env, tag = nil) ⇒ Object
5 6 7 8 |
# File 'lib/employ/git.rb', line 5 def tag!(env, tag = nil) name = "#{env}-#{Time.now.to_i}" `git tag #{name} #{tag} && git push --tags` end |
#tag_sha(tag) ⇒ Object
27 28 29 |
# File 'lib/employ/git.rb', line 27 def tag_sha(tag) `git show #{tag} --format="%H"`.lines.last end |
#tags(env) ⇒ Object
14 15 16 17 |
# File 'lib/employ/git.rb', line 14 def (env) `git fetch --tags` `git tag | grep ^#{env}-`.lines end |