8000 [rubygems/rubygems] Deprecate `bundle plugin install --local-git=` · jeremyevans/ruby@cb029fa · GitHub
[go: up one dir, main page]

Skip to content

Commit cb029fa

Browse files
ccutrermatzbot
authored andcommitted
[rubygems/rubygems] Deprecate bundle plugin install --local-git=
It's the exact same implementation as --git rubygems/rubygems@18eb2418c6
1 parent 8a8df49 commit cb029fa

File tree

7 files changed

+36
-23
lines changed

7 files changed

+36
-23
lines changed

lib/bundler/cli/plugin.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ module Bundler
55
class CLI::Plugin < Thor
66
desc "install PLUGINS", "Install the plugin from the source"
77
long_desc <<-D
8-
Install plugins either from the rubygems source provided (with --source option) or from a git source provided with --git (for remote repos) or --local_git (for local repos). If no sources are provided, it uses Gem.sources
8+
Install plugins either from the rubygems source provided (with --source option) or from a git source provided with --git. If no sources are provided, it uses Gem.sources
99
D
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"
13+
method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (deprecated)"
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
def install(*plugins)

lib/bundler/man/bundle-plugin.1

Lines changed: 3 additions & 3 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=\fISOURCE\fR] [\-\-version=\fIversion\fR] [\-\-git|\-\-local_git=\fIgit\-url\fR] [\-\-branch=\fIbranch\fR|\-\-ref=\fIrev\fR]
7+
\fBbundle plugin\fR install PLUGINS [\-\-source=\fISOURCE\fR] [\-\-version=\fIversion\fR] [\-\-git=\fIgit\-url\fR] [\-\-branch=\fIbranch\fR|\-\-ref=\fIrev\fR]
88
.br
99
\fBbundle plugin\fR uninstall PLUGINS
1010
.br
@@ -27,7 +27,7 @@ Install bundler\-graph gem from example\.com\. The global source, specified in s
2727
You can specify the version of the gem via \fB\-\-version\fR\.
2828
.TP
2929
\fBbundle plugin install bundler\-graph \-\-git https://github\.com/rubygems/bundler\-graph\fR
30-
Install bundler\-graph gem from Git repository\. \fB\-\-git\fR can be replaced with \fB\-\-local\-git\fR\. You cannot use both \fB\-\-git\fR and \fB\-\-local\-git\fR\. You can use standard Git URLs like:
30+
Install bundler\-graph gem from Git repository\. You can use standard Git URLs like:
3131
.IP
3232
\fBssh://[user@]host\.xz[:port]/path/to/repo\.git\fR
3333
.br
@@ -37,7 +37,7 @@ Install bundler\-graph gem from Git repository\. \fB\-\-git\fR can be replaced w
3737
.br
3838
\fBfile:///path/to/repo\fR
3939
.IP
40-
When you specify \fB\-\-git\fR/\fB\-\-local\-git\fR, you can use \fB\-\-branch\fR or \fB\-\-ref\fR to specify any branch, tag, or commit hash (revision) to use\. When you specify both, only the latter is used\.
40+
When you specify \fB\-\-git\fR, you can use \fB\-\-branch\fR or \fB\-\-ref\fR to specify any branch, tag, or commit hash (revision) to use\. When you specify both, only the latter is used\.
4141
.SS "uninstall"
4242
Uninstall the plugin(s) specified in PLUGINS\.
4343
.SS "list"

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ bundle-plugin(1) -- Manage Bundler plugins
44
## SYNOPSIS
55

66
`bundle plugin` install PLUGINS [--source=<SOURCE>] [--version=<version>]
7-
[--git|--local_git=<git-url>] [--branch=<branch>|--ref=<rev>]<br>
7+
[--git=<git-url>] [--branch=<branch>|--ref=<rev>]<br>
88
`bundle plugin` uninstall PLUGINS<br>
99
`bundle plugin` list<br>
1010
`bundle plugin` help [COMMAND]
@@ -29,14 +29,14 @@ Install the given plugin(s).
2929
You can specify the version of the gem via `--version`.
3030

3131
* `bundle plugin install bundler-graph --git https://github.com/rubygems/bundler-graph`:
32-
Install bundler-graph gem from Git repository. `--git` can be replaced with `--local-git`. You cannot use both `--git` and `--local-git`. You can use standard Git URLs like:
32+
Install bundler-graph gem from Git repository. You can use standard Git URLs like:
3333

3434
`ssh://[user@]host.xz[:port]/path/to/repo.git`<br>
3535
`http[s]://host.xz[:port]/path/to/repo.git`<br>
3636
`/path/to/repo`<br>
3737
`file:///path/to/repo`
3838

39-
When you specify `--git`/`--local-git`, you can use `--branch` or `--ref` to specify any branch, tag, or commit hash (revision) to use. When you specify both, only the latter is used.
39+
When you specify `--git`, you can use `--branch` or `--ref` to specify any branch, tag, or commit hash (revision) to use. When you specify both, only the latter is used.
4040

4141
### uninstall
4242

lib/bundler/plugin/installer.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ def install(names, options)
1818

1919
if options[:git]
2020
install_git(names, version, options)
21-
elsif options[:local_git]
22-
install_local_git(names, version, options)
2321
else
2422
sources = options[:source] || Gem.sources
2523
install_rubygems(names, version, sources)
@@ -45,6 +43,11 @@ def check_sources_consistency!(options)
4543
if options.key?(:git) && options.key?(:local_git)
4644
raise InvalidOption, "Remote and local plugin git sources can't be both specified"
4745
end
46+
# back-compat; local_git is an alias for git
47+
if options.key?(:local_git)
48+
Bundler::SharedHelpers.major_deprecation(2, "--local_git is deprecated, use --git")
49+
options[:git] = options.delete(:local_git)
50+
end
4851
end
4952

5053
def install_git(names, version, options)
@@ -54,13 +57,6 @@ def install_git(names, version, options)
5457
install_all_sources(names, version, options, options[:source])
5558
end
5659

57-
def install_local_git(names, version, options)
58-
uri = options.delete(:local_git)
59-
options["uri"] = uri
60-
61-
install_all_sources(names, version, options, options[:source])
62-
end
63-
6460
# Installs the plugin from rubygems source and returns the path where the
6561
# plugin was installed
6662
#

spec/bundler/bundler/plugin/installer_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
end
2626

2727
it "returns the installed spec after installing local git plugins" do
28-
allow(installer).to receive(:install_local_git).
28+
allow(installer).to receive(:install_git).
2929
and_return("new-plugin" => spec)
3030

31-
expect(installer.install(["new-plugin"], local_git: "/phony/path/repo")).
31+
expect(installer.install(["new-plugin"], git: "/phony/path/repo")).
3232
to eq("new-plugin" => spec)
3333
end
3434

@@ -80,7 +80,7 @@
8080
end
8181

8282
let(:result) do
83-
installer.install(["ga-plugin"], local_git: lib_path("ga-plugin").to_s)
83+
installer.install(["ga-plugin"], git: lib_path("ga-plugin").to_s)
8484
end
8585

8686
it "returns the installed spec after installing" do

spec/bundler/other/major_deprecation_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,23 @@
601601
pending "fails with a helpful message", bundler: "3"
602602
end
603603

604+
context "bundle plugin install --local_git" do
605+
before do
606+
build_git "foo" do |s|
607+
s.write "plugins.rb"
608+
end
609+
end
610+
611+
it "prints a deprecation warning", bundler: "< 3" do
612+
bundle "plugin install foo --local_git #{lib_path("foo-1.0")}"
613+
614+
expect(out).to include("Installed plugin foo")
615+
expect(deprecations).to include "--local_git is deprecated, use --git"
616+
end
617+
618+
pending "fails with a helpful message", bundler: "3"
619+
end
620+
604621
describe "deprecating rubocop", :readline do
605622
context "bundle gem --rubocop" do
606623
before do

spec/bundler/plugins/install_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ def exec(command, args)
196196
s.write "plugins.rb"
197197
end
198198

199-
bundle "plugin install foo --local_git #{lib_path("foo-1.0")}"
199+
bundle "plugin install foo --git #{lib_path("foo-1.0")}"
200200

201201
expect(out).to include("Installed plugin foo")
202202
plugin_should_be_installed("foo")
203203
end
204204

205-
it "raises an error when both git and local git sources are specified" do
206-
bundle "plugin install foo --local_git /phony/path/project --git git@gitphony.com:/repo/project", raise_on_error: false
205+
it "raises an error when both git and local git sources are specified", bundler: "< 3" do
206+
bundle "plugin install foo --git /phony/path/project --local_git git@gitphony.com:/repo/project", raise_on_error: false
207207

208208
expect(exitstatus).not_to eq(0)
209209
expect(err).to eq("Remote and local plugin git sources can't be both specified")

0 commit comments

Comments
 (0)
0