summaryrefslogtreecommitdiff
path: root/lib/rubygems/config_file.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-01 09:41:32 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-01 09:41:32 +0000
commit25a9b62d45ddd60a231272567c7dda9337da9b62 (patch)
treee72ba4c9c01cba5fb510eb1eafaba76d998baf4c /lib/rubygems/config_file.rb
parent86bb0af7ea3b50f72e6845a6f5f64cb1b23fd279 (diff)
Import rubygems 1.6.0 (released version @ 58d8a0b9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/config_file.rb')
-rw-r--r--lib/rubygems/config_file.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index f3593999d3..1d16cd90ce 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -130,6 +130,11 @@ class Gem::ConfigFile
attr_reader :rubygems_api_key
##
+ # Hash of RubyGems.org and alternate API keys
+
+ attr_reader :api_keys
+
+ ##
# Create the config file object. +args+ is the list of arguments
# from the command line.
#
@@ -192,7 +197,7 @@ class Gem::ConfigFile
@update_sources = @hash[:update_sources] if @hash.key? :update_sources
@verbose = @hash[:verbose] if @hash.key? :verbose
- load_rubygems_api_key
+ load_api_keys
Gem.sources = @hash[:sources] if @hash.key? :sources
handle_arguments arg_list
@@ -205,10 +210,12 @@ class Gem::ConfigFile
File.join(Gem.user_home, '.gem', 'credentials')
end
- def load_rubygems_api_key
- api_key_hash = File.exists?(credentials_path) ? load_file(credentials_path) : @hash
-
- @rubygems_api_key = api_key_hash[:rubygems_api_key] if api_key_hash.key? :rubygems_api_key
+ def load_api_keys
+ @api_keys = File.exists?(credentials_path) ? load_file(credentials_path) : @hash
+ 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)