Skip to content

Commit 6f71e0d

Browse files
Merge pull request #8979 from rubygems/deivid-rodriguez/make-bundle-plugin-local-git-raise-an-error
Make `--local-git` flag to `bundle plugin install` raise an error
2 parents 9ad90b2 + 40d660c commit 6f71e0d

6 files changed

Lines changed: 9 additions & 40 deletions

File tree

bundler/lib/bundler/cli/plugin.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ class CLI::Plugin < Thor
1010
method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from"
1111
method_option "version", type: :string, default: nil, banner: "The version of the plugin to fetch"
1212
method_option "git", type: :string, default: nil, banner: "URL of the git repo to fetch from"
13-
method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (deprecated)"
13+
method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (removed)"
1414
method_option "branch", type: :string, default: nil, banner: "The git branch to checkout"
1515
method_option "ref", type: :string, default: nil, banner: "The git revision to check out"
1616
method_option "path", type: :string, default: nil, banner: "Path of a local gem to directly use"
1717
def install(*plugins)
18+
if options.key?(:local_git)
19+
raise InvalidOption, "--local_git has been removed, use --git"
20+
end
21+
1822
Bundler::Plugin.install(plugins, options)
1923
end
2024

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.SH "NAME"
55
\fBbundle\-plugin\fR \- Manage Bundler plugins
66
.SH "SYNOPSIS"
7-
\fBbundle plugin\fR install PLUGINS [\-\-source=SOURCE] [\-\-version=VERSION] [\-\-git=GIT] [\-\-branch=BRANCH|\-\-ref=REF] [\-\-local\-git=LOCAL_GIT] [\-\-path=PATH]
7+
\fBbundle plugin\fR install PLUGINS [\-\-source=SOURCE] [\-\-version=VERSION] [\-\-git=GIT] [\-\-branch=BRANCH|\-\-ref=REF] [\-\-path=PATH]
88
.br
99
\fBbundle plugin\fR uninstall PLUGINS [\-\-all]
1010
.br
@@ -54,13 +54,6 @@ When you specify \fB\-\-git\fR, you can use \fB\-\-ref\fR to specify any tag, or
5454
Install the plugin gem from a local path\.
5555
.IP
5656
Example: \fBbundle plugin install bundler\-graph \-\-path \.\./bundler\-graph\fR
57-
.TP
58-
\fB\-\-local\-git=LOCAL_GIT\fR
59-
Install the plugin gem from a local Git repository\.
60-
.IP
61-
Example: \fBbundle plugin install bundler\-graph \-\-local\-git \.\./bundler\-graph\fR\.
62-
.IP
63-
This option is deprecated in favor of \fB\-\-git\fR\.
6457
.SS "uninstall"
6558
Uninstall the plugin(s) specified in PLUGINS\.
6659
.P

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ bundle-plugin(1) -- Manage Bundler plugins
55

66
`bundle plugin` install PLUGINS [--source=SOURCE] [--version=VERSION]
77
[--git=GIT] [--branch=BRANCH|--ref=REF]
8-
[--local-git=LOCAL_GIT]
98
[--path=PATH]<br>
109
`bundle plugin` uninstall PLUGINS [--all]<br>
1110
`bundle plugin` list<br>
@@ -59,13 +58,6 @@ global source specified in Gemfile is ignored.
5958

6059
Example: `bundle plugin install bundler-graph --path ../bundler-graph`
6160

62-
* `--local-git=LOCAL_GIT`:
63-
Install the plugin gem from a local Git repository.
64-
65-
Example: `bundle plugin install bundler-graph --local-git ../bundler-graph`.
66-
67-
This option is deprecated in favor of `--git`.
68-
6961
### uninstall
7062

7163
Uninstall the plugin(s) specified in PLUGINS.

bundler/lib/bundler/plugin/installer.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,6 @@ def definition.lock(*); end
4343
private
4444

4545
def check_sources_consistency!(options)
46-
if options.key?(:git) && options.key?(:local_git)
47-
raise InvalidOption, "Remote and local plugin git sources can't be both specified"
48-
end
49-
50-
# back-compat; local_git is an alias for git
51-
if options.key?(:local_git)
52-
Bundler::SharedHelpers.major_deprecation(2, "--local_git is deprecated, use --git")
53-
options[:git] = options.delete(:local_git)
54-
end
55-
5646
if (options.keys & [:source, :git, :path]).length > 1
5747
raise InvalidOption, "Only one of --source, --git, or --path may be specified"
5848
end

bundler/spec/other/major_deprecation_spec.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -702,14 +702,11 @@
702702
end
703703
end
704704

705-
it "prints a deprecation warning" do
706-
bundle "plugin install foo --local_git #{lib_path("foo-1.0")}"
705+
it "fails with a helpful message" do
706+
bundle "plugin install foo --local_git #{lib_path("foo-1.0")}", raise_on_error: false
707707

708-
expect(out).to include("Installed plugin foo")
709-
expect(deprecations).to include "--local_git is deprecated, use --git"
708+
expect(err).to include "--local_git has been removed, use --git"
710709
end
711-
712-
pending "fails with a helpful message", bundler: "4"
713710
end
714711

715712
describe "removing rubocop" do

bundler/spec/plugins/install_spec.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,6 @@ def exec(command, args)
203203
expect(out).to include("Installed plugin foo")
204204
plugin_should_be_installed("foo")
205205
end
206-
207-
it "raises an error when both git and local git sources are specified" do
208-
bundle "plugin install foo --git /phony/path/project --local_git git@gitphony.com:/repo/project", raise_on_error: false
209-
210-
expect(exitstatus).not_to eq(0)
211-
expect(err).to eq("Remote and local plugin git sources can't be both specified")
212-
end
213206
end
214207

215208
context "path plugins" do

0 commit comments

Comments
 (0)