[rubygems/rubygems] Ignore commented out keys in config file
https://github.com/rubygems/rubygems/commit/c4a8d2a930
This commit is contained in:
parent
5fd6b461c7
commit
dc06375c4f
@ -492,16 +492,19 @@ module Bundler
|
|||||||
valid_file = file.exist? && !file.size.zero?
|
valid_file = file.exist? && !file.size.zero?
|
||||||
return {} unless valid_file
|
return {} unless valid_file
|
||||||
serializer_class.load(file.read).inject({}) do |config, (k, v)|
|
serializer_class.load(file.read).inject({}) do |config, (k, v)|
|
||||||
if k.include?("-")
|
unless k.start_with?("#")
|
||||||
Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
|
if k.include?("-")
|
||||||
"This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \
|
Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
|
||||||
"Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)."
|
"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
|
# string hash keys are frozen
|
||||||
k = k.gsub("-", "___")
|
k = k.gsub("-", "___")
|
||||||
|
end
|
||||||
|
|
||||||
|
config[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
config[k] = v
|
|
||||||
config
|
config
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -319,6 +319,15 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
|
|||||||
expect(settings["mirror.https://rubygems.org/"]).to eq("http://rubygems-mirror.org")
|
expect(settings["mirror.https://rubygems.org/"]).to eq("http://rubygems-mirror.org")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "ignores commented out keys" do
|
||||||
|
create_file bundled_app(".bundle/config"), <<~C
|
||||||
|
# BUNDLE_MY-PERSONAL-SERVER__ORG: my-personal-server.org
|
||||||
|
C
|
||||||
|
|
||||||
|
expect(Bundler.ui).not_to receive(:warn)
|
||||||
|
expect(settings.all).to be_empty
|
||||||
|
end
|
||||||
|
|
||||||
it "converts older keys with dashes" do
|
it "converts older keys with dashes" do
|
||||||
config("BUNDLE_MY-PERSONAL-SERVER__ORG" => "my-personal-server.org")
|
config("BUNDLE_MY-PERSONAL-SERVER__ORG" => "my-personal-server.org")
|
||||||
expect(Bundler.ui).to receive(:warn).with(
|
expect(Bundler.ui).to receive(:warn).with(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user