Sha256: 1b8790d2713fdfa7363b417fa48a9ed5bd84494ea3d1313328e3e9e0ae9d893c

Contents?: true

Size: 956 Bytes

Versions: 2

Compression:

Stored size: 956 Bytes

Contents

class Gem::Commands::TagCommand < Gem::Command
  include GemRelease
  include Helpers, CommandOptions

  DEFAULTS = {
    :quiet => false
  }

  attr_reader :arguments, :usage

  def initialize(options = {})
    super 'tag', 'Create a git tag and push --tags to origin', DEFAULTS.merge(options)

    option :quiet, '-q', 'Do not output status messages'
  end

  def execute
    [:tag, :push].each do |task|
      run_cmd(task)
    end

    success
  end

  protected

    def tag
      say "Creating git tag #{tag_name}" unless quiet?
      system("git tag -am \"tag #{tag_name}\" #{tag_name}")
    end

    def push
      unless options[:push_tags_only]
        say "Pushing to the origin git repository" unless quiet?
        return false unless system('git push origin')
      end

      say "Pushing --tags to the origin git repository" unless quiet?
      system('git push --tags origin')
    end

    def tag_name
      "v#{gem_version}"
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gem-release-0.6.0 lib/rubygems/commands/tag_command.rb
gem-release-0.5.5 lib/rubygems/commands/tag_command.rb