diff options
Diffstat (limited to 'lib/rubygems/commands/push_command.rb')
-rw-r--r-- | lib/rubygems/commands/push_command.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb index e72b74ebbf..c85a259564 100644 --- a/lib/rubygems/commands/push_command.rb +++ b/lib/rubygems/commands/push_command.rb @@ -27,7 +27,8 @@ class Gem::Commands::PushCommand < Gem::Command def initialize super 'push', description add_proxy_option - + add_key_option + add_option( '--host HOST', 'Push to another gemcutter-compatible host' @@ -42,17 +43,20 @@ class Gem::Commands::PushCommand < Gem::Command end def send_gem name - say "Pushing gem to #{options[:host] || Gem.host}..." - args = [:post, "api/v1/gems"] args << options[:host] if options[:host] + if Gem.latest_rubygems_version < Gem::Version.new(Gem::VERSION) then + alert_error "Using beta/unreleased version of rubygems. Not pushing." + terminate_interaction 1 + end + response = rubygems_api_request(*args) do |request| request.body = Gem.read_binary name request.add_field "Content-Length", request.body.size request.add_field "Content-Type", "application/octet-stream" - request.add_field "Authorization", Gem.configuration.rubygems_api_key + request.add_field "Authorization", api_key end with_response response |