diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 06:52:18 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 06:52:18 +0000 |
commit | 9694bb8cac12969300692dac5a1cf7aa4e3a46cd (patch) | |
tree | c3cb423d701f7049ba9382de052e2a937cd1302d /lib/rubygems/gemcutter_utilities.rb | |
parent | 3f606b7063fc7a8b191556365ad343a314719a8d (diff) | |
download | ruby-9694bb8cac12969300692dac5a1cf7aa4e3a46cd.tar.gz |
* lib/rubygems*: Updated to RubyGems 2.0
* test/rubygems*: ditto.
* common.mk (prelude): Updated for RubyGems 2.0 source rearrangement.
* tool/change_maker.rb: Allow invalid UTF-8 characters in source
files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/gemcutter_utilities.rb')
-rw-r--r-- | lib/rubygems/gemcutter_utilities.rb | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb index c0e7ee99e9..3042092125 100644 --- a/lib/rubygems/gemcutter_utilities.rb +++ b/lib/rubygems/gemcutter_utilities.rb @@ -1,6 +1,7 @@ require 'rubygems/remote_fetcher' module Gem::GemcutterUtilities + # TODO: move to Gem::Command OptionParser.accept Symbol do |value| value.to_sym end @@ -19,6 +20,8 @@ module Gem::GemcutterUtilities def api_key if options[:key] then verify_api_key options[:key] + elsif Gem.configuration.api_keys.key?(host) + Gem.configuration.api_keys[host] else Gem.configuration.rubygems_api_key end @@ -44,12 +47,24 @@ module Gem::GemcutterUtilities end end - def rubygems_api_request(method, path, host = Gem.host, &block) + attr_writer :host + def host + configured_host = Gem.host unless + Gem.configuration.disable_default_gem_server + + @host ||= ENV['RUBYGEMS_HOST'] || configured_host + end + + def rubygems_api_request(method, path, host = nil, &block) require 'net/http' - host = ENV['RUBYGEMS_HOST'] if ENV['RUBYGEMS_HOST'] - uri = URI.parse "#{host}/#{path}" - say "Pushing gem to #{host}..." + self.host = host if host + unless self.host + alert_error "You must specify a gem server" + terminate_interaction 1 # TODO: question this + end + + uri = URI.parse "#{self.host}/#{path}" request_method = Net::HTTP.const_get method.to_s.capitalize @@ -66,7 +81,7 @@ module Gem::GemcutterUtilities end else say resp.body - terminate_interaction 1 + terminate_interaction 1 # TODO: question this end end @@ -74,8 +89,8 @@ module Gem::GemcutterUtilities if Gem.configuration.api_keys.key? key then Gem.configuration.api_keys[key] else - alert_error "No such API key. You can add it with gem keys --add #{key}" - terminate_interaction 1 + alert_error "No such API key. Please add it to your configuration (done automatically on initial `gem push`)." + terminate_interaction 1 # TODO: question this end end |