Skip to content

Commit e1064de

Browse files
hsbtclaude
andcommitted
Use Index#up_to_date? to skip already-registered plugins
save_plugin grew an equivalent manual path comparison on this branch while master extracted Index#up_to_date? for the same purpose, so use the helper instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c6025f1 commit e1064de

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

bundler/lib/bundler/plugin.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,9 @@ def validate_plugin!(plugin_path)
306306
#
307307
# @raise [PluginInstallError] if validation or registration raises any error
308308
def save_plugin(name, spec, optional_plugin = false)
309-
path = Pathname.new(spec.full_gem_path)
310-
return if index.installed?(name) && index.plugin_path(name) == path
309+
return if index.up_to_date?(spec)
311310

312-
validate_plugin!(path)
311+
validate_plugin! Pathname.new(spec.full_gem_path)
313312
installed = register_plugin(name, spec, optional_plugin)
314313
Bundler.ui.info "Installed plugin #{name}" if installed
315314
rescue PluginError => e

spec/bundler/plugin_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
end
140140

141141
before do
142-
allow(index).to receive(:installed?) { nil }
142+
allow(index).to receive(:up_to_date?) { nil }
143143
allow(definition).to receive(:dependencies) { [Bundler::Dependency.new("new-plugin", ">=0", "plugin" => true), Bundler::Dependency.new("another-plugin", ">=0", "plugin" => true)] }
144144
allow(installer).to receive(:install_definition) { plugin_specs }
145145
end

0 commit comments

Comments
 (0)