Sha256: 6336965462e4d2736071396307d93cae4e4fc39d838e4f70eca7b44d7e106a82

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'rubygems/commands/build_command'
require 'rubygems/commands/push_command'
require 'rubygems/commands/tag_command'

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

  DEFAULTS = {
    :tag   => false,
    :quiet => false
  }

  attr_reader :arguments, :usage

  def initialize(options = {})
    super 'release', 'Build gem from a gemspec and push to rubygems.org', DEFAULTS.merge(options)

    option :tag,   '-t', 'Create a git tag and push --tags to origin'
    option :quiet, '-q', 'Do not output status messages'

    @arguments = "gemspec - optional gemspec file name, will use the first *.gemspec if not specified"
    @usage = "#{program_name} [gemspec]"
  end

  def execute
    build
    push
    remove
    tag if options[:tag]
    say "All is good, thanks buddy.\n"
  end

  protected

    def build
      BuildCommand.new.invoke(gemspec_filename)
    end

    def push
      PushCommand.new.invoke(gem_filename)
    end

    def remove
      say "Deleting left over gem file #{gem_filename}" unless quiet?
      `rm #{gem_filename}`
    end

    def tag
      TagCommand.new.invoke
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gem-release-0.0.17 lib/rubygems/commands/release_command.rb