From 19a363680f2e009df275c3f973a35a6a703033db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <2887858+deivid-rodriguez@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:19:47 +0200 Subject: [rubygems/rubygems] Make `bundle remove --install` raise an error https://github.com/rubygems/rubygems/commit/444022cfd3 --- lib/bundler/cli.rb | 5 ++--- lib/bundler/man/bundle-remove.1 | 8 +------- lib/bundler/man/bundle-remove.1.ronn | 9 +-------- spec/bundler/commands/remove_spec.rb | 15 --------------- spec/bundler/other/major_deprecation_spec.rb | 8 +++----- 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 -- cgit v1.2.3