module Shifter::Git

Public Instance Methods

last_tag(env) click to toggle source
# File lib/shifter/git.rb, line 19
def last_tag(env)
  tags(env).max
end
penultimate_tag(env) click to toggle source
# File lib/shifter/git.rb, line 23
def penultimate_tag(env)
  tags(env).sort.tap(&:pop).last
end
retag!(env, tag) click to toggle source
# File lib/shifter/git.rb, line 10
def retag!(env, tag)
  Git.tag! env, tag
end
tag!(env, tag = nil) click to toggle source
# File lib/shifter/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) click to toggle source
# File lib/shifter/git.rb, line 27
def tag_sha(tag)
  `git show #{tag} --format="%H"`.lines.last
end
tags(env) click to toggle source
# File lib/shifter/git.rb, line 14
def tags(env)
  `git fetch --tags`
  `git tag | grep ^#{env}-`.lines
end