Module: Employ::Git

Extended by:
Git
Included in:
Git
Defined in:
lib/employ/git.rb

Instance Method Summary collapse

Instance Method Details

#last_tag(env) ⇒ Object



19
20
21
# File 'lib/employ/git.rb', line 19

def last_tag(env)
  tags(env).max
end

#penultimate_tag(env) ⇒ Object



23
24
25
# File 'lib/employ/git.rb', line 23

def penultimate_tag(env)
  tags(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 tags(env)
  `git fetch --tags`
  `git tag | grep ^#{env}-`.lines
end