Skip to content

Commit 11741d3

Browse files
hsbtclaude
andcommitted
Introduce Bundler::Plugin::UnloadedSource
An inert placeholder source that stands in for a plugin source whose handling plugin is not loaded, so that a lockfile referencing it can still be parsed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 22dddbd commit 11741d3

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

Manifest.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ bundler/lib/bundler/plugin/installer/git.rb
167167
bundler/lib/bundler/plugin/installer/path.rb
168168
bundler/lib/bundler/plugin/installer/rubygems.rb
169169
bundler/lib/bundler/plugin/source_list.rb
170+
bundler/lib/bundler/plugin/unloaded_source.rb
170171
bundler/lib/bundler/process_lock.rb
171172
bundler/lib/bundler/remote_specification.rb
172173
bundler/lib/bundler/resolver.rb

bundler/lib/bundler/plugin.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
module Bundler
66
module Plugin
7-
autoload :DSL, File.expand_path("plugin/dsl", __dir__)
8-
autoload :Events, File.expand_path("plugin/events", __dir__)
9-
autoload :Index, File.expand_path("plugin/index", __dir__)
10-
autoload :Installer, File.expand_path("plugin/installer", __dir__)
11-
autoload :SourceList, File.expand_path("plugin/source_list", __dir__)
7+
autoload :DSL, File.expand_path("plugin/dsl", __dir__)
8+
autoload :Events, File.expand_path("plugin/events", __dir__)
9+
autoload :Index, File.expand_path("plugin/index", __dir__)
10+
autoload :Installer, File.expand_path("plugin/installer", __dir__)
11+
autoload :SourceList, File.expand_path("plugin/source_list", __dir__)
12+
autoload :UnloadedSource, File.expand_path("plugin/unloaded_source", __dir__)
1213

1314
class MalformattedPlugin < PluginError; end
1415
class UndefinedCommandError < PluginError; end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# frozen_string_literal: true
2+
3+
module Bundler
4+
module Plugin
5+
# Stands in for a source handled by a plugin that is not loaded yet, so
6+
# that the lockfile can still be parsed during the plugin install pass,
7+
# and by external tools reading a lockfile without the plugin installed.
8+
class UnloadedSource
9+
include API::Source
10+
11+
# Unlike real plugin sources, where the handling class encodes the
12+
# source type, all unloaded sources share this class, so the type must
13+
# be compared explicitly.
14+
def ==(other)
15+
super && options["type"] == other.options["type"]
16+
end
17+
18+
alias_method :eql?, :==
19+
20+
def hash
21+
[super, options["type"]].hash
22+
end
23+
end
24+
end
25+
end

0 commit comments

Comments
 (0)