Sha256: 9e9695c2634962d483647ab5134ba7c3369616dedc905dac9f6903182c1b2a3a

Contents?: true

Size: 1.24 KB

Versions: 67

Compression:

Stored size: 1.24 KB

Contents

require "rubygems/command_manager"
require "rubygems/command"
require "gem_publisher"

class Gem::Commands::PublishCommand < Gem::Command
  def initialize
    super "publish", "Automatically publish a gem if the version has been updated"

    defaults.merge! :gem_repository => "rubygems"

    add_option(
      "-rREPOSITORY", "--repository=REPOSITORY",
      "Set the gem repository (rubygems or gemfury)",
      "Default: #{defaults[:gem_repository]}") do |value, options|
      options[:gem_repository] = value
    end

    add_option(
      "-aAS", "--as=AS",
      "Specify a shared account to publish the gem (gemfury only)"
    ) do |value, options|
      options[:as] = value
    end
  end

  def usage # :nodoc:
    "#{program_name} GEMFILE [GEMFILE ...]"
  end

  def execute
    options[:args].each do |gemspec|
      Dir.chdir(File.dirname(gemspec)) do
        new_opts = {}
        new_opts[:as] = options[:as] if options[:as]

        gem = GemPublisher.publish_if_updated(File.basename(gemspec), options[:gem_repository], new_opts)

        if gem
          $stderr.puts "Published #{gem}"
        else
          $stderr.puts "Nothing to do for #{gemspec}"
        end
      end
    end
  end
end

Gem::CommandManager.instance.register_command :publish

Version data entries

67 entries across 63 versions & 18 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/gem_publisher-1.5.0/lib/rubygems_plugin.rb