From 127a8c0bd3cac022997efd18ce6747698c379d53 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:20:36 +0200
Subject: [PATCH] [rubygems/rubygems] Make `--local-git` flag to `bundle plugin
install` raise an error
https://github.com/rubygems/rubygems/commit/8bfe317e6d
---
lib/bundler/cli/plugin.rb | 2 +-
lib/bundler/man/bundle-plugin.1 | 9 +--------
lib/bundler/man/bundle-plugin.1.ronn | 8 --------
lib/bundler/plugin/installer.rb | 8 +-------
spec/bundler/other/major_deprecation_spec.rb | 9 +++------
spec/bundler/plugins/install_spec.rb | 7 -------
6 files changed, 6 insertions(+), 37 deletions(-)
diff --git a/lib/bundler/cli/plugin.rb b/lib/bundler/cli/plugin.rb
index fd61ef0d95..840394cbe4 100644
--- a/lib/bundler/cli/plugin.rb
+++ b/lib/bundler/cli/plugin.rb
@@ -10,7 +10,7 @@ module Bundler
method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from"
method_option "version", type: :string, default: nil, banner: "The version of the plugin to fetch"
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 (deprecated)"
+ method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (removed)"
method_option "branch", type: :string, default: nil, banner: "The git branch to checkout"
method_option "ref", type: :string, default: nil, banner: "The git revision to check out"
method_option "path", type: :string, default: nil, banner: "Path of a local gem to directly use"
diff --git a/lib/bundler/man/bundle-plugin.1 b/lib/bundler/man/bundle-plugin.1
index 9da6927dc4..25da562475 100644
--- a/lib/bundler/man/bundle-plugin.1
+++ b/lib/bundler/man/bundle-plugin.1
@@ -4,7 +4,7 @@
.SH "NAME"
\fBbundle\-plugin\fR \- Manage Bundler plugins
.SH "SYNOPSIS"
-\fBbundle plugin\fR install PLUGINS [\-\-source=SOURCE] [\-\-version=VERSION] [\-\-git=GIT] [\-\-branch=BRANCH|\-\-ref=REF] [\-\-local\-git=LOCAL_GIT] [\-\-path=PATH]
+\fBbundle plugin\fR install PLUGINS [\-\-source=SOURCE] [\-\-version=VERSION] [\-\-git=GIT] [\-\-branch=BRANCH|\-\-ref=REF] [\-\-path=PATH]
.br
\fBbundle plugin\fR uninstall PLUGINS [\-\-all]
.br
@@ -54,13 +54,6 @@ When you specify \fB\-\-git\fR, you can use \fB\-\-ref\fR to specify any tag, or
Install the plugin gem from a local path\.
.IP
Example: \fBbundle plugin install bundler\-graph \-\-path \.\./bundler\-graph\fR
-.TP
-\fB\-\-local\-git=LOCAL_GIT\fR
-Install the plugin gem from a local Git repository\.
-.IP
-Example: \fBbundle plugin install bundler\-graph \-\-local\-git \.\./bundler\-graph\fR\.
-.IP
-This option is deprecated in favor of \fB\-\-git\fR\.
.SS "uninstall"
Uninstall the plugin(s) specified in PLUGINS\.
.P
diff --git a/lib/bundler/man/bundle-plugin.1.ronn b/lib/bundler/man/bundle-plugin.1.ronn
index efb4240761..b54e0c08b4 100644
--- a/lib/bundler/man/bundle-plugin.1.ronn
+++ b/lib/bundler/man/bundle-plugin.1.ronn
@@ -5,7 +5,6 @@ bundle-plugin(1) -- Manage Bundler plugins
`bundle plugin` install PLUGINS [--source=SOURCE] [--version=VERSION]
[--git=GIT] [--branch=BRANCH|--ref=REF]
- [--local-git=LOCAL_GIT]
[--path=PATH]
`bundle plugin` uninstall PLUGINS [--all]
`bundle plugin` list
@@ -59,13 +58,6 @@ global source specified in Gemfile is ignored.
Example: `bundle plugin install bundler-graph --path ../bundler-graph`
-* `--local-git=LOCAL_GIT`:
- Install the plugin gem from a local Git repository.
-
- Example: `bundle plugin install bundler-graph --local-git ../bundler-graph`.
-
- This option is deprecated in favor of `--git`.
-
### uninstall
Uninstall the plugin(s) specified in PLUGINS.
diff --git a/lib/bundler/plugin/installer.rb b/lib/bundler/plugin/installer.rb
index ac3c3ea7f3..6ead207652 100644
--- a/lib/bundler/plugin/installer.rb
+++ b/lib/bundler/plugin/installer.rb
@@ -43,14 +43,8 @@ module Bundler
private
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)
+ raise InvalidOption, "--local_git has been removed, use --git"
end
if (options.keys & [:source, :git, :path]).length > 1
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index 1749d7e682..668a36b8db 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -702,14 +702,11 @@ RSpec.describe "major deprecations" do
end
end
- it "prints a deprecation warning" do
- bundle "plugin install foo --local_git #{lib_path("foo-1.0")}"
+ it "fails with a helpful message" do
+ bundle "plugin install foo --local_git #{lib_path("foo-1.0")}", raise_on_error: false
- expect(out).to include("Installed plugin foo")
- expect(deprecations).to include "--local_git is deprecated, use --git"
+ expect(err).to include "--local_git has been removed, use --git"
end
-
- pending "fails with a helpful message", bundler: "4"
end
describe "removing rubocop" do
diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb
index 1ccefabc0b..0cddeb0918 100644
--- a/spec/bundler/plugins/install_spec.rb
+++ b/spec/bundler/plugins/install_spec.rb
@@ -203,13 +203,6 @@ RSpec.describe "bundler plugin install" do
expect(out).to include("Installed plugin foo")
plugin_should_be_installed("foo")
end
-
- it "raises an error when both git and local git sources are specified" do
- bundle "plugin install foo --git /phony/path/project --local_git git@gitphony.com:/repo/project", raise_on_error: false
-
- expect(exitstatus).not_to eq(0)
- expect(err).to eq("Remote and local plugin git sources can't be both specified")
- end
end
context "path plugins" do