Skip to content

Commit 444022c

Browse files
Make bundle remove --install raise an error
1 parent a3d3df0 commit 444022c

File tree

5 files changed

+7
-38
lines changed

5 files changed

+7
-38
lines changed

bundler/lib/bundler/cli.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,11 @@ def check
187187
long_desc <<-D
188188
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.
189189
D
190-
method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile"
190+
method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile (removed)"
191191
def remove(*gems)
192192
if ARGV.include?("--install")
193-
message = "The `--install` flag has been deprecated. `bundle install` is triggered by default."
194193
removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default."
195-
SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
194+
raise InvalidOption, removed_message
196195
end
197196

198197
require_relative "cli/remove"

bundler/lib/bundler/man/bundle-remove.1

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44
.SH "NAME"
55
\fBbundle\-remove\fR \- Removes gems from the Gemfile
66
.SH "SYNOPSIS"
7-
\fBbundle remove [GEM [GEM \|\.\|\.\|\.]] [\-\-install]\fR
7+
`bundle remove [GEM [GEM \|\.\|\.\|\.]]
88
.SH "DESCRIPTION"
99
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\.
10-
.SH "OPTIONS"
11-
.TP
12-
\fB\-\-install\fR
13-
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)\.
1410
.P
1511
Example:
1612
.P
1713
bundle remove rails
1814
.P
1915
bundle remove rails rack
20-
.P
21-
bundle remove rails rack \-\-install

bundler/lib/bundler/man/bundle-remove.1.ronn

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,14 @@ bundle-remove(1) -- Removes gems from the Gemfile
33

44
## SYNOPSIS
55

6-
`bundle remove [GEM [GEM ...]] [--install]`
6+
`bundle remove [GEM [GEM ...]]
77

88
## DESCRIPTION
99

1010
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.
1111

12-
## OPTIONS
13-
14-
* `--install`:
15-
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).
16-
1712
Example:
1813

1914
bundle remove rails
2015

2116
bundle remove rails rack
22-
23-
bundle remove rails rack --install

bundler/spec/commands/remove_spec.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,6 @@
4343
end
4444
end
4545

46-
context "when --install flag is specified" do
47-
it "removes gems from .bundle" do
48-
gemfile <<-G
49-
source "https://gem.repo1"
50-
51-
gem "myrack"
52-
G
53-
54-
bundle "remove myrack --install"
55-
56-
expect(out).to include("myrack was removed.")
57-
expect(the_bundle).to_not include_gems "myrack"
58-
end
59-
end
60-
6146
describe "remove single gem from gemfile" do
6247
context "when gem is present in gemfile" do
6348
it "shows success for removed gem" do

bundler/spec/other/major_deprecation_spec.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -669,13 +669,11 @@
669669
end
670670

671671
context "with --install" do
672-
it "shows a deprecation warning" do
673-
bundle "remove myrack --install"
672+
it "fails with a helpful message" do
673+
bundle "remove myrack --install", raise_on_error: false
674674

675-
expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default."
675+
expect(err).to include "The `--install` flag has been removed. `bundle install` is triggered by default."
676676
end
677-
678-
pending "fails with a helpful message", bundler: "4"
679677
end
680678
end
681679

0 commit comments

Comments
 (0)