Sha256: 2c0d6104288de329a75376db19556fc1d0bb5fd4853e59188c17cbedee93fd59

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

module Employ
  module Git
    extend self

    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

    def retag!(env, tag)
      Git.tag! env, tag
    end

    def tags(env)
      `git fetch --tags`
      `git tag | grep ^#{env}-`.lines
    end

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

    def penultimate_tag(env)
      tags(env).sort.tap(&:pop).last
    end

    def tag_sha(tag)
      `git show #{tag} --format="%H"`.lines.last
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
employ-0.0.2 lib/employ/git.rb