mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Cancel --force
deprecation in favor of --redownload
I realized `--redownload` is not a good name, because it does not necessarily redownloads gems. It only forces reinstallation even if gem is already installed. So I believe `--force` is actually a better name and the introduction of `--force` was a misunderstanding of what the `--force` flag did at the time. Let's cancel the deprecation of `--force`. For now the `--redownload` alias is left around until we decide what to do with it.
This commit is contained in:
parent
851a3e7724
commit
60fca1defc
11 changed files with 54 additions and 92 deletions
|
@ -220,7 +220,7 @@ module Bundler
|
|||
method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
|
||||
method_option "prefer-local", type: :boolean, banner: "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
|
||||
method_option "no-cache", type: :boolean, banner: "Don't update the existing gem cache."
|
||||
method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
|
||||
method_option "force", type: :boolean, aliases: "--redownload", banner: "Force reinstalling every gem, even if already installed"
|
||||
method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
|
||||
method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
|
||||
method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
|
||||
|
@ -232,8 +232,6 @@ module Bundler
|
|||
method_option "without", type: :array, banner: "Exclude gems that are part of the specified named group."
|
||||
method_option "with", type: :array, banner: "Include gems that are part of the specified named group."
|
||||
def install
|
||||
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
|
||||
|
||||
%w[clean deployment frozen no-prune path shebang without with].each do |option|
|
||||
remembered_flag_deprecation(option)
|
||||
end
|
||||
|
@ -263,7 +261,7 @@ module Bundler
|
|||
method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
|
||||
method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
|
||||
method_option "source", type: :array, banner: "Update a specific source (and all gems associated with it)"
|
||||
method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
|
||||
method_option "force", type: :boolean, aliases: "--redownload", banner: "Force reinstalling every gem, even if already installed"
|
||||
method_option "ruby", type: :boolean, banner: "Update ruby specified in Gemfile.lock"
|
||||
method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
|
||||
method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
|
||||
|
@ -274,7 +272,6 @@ module Bundler
|
|||
method_option "conservative", type: :boolean, banner: "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
|
||||
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_relative "cli/update"
|
||||
Bundler.settings.temporary(no_install: false) do
|
||||
Update.new(options, gems).run
|
||||
|
|
|
@ -179,7 +179,7 @@ module Bundler
|
|||
|
||||
normalize_groups if options[:without] || options[:with]
|
||||
|
||||
options[:force] = options[:redownload]
|
||||
options[:force] = options[:redownload] if options[:redownload]
|
||||
end
|
||||
|
||||
def warn_ambiguous_gems
|
||||
|
|
|
@ -63,7 +63,7 @@ module Bundler
|
|||
opts = options.dup
|
||||
opts["update"] = true
|
||||
opts["local"] = options[:local]
|
||||
opts["force"] = options[:redownload]
|
||||
opts["force"] = options[:redownload] if options[:redownload]
|
||||
|
||||
Bundler.settings.set_command_option_if_given :jobs, opts["jobs"]
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
.SH "NAME"
|
||||
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
|
||||
.SH "SYNOPSIS"
|
||||
\fBbundle install\fR [\-\-binstubs[=DIRECTORY]] [\-\-clean] [\-\-deployment] [\-\-frozen] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-no\-cache] [\-\-no\-prune] [\-\-path PATH] [\-\-prefer\-local] [\-\-quiet] [\-\-redownload] [\-\-retry=NUMBER] [\-\-shebang=SHEBANG] [\-\-standalone[=GROUP[ GROUP\|\.\|\.\|\.]]] [\-\-system] [\-\-trust\-policy=TRUST\-POLICY] [\-\-target\-rbconfig=TARGET\-RBCONFIG] [\-\-with=GROUP[ GROUP\|\.\|\.\|\.]] [\-\-without=GROUP[ GROUP\|\.\|\.\|\.]]
|
||||
\fBbundle install\fR [\-\-binstubs[=DIRECTORY]] [\-\-clean] [\-\-deployment] [\-\-force] [\-\-frozen] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-no\-cache] [\-\-no\-prune] [\-\-path PATH] [\-\-prefer\-local] [\-\-quiet] [\-\-retry=NUMBER] [\-\-shebang=SHEBANG] [\-\-standalone[=GROUP[ GROUP\|\.\|\.\|\.]]] [\-\-system] [\-\-trust\-policy=TRUST\-POLICY] [\-\-target\-rbconfig=TARGET\-RBCONFIG] [\-\-with=GROUP[ GROUP\|\.\|\.\|\.]] [\-\-without=GROUP[ GROUP\|\.\|\.\|\.]]
|
||||
.SH "DESCRIPTION"
|
||||
Install the gems specified in your Gemfile(5)\. If this is the first time you run bundle install (and a \fBGemfile\.lock\fR does not exist), Bundler will fetch all remote sources, resolve dependencies and install all needed gems\.
|
||||
.P
|
||||
|
@ -29,8 +29,8 @@ In \fIdeployment mode\fR, Bundler will 'roll\-out' the bundle for production or
|
|||
.IP
|
||||
This option is deprecated in favor of the \fBdeployment\fR setting\.
|
||||
.TP
|
||||
\fB\-\-redownload\fR, \fB\-\-force\fR
|
||||
Force download every gem, even if the required versions are already available locally\.
|
||||
\fB\-\-force\fR, \fB\-\-redownload\fR
|
||||
Force reinstalling every gem, even if already installed\.
|
||||
.TP
|
||||
\fB\-\-frozen\fR
|
||||
Do not allow the Gemfile\.lock to be updated after this install\. Exits non\-zero if there are going to be changes to the Gemfile\.lock\.
|
||||
|
|
|
@ -6,6 +6,7 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
|
|||
`bundle install` [--binstubs[=DIRECTORY]]
|
||||
[--clean]
|
||||
[--deployment]
|
||||
[--force]
|
||||
[--frozen]
|
||||
[--full-index]
|
||||
[--gemfile=GEMFILE]
|
||||
|
@ -16,7 +17,6 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
|
|||
[--path PATH]
|
||||
[--prefer-local]
|
||||
[--quiet]
|
||||
[--redownload]
|
||||
[--retry=NUMBER]
|
||||
[--shebang=SHEBANG]
|
||||
[--standalone[=GROUP[ GROUP...]]]
|
||||
|
@ -80,9 +80,8 @@ automatically and that requires `bundler` to silently remember them. Since
|
|||
|
||||
This option is deprecated in favor of the `deployment` setting.
|
||||
|
||||
* `--redownload`, `--force`:
|
||||
Force download every gem, even if the required versions are already available
|
||||
locally.
|
||||
* `--force`, `--redownload`:
|
||||
Force reinstalling every gem, even if already installed.
|
||||
|
||||
* `--frozen`:
|
||||
Do not allow the Gemfile.lock to be updated after this install. Exits
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
.SH "NAME"
|
||||
\fBbundle\-update\fR \- Update your gems to the latest available versions
|
||||
.SH "SYNOPSIS"
|
||||
\fBbundle update\fR \fI*gems\fR [\-\-all] [\-\-group=NAME] [\-\-source=NAME] [\-\-local] [\-\-ruby] [\-\-bundler[=VERSION]] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-quiet] [\-\-patch|\-\-minor|\-\-major] [\-\-pre] [\-\-redownload] [\-\-strict] [\-\-conservative]
|
||||
\fBbundle update\fR \fI*gems\fR [\-\-all] [\-\-group=NAME] [\-\-source=NAME] [\-\-local] [\-\-ruby] [\-\-bundler[=VERSION]] [\-\-force] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-quiet] [\-\-patch|\-\-minor|\-\-major] [\-\-pre] [\-\-strict] [\-\-conservative]
|
||||
.SH "DESCRIPTION"
|
||||
Update the gems specified (all gems, if \fB\-\-all\fR flag is used), ignoring the previously installed gems specified in the \fBGemfile\.lock\fR\. In general, you should use bundle install(1) \fIbundle\-install\.1\.html\fR to install the same exact gems and versions across machines\.
|
||||
.P
|
||||
|
@ -29,6 +29,9 @@ Update the locked version of Ruby to the current version of Ruby\.
|
|||
\fB\-\-bundler[=BUNDLER]\fR
|
||||
Update the locked version of bundler to the invoked bundler version\.
|
||||
.TP
|
||||
\fB\-\-force\fR, \fB\-\-redownload\fR
|
||||
Force reinstalling every gem, even if already installed\.
|
||||
.TP
|
||||
\fB\-\-full\-index\fR
|
||||
Fall back to using the single\-file index of all gems\.
|
||||
.TP
|
||||
|
@ -44,9 +47,6 @@ Retry failed network or git requests for \fInumber\fR times\.
|
|||
\fB\-\-quiet\fR
|
||||
Only output warnings and errors\.
|
||||
.TP
|
||||
\fB\-\-redownload\fR, \fB\-\-force\fR
|
||||
Force downloading every gem\.
|
||||
.TP
|
||||
\fB\-\-patch\fR
|
||||
Prefer updating only to next patch version\.
|
||||
.TP
|
||||
|
|
|
@ -9,13 +9,13 @@ bundle-update(1) -- Update your gems to the latest available versions
|
|||
[--local]
|
||||
[--ruby]
|
||||
[--bundler[=VERSION]]
|
||||
[--force]
|
||||
[--full-index]
|
||||
[--gemfile=GEMFILE]
|
||||
[--jobs=NUMBER]
|
||||
[--quiet]
|
||||
[--patch|--minor|--major]
|
||||
[--pre]
|
||||
[--redownload]
|
||||
[--strict]
|
||||
[--conservative]
|
||||
|
||||
|
@ -54,6 +54,9 @@ gem.
|
|||
* `--bundler[=BUNDLER]`:
|
||||
Update the locked version of bundler to the invoked bundler version.
|
||||
|
||||
* `--force`, `--redownload`:
|
||||
Force reinstalling every gem, even if already installed.
|
||||
|
||||
* `--full-index`:
|
||||
Fall back to using the single-file index of all gems.
|
||||
|
||||
|
@ -70,9 +73,6 @@ gem.
|
|||
* `--quiet`:
|
||||
Only output warnings and errors.
|
||||
|
||||
* `--redownload`, `--force`:
|
||||
Force downloading every gem.
|
||||
|
||||
* `--patch`:
|
||||
Prefer updating only to next patch version.
|
||||
|
||||
|
|
|
@ -1105,7 +1105,7 @@ RSpec.describe "bundle install with gem sources" do
|
|||
FileUtils.chmod("-x", foo_path)
|
||||
|
||||
begin
|
||||
bundle "install --redownload", raise_on_error: false
|
||||
bundle "install --force", raise_on_error: false
|
||||
ensure
|
||||
FileUtils.chmod("+x", foo_path)
|
||||
end
|
||||
|
@ -1141,7 +1141,7 @@ RSpec.describe "bundle install with gem sources" do
|
|||
FileUtils.chmod("-w", gem_home)
|
||||
|
||||
begin
|
||||
bundle "install --redownload"
|
||||
bundle "install --force"
|
||||
ensure
|
||||
FileUtils.chmod("+w", gem_home)
|
||||
end
|
||||
|
@ -1175,7 +1175,7 @@ RSpec.describe "bundle install with gem sources" do
|
|||
|
||||
FileUtils.chmod(0o777, gems_path)
|
||||
|
||||
bundle "install --redownload", raise_on_error: false
|
||||
bundle "install --force", raise_on_error: false
|
||||
|
||||
expect(err).to include("Bundler cannot reinstall foo-1.0.0 because there's a previous installation of it at #{gems_path}/foo-1.0.0 that is unsafe to remove")
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe "bundle install" do
|
|||
G
|
||||
end
|
||||
|
||||
shared_examples_for "an option to force redownloading gems" do
|
||||
shared_examples_for "an option to force reinstalling gems" do
|
||||
it "re-installs installed gems" do
|
||||
myrack_lib = default_bundle_path("gems/myrack-1.0.0/lib/myrack.rb")
|
||||
|
||||
|
@ -58,34 +58,14 @@ RSpec.describe "bundle install" do
|
|||
end
|
||||
|
||||
describe "with --force" do
|
||||
it_behaves_like "an option to force redownloading gems" do
|
||||
it_behaves_like "an option to force reinstalling gems" do
|
||||
let(:flag) { "force" }
|
||||
end
|
||||
|
||||
it "shows a deprecation when single flag passed" do
|
||||
bundle "install --force"
|
||||
expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
||||
end
|
||||
|
||||
it "shows a deprecation when multiple flags passed" do
|
||||
bundle "install --no-color --force"
|
||||
expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
||||
end
|
||||
end
|
||||
|
||||
describe "with --redownload" do
|
||||
it_behaves_like "an option to force redownloading gems" do
|
||||
it_behaves_like "an option to force reinstalling gems" do
|
||||
let(:flag) { "redownload" }
|
||||
end
|
||||
|
||||
it "does not show a deprecation when single flag passed" do
|
||||
bundle "install --redownload"
|
||||
expect(err).not_to include "[DEPRECATED] 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(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
||||
end
|
||||
end
|
||||
end
|
30
spec/bundler/update/force_spec.rb
Normal file
30
spec/bundler/update/force_spec.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "bundle update" do
|
||||
before :each do
|
||||
install_gemfile <<-G
|
||||
source "https://gem.repo1"
|
||||
gem "myrack"
|
||||
G
|
||||
end
|
||||
|
||||
it "re-installs installed gems with --force" do
|
||||
myrack_lib = default_bundle_path("gems/myrack-1.0.0/lib/myrack.rb")
|
||||
myrack_lib.open("w") {|f| f.write("blah blah blah") }
|
||||
bundle :update, force: true
|
||||
|
||||
expect(out).to include "Installing myrack 1.0.0"
|
||||
expect(myrack_lib.open(&:read)).to eq("MYRACK = '1.0.0'\n")
|
||||
expect(the_bundle).to include_gems "myrack 1.0.0"
|
||||
end
|
||||
|
||||
it "re-installs installed gems with --redownload" do
|
||||
myrack_lib = default_bundle_path("gems/myrack-1.0.0/lib/myrack.rb")
|
||||
myrack_lib.open("w") {|f| f.write("blah blah blah") }
|
||||
bundle :update, redownload: true
|
||||
|
||||
expect(out).to include "Installing myrack 1.0.0"
|
||||
expect(myrack_lib.open(&:read)).to eq("MYRACK = '1.0.0'\n")
|
||||
expect(the_bundle).to include_gems "myrack 1.0.0"
|
||||
end
|
||||
end
|
|
@ -1,44 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "bundle update" do
|
||||
before :each do
|
||||
install_gemfile <<-G
|
||||
source "https://gem.repo1"
|
||||
gem "myrack"
|
||||
G
|
||||
end
|
||||
|
||||
describe "with --force" do
|
||||
it "shows a deprecation when single flag passed" do
|
||||
bundle "update myrack --force"
|
||||
expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
||||
end
|
||||
|
||||
it "shows a deprecation when multiple flags passed" do
|
||||
bundle "update myrack --no-color --force"
|
||||
expect(err).to include "[DEPRECATED] 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 myrack --redownload"
|
||||
expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
||||
end
|
||||
|
||||
it "does not show a deprecation when single multiple flags passed" do
|
||||
bundle "update myrack --no-color --redownload"
|
||||
expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
||||
end
|
||||
|
||||
it "re-installs installed gems" do
|
||||
myrack_lib = default_bundle_path("gems/myrack-1.0.0/lib/myrack.rb")
|
||||
myrack_lib.open("w") {|f| f.write("blah blah blah") }
|
||||
bundle :update, redownload: true
|
||||
|
||||
expect(out).to include "Installing myrack 1.0.0"
|
||||
expect(myrack_lib.open(&:read)).to eq("MYRACK = '1.0.0'\n")
|
||||
expect(the_bundle).to include_gems "myrack 1.0.0"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue