Sha256: 5a8ad88478bfb89b020906a91bcb4752cc2d3d99461b99e3d53181024431c8d3

Contents?: true

Size: 801 Bytes

Versions: 6

Compression:

Stored size: 801 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
  end

  protected

    def tag
      say "Creating git tag #{tag_name}" unless quiet?
      `git tag -am 'tag #{tag_name}' #{tag_name}`
    end

    def push
      say "Pushing to the origin git repository" unless quiet?
      `git push origin`

      say "Pushing --tags to the origin git repository" unless quiet?
      `git push --tags origin`
    end

    def tag_name
      "v#{gem_version}"
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gem-release-0.4.1 lib/rubygems/commands/tag_command.rb
gem-release-0.4.0 lib/rubygems/commands/tag_command.rb
gem-release-0.3.1 lib/rubygems/commands/tag_command.rb
gem-release-0.3.0 lib/rubygems/commands/tag_command.rb
gem-release-0.2.2 lib/rubygems/commands/tag_command.rb
gem-release-0.2.1 lib/rubygems/commands/tag_command.rb