summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Arko <mail@arko.net>2015-09-16 14:08:47 -0700
committerAndré Arko <mail@arko.net>2015-09-16 14:08:47 -0700
commitfab9d5529949ee4b714425450742b503d4f8899e (patch)
tree29af64df5186d97c37412cbed5b0b14b43b1032b
parent6537da87398bc45384abbcb1ee23e3ad15adba8e (diff)
parentccc3fba43a4a330d798c34fee7fdbe49d97237d3 (diff)
downloadbundler-fab9d5529949ee4b714425450742b503d4f8899e.tar.gz
Merge pull request #3993 from asymmetric/save-path-in-conflicts
Persist path to configuration when there are conflicts
-rw-r--r--lib/bundler/cli/config.rb10
-rw-r--r--spec/commands/config_spec.rb21
2 files changed, 18 insertions, 13 deletions
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index d984f1979c..8d07100446 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -75,7 +75,7 @@ module Bundler
"#{locations[:local].inspect}"
end
- return if resolve_system_path_conflicts(name, new_value, scope) == :conflict
+ resolve_system_path_conflicts(name, new_value, scope)
resolve_group_conflicts(name, new_value, scope)
delete_config(name, nil) if new_value == "" and (name == "with" or name == "without")
@@ -105,21 +105,13 @@ module Bundler
# @param [String] scope
# the scope of the option being set by the user (either `"local"` or
# `"global"`).
- #
- # @return [Symbol] Either `:conflict` or `:no_conflict`, depending on whether
- # the options conflict.
- #
def resolve_system_path_conflicts(name, new_value, scope = "global")
if name == "path.system" and Bundler.settings[:path] and new_value == "true"
Bundler.ui.warn "`path` is already configured, so it will be unset."
delete_config("path")
- :conflict
elsif name == "path" and Bundler.settings["path.system"]
Bundler.ui.warn "`path.system` is already configured, so it will be unset."
delete_config("path.system")
- :conflict
- else
- :no_conflict
end
end
diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb
index c5cf6ca784..a9adde3711 100644
--- a/spec/commands/config_spec.rb
+++ b/spec/commands/config_spec.rb
@@ -307,8 +307,15 @@ E
bundle "config path #{bundled_app(".bundle")}"
expect(out).to include("`path.system` is already configured")
- run "puts Bundler.settings['path.system'] == nil"
- expect(out).to eq("true")
+
+ expect(Bundler.settings["path.system"]).to be_nil
+ end
+
+ it "should persist `path`" do
+ bundle "config path.system true"
+ bundle "config path #{bundled_app(".bundle")}"
+
+ expect(Bundler.settings[:path]).to eq(bundled_app(".bundle").to_s)
end
end
@@ -320,8 +327,14 @@ E
bundle "config path.system true"
expect(out).to include("`path` is already configured")
- run "puts Bundler.settings[:path] == nil"
- expect(out).to eq("true")
+ expect(Bundler.settings[:path]).to be_nil
+ end
+
+ it "should persist `path.system`" do
+ bundle "config path #{default_bundle_path}"
+ bundle "config path.system true"
+
+ expect(Bundler.settings["path.system"]).to eq("true")
end
end
end