diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-01 09:41:32 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-01 09:41:32 +0000 |
commit | 25a9b62d45ddd60a231272567c7dda9337da9b62 (patch) | |
tree | e72ba4c9c01cba5fb510eb1eafaba76d998baf4c /lib/rubygems/commands/push_command.rb | |
parent | 86bb0af7ea3b50f72e6845a6f5f64cb1b23fd279 (diff) | |
download | ruby-25a9b62d45ddd60a231272567c7dda9337da9b62.tar.gz |
Import rubygems 1.6.0 (released version @ 58d8a0b9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 |