summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/push_command.rb
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/commands/push_command.rb12
1 files changed, 8 insertions, 4 deletions
@@ -27,7 +27,8 @@ class Gem::Commands::PushCommand < Gem::Command
def initialize
super 'push', description
add_proxy_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]
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
end
with_response response