diff options
author | David Rodriguez <deivid.rodriguez@riseup.net> | 2024-03-13 16:29:18 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-03-17 22:55:16 +0000 |
commit | dc06375c4fd471ed75da74e28154357a22c2d862 (patch) | |
tree | f80b18439a51571450fac9578adab1ad85506d8a /lib/bundler/settings.rb | |
parent | 5fd6b461c777654493c32c03c19f0b75362b966f (diff) |
[rubygems/rubygems] Ignore commented out keys in config file
https://github.com/rubygems/rubygems/commit/c4a8d2a930
Diffstat (limited to 'lib/bundler/settings.rb')
-rw-r--r-- | lib/bundler/settings.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index d84089ee41..379abfb24a 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -492,16 +492,19 @@ module Bundler valid_file = file.exist? && !file.size.zero? return {} unless valid_file serializer_class.load(file.read).inject({}) do |config, (k, v)| - if k.include?("-") - Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \ - "This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \ - "Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)." + unless k.start_with?("#") + if k.include?("-") + Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \ + "This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \ + "Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)." - # string hash keys are frozen - k = k.gsub("-", "___") + # string hash keys are frozen + k = k.gsub("-", "___") + end + + config[k] = v end - config[k] = v config end end |