diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 00:08:49 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 00:08:49 +0000 |
commit | e798ccbacf489a3af2201ae30058ff0ae7f79045 () | |
tree | 4147a7834eb88323057fd2120a2ddc96c1eb32ab /lib/rubygems/config_file.rb | |
parent | d26fb035cae8d351dc238376722c980230dc5fbd (diff) |
Import rubygems 1.5.0 (release candidate)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/rubygems/config_file.rb | 37 |
1 files changed, 31 insertions, 6 deletions
@@ -1,3 +1,9 @@ #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. @@ -47,10 +53,29 @@ class Gem::ConfigFile system_config_path = begin - require 'etc.so' Etc.sysconfdir - rescue LoadError - '/etc' end SYSTEM_WIDE_CONFIG_FILE = File.join system_config_path, 'gemrc' @@ -192,7 +217,7 @@ class Gem::ConfigFile dirname = File.dirname(credentials_path) Dir.mkdir(dirname) unless File.exists?(dirname) - require 'yaml' File.open(credentials_path, 'w') do |f| f.write config.to_yaml @@ -202,9 +227,10 @@ class Gem::ConfigFile end def load_file(filename) return {} unless filename and File.exists?(filename) begin - require 'yaml' YAML.load(File.read(filename)) rescue ArgumentError warn "Failed to load #{config_file_name}" @@ -299,7 +325,6 @@ class Gem::ConfigFile # Writes out this config file, replacing its source. def write - require 'yaml' open config_file_name, 'w' do |io| io.write to_yaml end |