module Employ::Git

Public Instance Methods

last_tag(env) click to toggle source
# File lib/employ/git.rb, line 21
def last_tag(env)
  tags(env).max
end
penultimate_tag(env) click to toggle source
# File lib/employ/git.rb, line 25
def penultimate_tag(env)
  tags(env).sort.tap(&:pop).last
end
retag!(env, tag) click to toggle source
# File lib/employ/git.rb, line 12
def retag!(env, tag)
  Git.tag! env, tag
end
tag!(env, tag = nil) click to toggle source
# File lib/employ/git.rb, line 5
def tag!(env, tag = nil)
  name = "#{env}-#{Time.now.strftime('%Y%m%dT%H%M%S')}"
  `git tag #{name} #{tag}`
  `git push --tags`
  name
end
tag_sha(tag) click to toggle source
# File lib/employ/git.rb, line 29
def tag_sha(tag)
  `git show #{tag} --format="%H"`.lines.last
end
tags(env) click to toggle source
# File lib/employ/git.rb, line 16
def tags(env)
  `git fetch --tags`
  `git tag | grep ^#{env}-`.lines
end