diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-18 21:29:41 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-18 21:29:41 +0000 |
commit | 95683e5cb2d1ab8351402b09ef853dcdf875bf8d (patch) | |
tree | 44500dba22e9aa94ecc5d4fd348512d0fb236501 /lib/rubygems/gemcutter_utilities.rb | |
parent | 81629f05312cc4df2193a17f13c581eda174d9af (diff) | |
download | ruby-95683e5cb2d1ab8351402b09ef853dcdf875bf8d.tar.gz |
* lib/rubygems: Update to RubyGems 2.2.0.preview.1
This brings several new features to RubyGems summarized here:
https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/gemcutter_utilities.rb')
-rw-r--r-- | lib/rubygems/gemcutter_utilities.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb index 9dbc18ba98..6a4da9e983 100644 --- a/lib/rubygems/gemcutter_utilities.rb +++ b/lib/rubygems/gemcutter_utilities.rb @@ -56,8 +56,10 @@ module Gem::GemcutterUtilities ## # Creates an RubyGems API to +host+ and +path+ with the given HTTP +method+. + # + # If +allowed_push_host+ metadata is present, then it will only allow that host. - def rubygems_api_request(method, path, host = nil, &block) + def rubygems_api_request(method, path, host = nil, allowed_push_host = nil, &block) require 'net/http' self.host = host if host @@ -66,6 +68,11 @@ module Gem::GemcutterUtilities terminate_interaction 1 # TODO: question this end + if allowed_push_host and self.host != allowed_push_host + alert_error "#{self.host.inspect} is not allowed by the gemspec, which only allows #{allowed_push_host.inspect}" + terminate_interaction 1 + end + uri = URI.parse "#{self.host}/#{path}" request_method = Net::HTTP.const_get method.to_s.capitalize |