diff options
Diffstat (limited to 'lib/rubygems/config_file.rb')
-rw-r--r-- | lib/rubygems/config_file.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb index 36cf20194c..97c11bd95d 100644 --- a/lib/rubygems/config_file.rb +++ b/lib/rubygems/config_file.rb @@ -352,7 +352,27 @@ if you believe they were disclosed to a third party. begin content = Bundler::YAMLSerializer.load(File.read(filename)) - unless content.is_a? Hash + if content.is_a? Hash + content.transform_keys! do |k| + if k.match?(/__/) + if k.is_a?(Symbol) + k.to_s.gsub(/__/,".").to_sym + else + k.dup.gsub(/__/,".") + end + else + k + end + end + + content.transform_values! do |v| + if (v.is_a?(Hash) || v.is_a?(String)) && v.empty? + nil + else + v + end + end + else warn "Failed to load #{filename} because it doesn't contain valid YAML hash" return {} end |