Skip to content

Commit

Permalink
Deprecate bundle plugin install --local-git=
Browse files Browse the repository at this point in the history
It's the exact same implementation as --git
  • Loading branch information
ccutrer authored and hsbt committed Dec 6, 2023
1 parent 2ca7f8f commit e2f97df
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions bundler/lib/bundler/cli/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Bundler
class CLI::Plugin < Thor
desc "install PLUGINS", "Install the plugin from the source"
long_desc <<-D
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
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
D
method_option "source", :type => :string, :default => nil, :banner =>
"URL of the RubyGems source to fetch the plugin from"
Expand All @@ -14,7 +14,7 @@ class CLI::Plugin < Thor
method_option "git", :type => :string, :default => nil, :banner =>
"URL of the git repo to fetch from"
method_option "local_git", :type => :string, :default => nil, :banner =>
"Path of the local git repo to fetch from"
"Path of the local git repo to fetch from (deprecated)"
method_option "branch", :type => :string, :default => nil, :banner =>
"The git branch to checkout"
method_option "ref", :type => :string, :default => nil, :banner =>
Expand Down
6 changes: 3 additions & 3 deletions bundler/lib/bundler/man/bundle-plugin.1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\fBbundle\-plugin\fR \- Manage Bundler plugins
.
.SH "SYNOPSIS"
\fBbundle plugin\fR install PLUGINS [\-\-source=\fISOURCE\fR] [\-\-version=\fIversion\fR] [\-\-git|\-\-local_git=\fIgit\-url\fR] [\-\-branch=\fIbranch\fR|\-\-ref=\fIrev\fR]
\fBbundle plugin\fR install PLUGINS [\-\-source=\fISOURCE\fR] [\-\-version=\fIversion\fR] [\-\-git=\fIgit\-url\fR] [\-\-branch=\fIbranch\fR|\-\-ref=\fIrev\fR]
.
.br
\fBbundle plugin\fR uninstall PLUGINS
Expand Down Expand Up @@ -40,7 +40,7 @@ You can specify the version of the gem via \fB\-\-version\fR\.
.
.TP
\fBbundle plugin install bundler\-graph \-\-git https://github\.com/rubygems/bundler\-graph\fR
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:
Install bundler\-graph gem from Git repository\. You can use standard Git URLs like:
.
.IP
\fBssh://[user@]host\.xz[:port]/path/to/repo\.git\fR
Expand All @@ -55,7 +55,7 @@ Install bundler\-graph gem from Git repository\. \fB\-\-git\fR can be replaced w
\fBfile:///path/to/repo\fR
.
.IP
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\.
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\.
.
.SS "uninstall"
Uninstall the plugin(s) specified in PLUGINS\.
Expand Down
6 changes: 3 additions & 3 deletions bundler/lib/bundler/man/bundle-plugin.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ bundle-plugin(1) -- Manage Bundler plugins
## SYNOPSIS

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

* `bundle plugin install bundler-graph --git https://github.com/rubygems/bundler-graph`:
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:
Install bundler-graph gem from Git repository. You can use standard Git URLs like:

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

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

### uninstall

Expand Down
14 changes: 5 additions & 9 deletions bundler/lib/bundler/plugin/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def install(names, options)

if options[:git]
install_git(names, version, options)
elsif options[:local_git]
install_local_git(names, version, options)
else
sources = options[:source] || Gem.sources
install_rubygems(names, version, sources)
Expand All @@ -45,6 +43,11 @@ def check_sources_consistency!(options)
if options.key?(:git) && options.key?(:local_git)
raise InvalidOption, "Remote and local plugin git sources can't be both specified"
end
# back-compat; local_git is an alias for git
if options.key?(:local_git)
Bundler::SharedHelpers.major_deprecation(2, "--local_git is deprecated, use --git")
options[:git] = options.delete(:local_git)
end
end

def install_git(names, version, options)
Expand All @@ -54,13 +57,6 @@ def install_git(names, version, options)
install_all_sources(names, version, options, options[:source])
end

def install_local_git(names, version, options)
uri = options.delete(:local_git)
options["uri"] = uri

install_all_sources(names, version, options, options[:source])
end

# Installs the plugin from rubygems source and returns the path where the
# plugin was installed
#
Expand Down
6 changes: 3 additions & 3 deletions bundler/spec/bundler/plugin/installer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
to eq("new-plugin" => spec)
end

it "returns the installed spec after installing local git plugins" do
allow(installer).to receive(:install_local_git).
it "returns the installed spec after installing local git plugins", :bundler => "< 3" do
allow(installer).to receive(:install_git).
and_return("new-plugin" => spec)

expect(installer.install(["new-plugin"], :local_git => "/phony/path/repo")).
Expand Down Expand Up @@ -73,7 +73,7 @@
end
end

context "local git plugins" do
context "local git plugins", :bundler => "< 3" do
before do
build_git "ga-plugin", :path => lib_path("ga-plugin") do |s|
s.write "plugins.rb"
Expand Down
2 changes: 1 addition & 1 deletion bundler/spec/plugins/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def exec(command, args)
plugin_should_be_installed("foo")
end

it "installs form a local git source" do
it "installs form a local git source", :bundler => "< 3" do
build_git "foo" do |s|
s.write "plugins.rb"
end
Expand Down

0 comments on commit e2f97df

Please sign in to comment.