aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/gemcutter_utilities.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-08 22:41:03 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-08 22:41:03 +0000
commit7083cebeaea83096128fc5ccb5f60bfbe5bcc939 (patch)
treefb25c12a6cc01a1a8de5221d64da632418e194a3 /lib/rubygems/gemcutter_utilities.rb
parentfa343a796fd256fc9098db7fdddf226fe5cbd181 (diff)
downloadruby-7083cebeaea83096128fc5ccb5f60bfbe5bcc939.tar.gz
* lib/rubygems: Update to RubyGems 2.0.4. See
https://github.com/rubygems/rubygems/blob/2.0/History.txt for changes git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/gemcutter_utilities.rb')
-rw-r--r--lib/rubygems/gemcutter_utilities.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb
index 474d07f775..04d7cd300f 100644
--- a/lib/rubygems/gemcutter_utilities.rb
+++ b/lib/rubygems/gemcutter_utilities.rb
@@ -38,7 +38,7 @@ module Gem::GemcutterUtilities
say "Enter your #{pretty_host} credentials."
say "Don't have an account yet? " +
- "Create one at https://#{sign_in_host}/sign_up"
+ "Create one at #{sign_in_host}/sign_up"
email = ask " Email: "
password = ask_for_password "Password: "
@@ -60,7 +60,14 @@ module Gem::GemcutterUtilities
configured_host = Gem.host unless
Gem.configuration.disable_default_gem_server
- @host ||= ENV['RUBYGEMS_HOST'] || configured_host
+ @host ||=
+ begin
+ env_rubygems_host = ENV['RUBYGEMS_HOST']
+ env_rubygems_host = nil if
+ env_rubygems_host and env_rubygems_host.empty?
+
+ env_rubygems_host|| configured_host
+ end
end
def rubygems_api_request(method, path, host = nil, &block)
@@ -79,7 +86,7 @@ module Gem::GemcutterUtilities
Gem::RemoteFetcher.fetcher.request(uri, request_method, &block)
end
- def with_response(resp)
+ def with_response resp, error_prefix = nil
case resp
when Net::HTTPSuccess then
if block_given? then
@@ -88,7 +95,10 @@ module Gem::GemcutterUtilities
say resp.body
end
else
- say resp.body
+ message = resp.body
+ message = "#{error_prefix}: #{message}" if error_prefix
+
+ say message
terminate_interaction 1 # TODO: question this
end
end