Sha256: 7438a6a54dc5201e53274983ac6853d97f2157f8b34bb1f80f4d37c5559caece

Contents?: true

Size: 756 Bytes

Versions: 9

Compression:

Stored size: 756 Bytes

Contents

class Gem::Commands::PushCommand < Gem::AbstractCommand

  def description
    'Push a gem up to Gemcutter'
  end

  def arguments
    "GEM       built gem to push up"
  end

  def usage
    "#{program_name} GEM"
  end

  def initialize
    super 'push', description
    add_proxy_option
  end

  def execute
    setup
    send_gem
  end

  def send_gem
    say "Pushing gem to Gemcutter..."

    name = get_one_gem_name
    response = make_request(:post, "gems") do |request|
      request.body = File.open(name, 'rb'){|io| io.read }
      request.add_field("Content-Length", request.body.size)
      request.add_field("Content-Type", "application/octet-stream")
      request.add_field("Authorization", api_key)
    end

    say response.body
  end

end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
botanicus-gemcutter-0.2.1 lib/commands/push.rb
gemcutter-0.2.1 lib/commands/push.rb
gemcutter-0.2.0 lib/commands/push.rb
gemcutter-0.1.8 lib/commands/push.rb
gemcutter-0.1.7 lib/commands/push.rb
gemcutter-0.1.6 lib/commands/push.rb
gemcutter-0.1.5 lib/commands/push.rb
gemcutter-0.1.4 lib/commands/push.rb
gemcutter-0.1.3 lib/commands/push.rb