summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>2025-09-09 19:19:47 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-09-17 15:42:23 +0900
commit19a363680f2e009df275c3f973a35a6a703033db (patch)
tree34c713420257fd675871ec9239702b5b90df48d2
parente92543e76c13c257664e23d8f95a156e7cf9aef5 (diff)
[rubygems/rubygems] Make `bundle remove --install` raise an error
https://github.com/rubygems/rubygems/commit/444022cfd3
-rw-r--r--lib/bundler/cli.rb5
-rw-r--r--lib/bundler/man/bundle-remove.18
-rw-r--r--lib/bundler/man/bundle-remove.1.ronn9
-rw-r--r--spec/bundler/commands/remove_spec.rb15
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb8
5 files changed, 7 insertions, 38 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 8151de713a..87077f3c88 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -187,12 +187,11 @@ module Bundler
long_desc <<-D
Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If the gem is not found, Bundler prints a error message and if gem could not be removed due to any reason Bundler will display a warning.
D
- method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile"
+ method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile (removed)"
def remove(*gems)
if ARGV.include?("--install")
- message = "The `--install` flag has been deprecated. `bundle install` is triggered by default."
removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default."
- SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
+ raise InvalidOption, removed_message
end
require_relative "cli/remove"
diff --git a/lib/bundler/man/bundle-remove.1 b/lib/bundler/man/bundle-remove.1
index 63ffe0f157..4dc7a03b9f 100644
--- a/lib/bundler/man/bundle-remove.1
+++ b/lib/bundler/man/bundle-remove.1
@@ -4,18 +4,12 @@
.SH "NAME"
\fBbundle\-remove\fR \- Removes gems from the Gemfile
.SH "SYNOPSIS"
-\fBbundle remove [GEM [GEM \|\.\|\.\|\.]] [\-\-install]\fR
+`bundle remove [GEM [GEM \|\.\|\.\|\.]]
.SH "DESCRIPTION"
Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid\. If a gem cannot be removed, a warning is printed\. If a gem is already absent from the Gemfile, and error is raised\.
-.SH "OPTIONS"
-.TP
-\fB\-\-install\fR
-Runs \fBbundle install\fR after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s)\.
.P
Example:
.P
bundle remove rails
.P
bundle remove rails rack
-.P
-bundle remove rails rack \-\-install
diff --git a/lib/bundler/man/bundle-remove.1.ronn b/lib/bundler/man/bundle-remove.1.ronn
index ceb1a980be..49cb4dc1fd 100644
--- a/lib/bundler/man/bundle-remove.1.ronn
+++ b/lib/bundler/man/bundle-remove.1.ronn
@@ -3,21 +3,14 @@ bundle-remove(1) -- Removes gems from the Gemfile
## SYNOPSIS
-`bundle remove [GEM [GEM ...]] [--install]`
+`bundle remove [GEM [GEM ...]]
## DESCRIPTION
Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If a gem cannot be removed, a warning is printed. If a gem is already absent from the Gemfile, and error is raised.
-## OPTIONS
-
-* `--install`:
- Runs `bundle install` after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s).
-
Example:
bundle remove rails
bundle remove rails rack
-
-bundle remove rails rack --install
diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb
index 3e16346195..8a2e6778ea 100644
--- a/spec/bundler/commands/remove_spec.rb
+++ b/spec/bundler/commands/remove_spec.rb
@@ -43,21 +43,6 @@ RSpec.describe "bundle remove" do
end
end
- context "when --install flag is specified" do
- it "removes gems from .bundle" do
- gemfile <<-G
- source "https://gem.repo1"
-
- gem "myrack"
- G
-
- bundle "remove myrack --install"
-
- expect(out).to include("myrack was removed.")
- expect(the_bundle).to_not include_gems "myrack"
- end
- end
-
describe "remove single gem from gemfile" do
context "when gem is present in gemfile" do
it "shows success for removed gem" do
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index e9d62bc3b8..b3d631a19e 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -669,13 +669,11 @@ RSpec.describe "major deprecations" do
end
context "with --install" do
- it "shows a deprecation warning" do
- bundle "remove myrack --install"
+ it "fails with a helpful message" do
+ bundle "remove myrack --install", raise_on_error: false
- expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default."
+ expect(err).to include "The `--install` flag has been removed. `bundle install` is triggered by default."
end
-
- pending "fails with a helpful message", bundler: "4"
end
end