summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2018-09-18 20:12:01 -0300
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2018-09-18 21:40:54 -0300
commit18ae708c3c3736a17879ce365368e6db7a5576ab (patch)
treeb6fbdafeaf79798082a27c651d5f848dcec40db9
parent90109e4efd2ba96967a2f2a8326c6f82d4e67297 (diff)
downloadbundler-18ae708c3c3736a17879ce365368e6db7a5576ab.tar.gz
Deprecate `bundle install --force`
Instead of hard erroring, deprecate the `--force` flag on bundler 2 to better teach users about the replacement. Before: $ bundle install --force Unknown switches '--force' After: $ bundle install --force [DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload` Could not locate Gemfile # or whatever the expected behavior for --redownload is
-rw-r--r--lib/bundler/cli.rb4
-rw-r--r--spec/install/redownload_spec.rb10
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index f692ae5f13..73f4e1bf9d 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[1] == "--force"
require "bundler/cli/install"
Bundler.settings.temporary(:no_install => false) do
Install.new(options.dup).run
diff --git a/spec/install/redownload_spec.rb b/spec/install/redownload_spec.rb
index 626a4a8e9f..d6fcc9c2b8 100644
--- a/spec/install/redownload_spec.rb
+++ b/spec/install/redownload_spec.rb
@@ -60,11 +60,21 @@ RSpec.describe "bundle install" do
it_behaves_like "an option to force redownloading gems" do
let(:flag) { "force" }
end
+
+ it "shows a deprecation" do
+ bundle! :install, :force => true
+ expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ end
end
describe "with --redownload" do
it_behaves_like "an option to force redownloading gems" do
let(:flag) { "redownload" }
end
+
+ it "does not show a deprecation" do
+ bundle! :install, :redownload => true
+ expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ end
end
end