From 5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 Mon Sep 17 00:00:00 2001 From: hsbt Date: Wed, 21 Nov 2018 10:20:47 +0000 Subject: Merge master branch from rubygems/rubygems upstream. * Enable Style/MethodDefParentheses in Rubocop https://github.com/rubygems/rubygems/pull/2478 * Enable Style/MultilineIfThen in Rubocop https://github.com/rubygems/rubygems/pull/2479 * Fix required_ruby_version with prereleases and improve error message https://github.com/rubygems/rubygems/pull/2344 * Fix bundler rubygems binstub not properly looking for bundler https://github.com/rubygems/rubygems/pull/2426 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/gemcutter_utilities.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lib/rubygems/gemcutter_utilities.rb') diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb index 7c6d6bb364..6fe8455498 100644 --- a/lib/rubygems/gemcutter_utilities.rb +++ b/lib/rubygems/gemcutter_utilities.rb @@ -28,7 +28,7 @@ module Gem::GemcutterUtilities # The API key from the command options or from the user's configuration. def api_key - if options[:key] then + if options[:key] verify_api_key options[:key] elsif Gem.configuration.api_keys.key?(host) Gem.configuration.api_keys[host] @@ -90,11 +90,11 @@ module Gem::GemcutterUtilities # Signs in with the RubyGems API at +sign_in_host+ and sets the rubygems API # key. - def sign_in sign_in_host = nil + def sign_in(sign_in_host = nil) sign_in_host ||= self.host return if api_key - pretty_host = if Gem::DEFAULT_HOST == sign_in_host then + pretty_host = if Gem::DEFAULT_HOST == sign_in_host 'RubyGems.org' else sign_in_host @@ -124,7 +124,7 @@ module Gem::GemcutterUtilities # an error. def verify_api_key(key) - if Gem.configuration.api_keys.key? key then + if Gem.configuration.api_keys.key? key Gem.configuration.api_keys[key] else alert_error "No such API key. Please add it to your configuration (done automatically on initial `gem push`)." @@ -139,10 +139,10 @@ module Gem::GemcutterUtilities # If the response was not successful, shows an error to the user including # the +error_prefix+ and the response body. - def with_response response, error_prefix = nil + def with_response(response, error_prefix = nil) case response when Net::HTTPSuccess then - if block_given? then + if block_given? yield response else say response.body @@ -156,7 +156,7 @@ module Gem::GemcutterUtilities end end - def set_api_key host, key + def set_api_key(host, key) if host == Gem::DEFAULT_HOST Gem.configuration.rubygems_api_key = key else @@ -165,4 +165,3 @@ module Gem::GemcutterUtilities end end - -- cgit v1.2.3