Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ def remove(*gems)
"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."
Expand All @@ -230,6 +229,7 @@ def remove(*gems)
"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
Expand All @@ -256,7 +256,7 @@ def install
"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"
Expand All @@ -275,6 +275,7 @@ def install
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
Expand Down
4 changes: 2 additions & 2 deletions man/bundle-install.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
`bundle install` [--binstubs[=DIRECTORY]]
[--clean]
[--deployment]
[--force]
[--frozen]
[--full-index]
[--gemfile=GEMFILE]
Expand All @@ -16,6 +15,7 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
[--no-prune]
[--path PATH]
[--quiet]
[--redownload]
[--retry=NUMBER]
[--shebang]
[--standalone[=GROUP[ GROUP...]]]
Expand Down Expand Up @@ -69,7 +69,7 @@ time `bundle install` is run, use `bundle config` (see bundle-config(1)).
production or CI use. Please check carefully if you want to have this option
enabled in your development environment.

* `--force`:
* `--redownload`:
Force download every gem, even if the required versions are already available
locally.

Expand Down
4 changes: 2 additions & 2 deletions man/bundle-update.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ bundle-update(1) -- Update your gems to the latest available versions
[--full-index]
[--jobs=JOBS]
[--quiet]
[--force]
[--patch|--minor|--major]
[--redownload]
[--strict]
[--conservative]

Expand Down Expand Up @@ -64,7 +64,7 @@ gem.
* `--quiet`:
Only output warnings and errors.

* `--force`:
* `--redownload`:
Force downloading every gem.

* `--patch`:
Expand Down
62 changes: 0 additions & 62 deletions spec/install/force_spec.rb

This file was deleted.

90 changes: 90 additions & 0 deletions spec/install/redownload_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# frozen_string_literal: true

RSpec.describe "bundle install", :bundler => "2" do
before :each do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
G
end

shared_examples_for "an option to force redownloading gems" do
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, flag => true

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, flag => true

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) }

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")

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

it "works on first bundle install" do
bundle! :install, flag => true

expect(the_bundle).to include_gems "foo 1.0"
end
end
end

describe "with --force" do
it_behaves_like "an option to force redownloading gems" do
let(:flag) { "force" }
end

it "shows a deprecation when single flag passed" do
bundle! "install --force"
expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end

it "shows a deprecation when multiple flags passed" do
bundle! "install --no-color --force"
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 when single flag passed" do
bundle! "install --redownload"
expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end

it "does not show a deprecation when single multiple flags passed" do
bundle! "install --no-color --redownload"
expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end
end
end
34 changes: 34 additions & 0 deletions spec/update/redownload_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: true

RSpec.describe "bundle update", :bundler => "2" do
before :each do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
G
end

describe "with --force" do
it "shows a deprecation when single flag passed" do
bundle! "update rack --force"
expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end

it "shows a deprecation when multiple flags passed" do
bundle! "update rack --no-color --force"
expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end
end

describe "with --redownload" do
it "does not show a deprecation when single flag passed" do
bundle! "update rack --redownload"
expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end

it "does not show a deprecation when single multiple flags passed" do
bundle! "update rack --no-color --redownload"
expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end
end
end