summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-07-19 13:51:13 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-07-19 15:54:40 -0500
commitcb88c7189bd6af5223a276a5f5862ee3254eb684 (patch)
tree4fd7ec73fb83b5b7e6f1c49ea49f63d037b405d4
parent9760e0898734340d1d44f7a5a6b84341b0c512ae (diff)
downloadbundler-cb88c7189bd6af5223a276a5f5862ee3254eb684.tar.gz
[CLI] Deprecate install --force in favor of --redownload
-rw-r--r--lib/bundler/cli.rb3
-rw-r--r--lib/bundler/cli/install.rb2
-rw-r--r--spec/install/force_spec.rb84
3 files changed, 47 insertions, 42 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 2284466bbb..92696276e3 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -170,7 +170,8 @@ 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 "force", :type => :boolean, :banner =>
+ method_option "redownload", :type => :boolean, :aliases =>
+ [Bundler.feature_flag.forget_cli_options? ? nil : "--force"].compact, :banner =>
"Force downloading every gem."
method_option "no-prune", :type => :boolean, :banner =>
"Don't remove stale gems from the cache."
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index bd91db1b89..cc41cce7a6 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -194,6 +194,8 @@ module Bundler
disable_shared_gems = Bundler.settings[:path] ? true : nil
Bundler.settings.set_command_option :disable_shared_gems, disable_shared_gems unless Bundler.settings[:disable_shared_gems] == disable_shared_gems
+
+ options[:force] = options[:redownload]
end
def warn_ambiguous_gems
diff --git a/spec/install/force_spec.rb b/spec/install/force_spec.rb
index 5592e62d68..52fa4f0d61 100644
--- a/spec/install/force_spec.rb
+++ b/spec/install/force_spec.rb
@@ -1,59 +1,61 @@
# frozen_string_literal: true
RSpec.describe "bundle install" do
- describe "with --force" do
- before :each do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- G
- end
+ %w[force redownload].each do |flag|
+ describe_opts = {}
+ describe_opts[:bundler] = "< 2" if flag == "force"
+ describe "with --#{flag}", describe_opts do
+ before :each do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+ end
- it "re-installs installed gems" do
- rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb")
+ it "re-installs installed gems" do
+ rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb")
- bundle "install"
- rack_lib.open("w") {|f| f.write("blah blah blah") }
- bundle "install --force"
+ bundle! :install
+ rack_lib.open("w") {|f| f.write("blah blah blah") }
+ bundle! :install, flag => true
- expect(exitstatus).to eq(0) if exitstatus
- expect(out).to include "Installing rack 1.0.0"
- expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n")
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
+ expect(out).to include "Installing rack 1.0.0"
+ expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n")
+ expect(the_bundle).to include_gems "rack 1.0.0"
+ end
- it "works on first bundle install" do
- bundle "install --force"
+ it "works on first bundle install" do
+ bundle! :install, flag => true
- expect(exitstatus).to eq(0) if exitstatus
- expect(out).to include "Installing rack 1.0.0"
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
+ expect(out).to include "Installing rack 1.0.0"
+ expect(the_bundle).to include_gems "rack 1.0.0"
+ end
- context "with a git gem" do
- let!(:ref) { build_git("foo", "1.0").ref_for("HEAD", 11) }
+ context "with a git gem" do
+ let!(:ref) { build_git("foo", "1.0").ref_for("HEAD", 11) }
- before do
- gemfile <<-G
- gem "foo", :git => "#{lib_path("foo-1.0")}"
- G
- end
+ before do
+ gemfile <<-G
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
+ G
+ end
- it "re-installs installed gems" do
- foo_lib = default_bundle_path("bundler/gems/foo-1.0-#{ref}/lib/foo.rb")
+ it "re-installs installed gems" do
+ foo_lib = default_bundle_path("bundler/gems/foo-1.0-#{ref}/lib/foo.rb")
- bundle! "install"
- foo_lib.open("w") {|f| f.write("blah blah blah") }
- bundle! "install --force"
+ bundle! :install
+ foo_lib.open("w") {|f| f.write("blah blah blah") }
+ bundle! :install, flag => true
- expect(foo_lib.open(&:read)).to eq("FOO = '1.0'\n")
- expect(the_bundle).to include_gems "foo 1.0"
- end
+ expect(foo_lib.open(&:read)).to eq("FOO = '1.0'\n")
+ expect(the_bundle).to include_gems "foo 1.0"
+ end
- it "works on first bundle install" do
- bundle! "install --force"
+ it "works on first bundle install" do
+ bundle! :install, flag => true
- expect(the_bundle).to include_gems "foo 1.0"
+ expect(the_bundle).to include_gems "foo 1.0"
+ end
end
end
end