summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2018-09-18 23:53:18 +0000
committerThe Bundler Bot <bot@bundler.io>2018-09-18 23:53:18 +0000
commit63fd4f3f1f93238c762eab84718605221b138aaa (patch)
tree156ca44bc6d73a33b10f515935bcbb5e19da8872 /lib
parentc0f8ce3434d6774e3229bcef4b85309b57ebac2e (diff)
parentc72a0946e65a298071fb3d38e9146e6c4b6dba02 (diff)
downloadbundler-auto.tar.gz
Auto merge of #6702 - bundler:better_force_to_redownload_transition, r=indirectauto
Better `--force` to `--redownload` transition ### What was the end-user problem that led to this PR? The problem was. that, while trying to run `bundle install --force` today, I was getting the error `unknown switch --force` error, and I was not sure what was causing it and what I needed to do to fix it. Also, running `bundle install --help` would show `--force` as a supported option, so that would make things even more confusing. ### What was your diagnosis of the problem? My diagnosis was that: * A lot of removal/renaming of options in bundler 2 are artificially linked to the `forget_cli_options` switch. To me, those changes even though they are related (stopping rememebering cli options prompted us to actually remove some unnecessary ones), they are independent, so it's not straighforward to find out that it's the `forget_cli_options` setting causing this rename to be in place. * We should show a helpful deprecation message instead of a hard error, so the transition is easier for users. * We should update the commands help to document newer instead of deprecated options. * The `bundle update` command has an equivalent `--force` option that should be renamed too for sanity. ### What is your fix for the problem, implemented in this PR? My fix to the above problems is to: * Always keep the `--force` alias, independently of whether the `forget_cli_options` is set or not. * Show a deprecation message when `--force` is used in bundler 2, but still keep it working as before. * Update the commands help to use `--redownload`. * Make the equivalent changes to the `bundle update` ### Why did you choose this fix out of the possible options? I chose this fix because it seems like the more user friendly way going forward in my opinion.
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index f692ae5f13..53241b15f6 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -206,8 +206,7 @@ module Bundler
"Do not attempt to fetch gems remotely and use the gem cache instead"
deprecated_option "no-cache", :type => :boolean, :banner =>
"Don't update the existing gem cache."
- method_option "redownload", :type => :boolean, :aliases =>
- [Bundler.feature_flag.forget_cli_options? ? nil : "--force"].compact, :banner =>
+ method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
"Force downloading every gem."
deprecated_option "no-prune", :type => :boolean, :banner =>
"Don't remove stale gems from the cache."
@@ -230,6 +229,7 @@ module Bundler
"Include gems that are part of the specified named group."
map "i" => "install"
def install
+ SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require "bundler/cli/install"
Bundler.settings.temporary(:no_install => false) do
Install.new(options.dup).run
@@ -256,7 +256,7 @@ module Bundler
"Only output warnings and errors."
method_option "source", :type => :array, :banner =>
"Update a specific source (and all gems associated with it)"
- method_option "force", :type => :boolean, :banner =>
+ method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
"Force downloading every gem."
method_option "ruby", :type => :boolean, :banner =>
"Update ruby specified in Gemfile.lock"
@@ -275,6 +275,7 @@ module Bundler
method_option "all", :type => :boolean, :banner =>
"Update everything."
def update(*gems)
+ SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require "bundler/cli/update"
Update.new(options, gems).run
end