summaryrefslogtreecommitdiff
path: root/lib/bundler/cli
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-06-15 20:09:05 +0000
committerThe Bundler Bot <bot@bundler.io>2017-06-15 20:09:05 +0000
commit08d1fa6ce9a2f4317b0754525a42abecd89e4321 (patch)
treeff4b5700d6129c4f7ed7256658918e241e8c5f69 /lib/bundler/cli
parent955ad13d8e21117418342348c62a9c7c24a95d03 (diff)
parent237f03566013309760445af3c9c0cb76d0f99635 (diff)
downloadbundler-08d1fa6ce9a2f4317b0754525a42abecd89e4321.tar.gz
Auto merge of #5722 - bundler:seg-update-all-flag, r=indirect
Add `—all` flag to `bundle update` ### What was the end-user problem that led to this PR? The problem was that some users would think they needed to run `bundle update` instead of `bundle install`, and we want such a (potentially) destructive action to require more explicit user approval. ### Was was your diagnosis of the problem? My diagnosis was that `bundle update` shouldn't implicitly update _everything_ without an acknowledgement that it will do so. ### What is your fix for the problem, implemented in this PR? My fix, based on https://github.com/bundler/bundler/pull/2646, it to require `bundle update --all` for the current `bundle update` behavior. ### Why did you choose this fix out of the possible options? I chose this fix because it was already on 2-0-dev, courtesy of https://github.com/bundler/bundler-features/issues/18.
Diffstat (limited to 'lib/bundler/cli')
-rw-r--r--lib/bundler/cli/install.rb7
-rw-r--r--lib/bundler/cli/update.rb13
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index d57cad1e3f..f36ca94821 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -208,10 +208,11 @@ module Bundler
Bundler.settings[:clean] = options["clean"] if options["clean"]
- Bundler.settings.without = options[:without]
- Bundler.settings.with = options[:with]
+ Bundler.settings.without = options[:without] unless Bundler.settings.without == options[:without]
+ Bundler.settings.with = options[:with] unless Bundler.settings.with == options[:with]
- Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? true : nil
+ disable_shared_gems = Bundler.settings[:path] ? true : nil
+ Bundler.settings[:disable_shared_gems] = disable_shared_gems unless Bundler.settings[:disable_shared_gems] == disable_shared_gems
end
def warn_ambiguous_gems
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb
index df7524f004..9e4543668e 100644
--- a/lib/bundler/cli/update.rb
+++ b/lib/bundler/cli/update.rb
@@ -17,7 +17,18 @@ module Bundler
sources = Array(options[:source])
groups = Array(options[:group]).map(&:to_sym)
- if gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !options[:bundler]
+ full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !options[:bundler]
+
+ if full_update && !options[:all]
+ if Bundler.feature_flag.update_requires_all_flag?
+ raise InvalidOption, "To update everything, pass the `--all` flag."
+ end
+ SharedHelpers.major_deprecation "Pass --all to `bundle update` to update everything"
+ elsif !full_update && options[:all]
+ raise InvalidOption, "Cannot specify --all along with specific options."
+ end
+
+ if full_update
# We're doing a full update
Bundler.definition(true)
else