diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-25 07:30:41 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-25 07:30:41 +0000 |
commit | e276482efc1c274ba9cfe17f5e6fbe02819a15bb () | |
tree | bd7593e76ccb8374388f6ec5f8f6f639e696a7fb /lib/rubygems/config_file.rb | |
parent | be26224be568166b5db530cd377bf71d78e985d8 (diff) |
* lib/rubygems/config_file.rb: Lazily load .gem/credentials to only
check permissions when necessary. RubyGems bug #465 * test/rubygems/test_gem_config_file.rb: Test for the above. * test/rubygems/test_gem_commands_push_command.rb: Remove duplicated test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/rubygems/config_file.rb | 39 |
1 files changed, 26 insertions, 13 deletions
@@ -127,16 +127,6 @@ class Gem::ConfigFile attr_accessor :update_sources ## - # API key for RubyGems.org - - attr_reader :rubygems_api_key - - ## - # Hash of RubyGems.org and alternate API keys - - attr_reader :api_keys - - ## # True if we want to force specification of gem server when pushing a gem attr_accessor :disable_default_gem_server @@ -221,13 +211,23 @@ class Gem::ConfigFile @ssl_verify_mode = @hash[:ssl_verify_mode] if @hash.key? :ssl_verify_mode @ssl_ca_cert = @hash[:ssl_ca_cert] if @hash.key? :ssl_ca_cert - load_api_keys Gem.sources = @hash[:sources] if @hash.key? :sources handle_arguments arg_list end ## # Checks the permissions of the credentials file. If they are not 0600 an # error message is displayed and RubyGems aborts. @@ -273,11 +273,24 @@ if you believe they were disclosed to a third party. end if @api_keys.key? :rubygems_api_key then - @rubygems_api_key = @api_keys[:rubygems_api_key] - @api_keys[:rubygems] = @api_keys.delete :rubygems_api_key unless @api_keys.key? :rubygems end end def rubygems_api_key= api_key check_credentials_permissions |