summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-04-15 10:41:58 +1000
committerColby Swandale <colby@taplaboratories.com>2017-04-15 10:41:58 +1000
commit3c52af901fb41b5d82a53ec5300e53b700404d50 (patch)
tree74e5dd2820db8ae70d92de49ddc4411cc8849e59
parentb6c30144033a36c116525550ae3e13637b30f021 (diff)
downloadbundler-3c52af901fb41b5d82a53ec5300e53b700404d50.tar.gz
print key & value on config set and print new value when overwritting existing config
-rw-r--r--lib/bundler/cli/config.rb10
-rw-r--r--spec/commands/config_spec.rb9
2 files changed, 12 insertions, 7 deletions
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index 8ad7f12fac..e8f13620ec 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -33,7 +33,12 @@ module Bundler
end
if args.empty?
- return Bundler.ui.info(Bundler.settings[name]) if options[:parseable]
+ if options[:parseable]
+ if value = Bundler.settings[name]
+ Bundler.ui.info("#{name}=#{value}")
+ end
+ return
+ end
confirm(name)
return
@@ -80,8 +85,7 @@ module Bundler
def message
locations = Bundler.settings.locations(name)
if @options[:parseable]
- value = locations[:local] || locations[:env] || locations[:global]
- "#{name}=#{value}" if value
+ "#{name}=#{new_value}" if new_value
elsif scope == "global"
if locations[:local]
"Your application has set #{name} to #{locations[:local].inspect}. " \
diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb
index 030a85ff62..a3ca696ec1 100644
--- a/spec/commands/config_spec.rb
+++ b/spec/commands/config_spec.rb
@@ -139,6 +139,7 @@ RSpec.describe ".bundle/config" do
it "saves with parseable option" do
bundle "config --global --parseable foo value"
+ expect(out).to eq("foo=value")
run "puts Bundler.settings['foo']"
expect(out).to eq("value")
end
@@ -147,7 +148,7 @@ RSpec.describe ".bundle/config" do
before { bundle "config --global foo value" }
it "prints the current value in a parseable format" do
bundle "config --global --parseable foo value2"
- expect(out).to eq "foo=value"
+ expect(out).to eq "foo=value2"
run "puts Bundler.settings['foo']"
expect(out).to eq("value2")
end
@@ -256,14 +257,14 @@ RSpec.describe ".bundle/config" do
bundle "config foo local"
bundle "config foo --parseable"
- expect(out).to eq "local"
+ expect(out).to eq "foo=local"
end
it "can print global config" do
bundle "config --global bar value"
bundle "config bar --parseable"
- expect(out).to eq "value"
+ expect(out).to eq "bar=value"
end
it "preferes local config over global" do
@@ -271,7 +272,7 @@ RSpec.describe ".bundle/config" do
bundle "config --global bar value"
bundle "config bar --parseable"
- expect(out).to eq "value2"
+ expect(out).to eq "bar=value2"
end
end