summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-05-16 15:20:02 -0700
committerAndre Arko <andre@arko.net>2015-05-16 15:20:02 -0700
commit9eef958bf531e723aa84f2334708aa3dc3feabb0 (patch)
treef3e65c424a4cd3b5124e372b70fa0d4c23ae03d5
parent6506ac5419248a9426d9becd4d337375a9cd24f3 (diff)
downloadbundler-9eef958bf531e723aa84f2334708aa3dc3feabb0.tar.gz
skip config warning when new value is unchanged
-rw-r--r--lib/bundler/cli/config.rb25
-rw-r--r--spec/commands/config_spec.rb2
2 files changed, 15 insertions, 12 deletions
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index 8d65e7c813..479e6f8a58 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -46,26 +46,29 @@ module Bundler
return
end
+ new_value = args.join(" ")
locations = Bundler.settings.locations(name)
if scope == "global"
- if local = locations[:local]
- Bundler.ui.info "Your application has set #{name} to #{local.inspect}. This will override the " \
- "global value you are currently setting"
+ if locations[:local]
+ Bundler.ui.info "Your application has set #{name} to #{locations[:local].inspect}. " \
+ "This will override the global value you are currently setting"
end
- if env = locations[:env]
- Bundler.ui.info "You have a bundler environment variable for #{name} set to #{env.inspect}. " \
- "This will take precedence over the global value you are setting"
+ if locations[:env]
+ Bundler.ui.info "You have a bundler environment variable for #{name} set to " \
+ "#{locations[:env].inspect}. This will take precedence over the global value you are setting"
end
- if global = locations[:global] and global != locations[:global]
- Bundler.ui.info "You are replacing the current global value of #{name}, which is currently #{global.inspect}"
+ if locations[:global] && locations[:global] != new_value
+ Bundler.ui.info "You are replacing the current global value of #{name}, which is currently " \
+ "#{locations[:global].inspect}"
end
end
- if scope == "local" && local = locations[:local]
- Bundler.ui.info "You are replacing the current local value of #{name}, which is currently #{local.inspect}"
+ if scope == "local" && locations[:local] != new_value
+ Bundler.ui.info "You are replacing the current local value of #{name}, which is currently " \
+ "#{locations[:local].inspect}"
end
if name.match(/\Alocal\./)
@@ -73,7 +76,7 @@ module Bundler
self.args = [pathname.expand_path.to_s] if pathname.directory?
end
- Bundler.settings.send("set_#{scope}", name, args.join(" "))
+ Bundler.settings.send("set_#{scope}", name, new_value)
else
Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
exit 1
diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb
index dd62d11ab1..9ee4994b9e 100644
--- a/spec/commands/config_spec.rb
+++ b/spec/commands/config_spec.rb
@@ -96,7 +96,7 @@ describe ".bundle/config" do
expect(out).to eq("global")
end
- it "do not warns when using the same value twice" do
+ it "does not warn when using the same value twice" do
bundle "config --global foo value"
bundle "config --global foo value"
expect(out).not_to match(/You are replacing the current global value of foo/)