Sha256: 8ce2045952f1e00096cdab605ad90bc82ec98d434a523d62505d931afe16cacb

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

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

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

  attr_reader :arguments, :usage

  def initialize
    super('release', 'Build a gem from a gemspec and push to rubygems.org', :tag => false)
    add_option('-t', '--tag', "Create a git tag and push --tags to origin. Defaults to #{options[:tag]}.") do |tag, options|
      options[:tag] = tag
    end
    @arguments = "gemspec - optional gemspec file, will use the first *.gemspec if not specified"
    @usage = "#{program_name} [gemspec]"
  end

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

  protected

    def build
      BuildCommand.new.invoke(gemspec_filename)
    end

    def push
      PushCommand.new.invoke(gem_filename)
    end

    def remove
      `rm #{gem_filename}`
      say "Deleting left over gem file #{gem_filename}"
    end
    
    def tag
      TagCommand.new.invoke
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gem-release-0.0.8 lib/rubygems/commands/release_command.rb
gem-release-0.0.7 lib/rubygems/commands/release_command.rb
gem-release-0.0.6 lib/rubygems/commands/release_command.rb