Sha256: b3872564d19bd548e8eef28283e65a5630826f7261f5c0d32713555e38931ac8

Contents?: true

Size: 947 Bytes

Versions: 1

Compression:

Stored size: 947 Bytes

Contents

module Employ
  class CLI < Thor
    class_option :verbose, type: :boolean, aliases: :v

    class_option 'assume-yes', type: :boolean, aliases: %w(y yes),
      desc: 'Automatic yes to prompts'

    desc 'promote <env>', 'promotes commit to <env>'
    long_desc "TODO"
    option :interactive, type: :boolean, aliases: :i
    def promote(env)
      unless options['assume-yes'] || yes?('Are you sure?')
        puts 'Nothing done. Bye!'
        exit 1
      end

      if options[:interactive]
        last_tag = Git.last_tag(env)
        puts "last tag: #{last_tag}" if options[:verbose]
        # TODO
      else
        name = Git.tag!(env)
        puts "New tag promoted: #{name}" if options[:verbose]
      end
    end

    desc 'rollback <env>', 'rollbacks <env> tag to the penultimate one'
    long_desc "TODO"
    def rollback(env)
      penultimate_tag = Git.penultimate_tag(env)
      Git.retag! env, penultimate_tag
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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