bundler 2.6.2 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +53 -0
- data/README.md +2 -2
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/console.rb +8 -6
- data/lib/bundler/cli/doctor.rb +9 -5
- data/lib/bundler/cli/info.rb +4 -4
- data/lib/bundler/cli/issue.rb +1 -1
- data/lib/bundler/cli/outdated.rb +6 -4
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/current_ruby.rb +23 -33
- data/lib/bundler/definition.rb +62 -60
- data/lib/bundler/dependency.rb +92 -47
- data/lib/bundler/dsl.rb +83 -78
- data/lib/bundler/endpoint_specification.rb +10 -3
- data/lib/bundler/errors.rb +4 -0
- data/lib/bundler/feature_flag.rb +2 -6
- data/lib/bundler/gem_helpers.rb +4 -10
- data/lib/bundler/gem_version_promoter.rb +0 -2
- data/lib/bundler/installer.rb +16 -2
- data/lib/bundler/lazy_specification.rb +50 -45
- data/lib/bundler/man/bundle-add.1 +3 -3
- data/lib/bundler/man/bundle-binstubs.1 +3 -3
- data/lib/bundler/man/bundle-cache.1 +3 -3
- data/lib/bundler/man/bundle-check.1 +3 -3
- data/lib/bundler/man/bundle-clean.1 +3 -3
- data/lib/bundler/man/bundle-config.1 +3 -3
- data/lib/bundler/man/bundle-console.1 +3 -3
- data/lib/bundler/man/bundle-doctor.1 +3 -3
- data/lib/bundler/man/bundle-env.1 +3 -3
- data/lib/bundler/man/bundle-exec.1 +3 -3
- data/lib/bundler/man/bundle-fund.1 +3 -3
- data/lib/bundler/man/bundle-gem.1 +3 -3
- data/lib/bundler/man/bundle-help.1 +3 -3
- data/lib/bundler/man/bundle-info.1 +3 -3
- data/lib/bundler/man/bundle-init.1 +3 -3
- data/lib/bundler/man/bundle-inject.1 +3 -3
- data/lib/bundler/man/bundle-install.1 +3 -3
- data/lib/bundler/man/bundle-issue.1 +3 -3
- data/lib/bundler/man/bundle-licenses.1 +3 -3
- data/lib/bundler/man/bundle-list.1 +3 -3
- data/lib/bundler/man/bundle-lock.1 +3 -3
- data/lib/bundler/man/bundle-open.1 +3 -3
- data/lib/bundler/man/bundle-outdated.1 +3 -3
- data/lib/bundler/man/bundle-platform.1 +3 -3
- data/lib/bundler/man/bundle-plugin.1 +3 -3
- data/lib/bundler/man/bundle-pristine.1 +3 -3
- data/lib/bundler/man/bundle-remove.1 +3 -3
- data/lib/bundler/man/bundle-show.1 +3 -3
- data/lib/bundler/man/bundle-update.1 +3 -3
- data/lib/bundler/man/bundle-version.1 +3 -3
- data/lib/bundler/man/bundle-viz.1 +3 -3
- data/lib/bundler/man/bundle.1 +3 -3
- data/lib/bundler/man/gemfile.5 +3 -3
- data/lib/bundler/match_metadata.rb +13 -0
- data/lib/bundler/plugin/index.rb +4 -0
- data/lib/bundler/resolver/base.rb +2 -1
- data/lib/bundler/resolver/package.rb +8 -4
- data/lib/bundler/resolver/spec_group.rb +1 -25
- data/lib/bundler/resolver.rb +13 -3
- data/lib/bundler/ruby_dsl.rb +12 -3
- data/lib/bundler/rubygems_ext.rb +83 -82
- data/lib/bundler/rubygems_integration.rb +2 -15
- data/lib/bundler/runtime.rb +19 -24
- data/lib/bundler/source/git.rb +1 -0
- data/lib/bundler/source/rubygems.rb +19 -4
- data/lib/bundler/source.rb +2 -0
- data/lib/bundler/source_list.rb +4 -0
- data/lib/bundler/spec_set.rb +66 -29
- data/lib/bundler/templates/newgem/Gemfile.tt +1 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler.rb +10 -30
- metadata +3 -3
data/lib/bundler/rubygems_ext.rb
CHANGED
@@ -58,6 +58,87 @@ module Gem
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
require "rubygems/platform"
|
62
|
+
|
63
|
+
class Platform
|
64
|
+
JAVA = Gem::Platform.new("java")
|
65
|
+
MSWIN = Gem::Platform.new("mswin32")
|
66
|
+
MSWIN64 = Gem::Platform.new("mswin64")
|
67
|
+
MINGW = Gem::Platform.new("x86-mingw32")
|
68
|
+
X64_MINGW = [Gem::Platform.new("x64-mingw32"),
|
69
|
+
Gem::Platform.new("x64-mingw-ucrt")].freeze
|
70
|
+
UNIVERSAL_MINGW = Gem::Platform.new("universal-mingw")
|
71
|
+
WINDOWS = [MSWIN, MSWIN64, UNIVERSAL_MINGW].flatten.freeze
|
72
|
+
X64_LINUX = Gem::Platform.new("x86_64-linux")
|
73
|
+
X64_LINUX_MUSL = Gem::Platform.new("x86_64-linux-musl")
|
74
|
+
|
75
|
+
if X64_LINUX === X64_LINUX_MUSL
|
76
|
+
remove_method :===
|
77
|
+
|
78
|
+
def ===(other)
|
79
|
+
return nil unless Gem::Platform === other
|
80
|
+
|
81
|
+
# universal-mingw32 matches x64-mingw-ucrt
|
82
|
+
return true if (@cpu == "universal" || other.cpu == "universal") &&
|
83
|
+
@os.start_with?("mingw") && other.os.start_with?("mingw")
|
84
|
+
|
85
|
+
# cpu
|
86
|
+
([nil,"universal"].include?(@cpu) || [nil, "universal"].include?(other.cpu) || @cpu == other.cpu ||
|
87
|
+
(@cpu == "arm" && other.cpu.start_with?("armv"))) &&
|
88
|
+
|
89
|
+
# os
|
90
|
+
@os == other.os &&
|
91
|
+
|
92
|
+
# version
|
93
|
+
(
|
94
|
+
(@os != "linux" && (@version.nil? || other.version.nil?)) ||
|
95
|
+
(@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
|
96
|
+
@version == other.version
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
# This is a copy of RubyGems 3.3.23 or higher `normalized_linux_method`.
|
101
|
+
# Once only 3.3.23 is supported, we can use the method in RubyGems.
|
102
|
+
def normalized_linux_version_ext
|
103
|
+
return nil unless @version
|
104
|
+
|
105
|
+
without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
|
106
|
+
return nil if without_gnu_nor_abi_modifiers.empty?
|
107
|
+
|
108
|
+
without_gnu_nor_abi_modifiers
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
Platform.singleton_class.module_eval do
|
114
|
+
unless Platform.singleton_methods.include?(:match_spec?)
|
115
|
+
def match_spec?(spec)
|
116
|
+
match_gem?(spec.platform, spec.name)
|
117
|
+
end
|
118
|
+
|
119
|
+
def match_gem?(platform, gem_name)
|
120
|
+
match_platforms?(platform, Gem.platforms)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
match_platforms_defined = Gem::Platform.respond_to?(:match_platforms?, true)
|
125
|
+
|
126
|
+
if !match_platforms_defined || Gem::Platform.send(:match_platforms?, Gem::Platform::X64_LINUX_MUSL, [Gem::Platform::X64_LINUX])
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
remove_method :match_platforms? if match_platforms_defined
|
131
|
+
|
132
|
+
def match_platforms?(platform, platforms)
|
133
|
+
platforms.any? do |local_platform|
|
134
|
+
platform.nil? ||
|
135
|
+
local_platform == platform ||
|
136
|
+
(local_platform != Gem::Platform::RUBY && platform =~ local_platform)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
61
142
|
require "rubygems/specification"
|
62
143
|
|
63
144
|
# Can be removed once RubyGems 3.5.14 support is dropped
|
@@ -177,8 +258,8 @@ module Gem
|
|
177
258
|
dependencies - development_dependencies
|
178
259
|
end
|
179
260
|
|
180
|
-
def
|
181
|
-
!default_gem? && !
|
261
|
+
def installation_missing?
|
262
|
+
!default_gem? && (!Dir.exist?(full_gem_path) || Dir.empty?(full_gem_path))
|
182
263
|
end
|
183
264
|
|
184
265
|
unless VALIDATES_FOR_RESOLUTION
|
@@ -288,86 +369,6 @@ module Gem
|
|
288
369
|
end
|
289
370
|
end
|
290
371
|
|
291
|
-
require "rubygems/platform"
|
292
|
-
|
293
|
-
class Platform
|
294
|
-
JAVA = Gem::Platform.new("java")
|
295
|
-
MSWIN = Gem::Platform.new("mswin32")
|
296
|
-
MSWIN64 = Gem::Platform.new("mswin64")
|
297
|
-
MINGW = Gem::Platform.new("x86-mingw32")
|
298
|
-
X64_MINGW = [Gem::Platform.new("x64-mingw32"),
|
299
|
-
Gem::Platform.new("x64-mingw-ucrt")].freeze
|
300
|
-
WINDOWS = [MSWIN, MSWIN64, MINGW, X64_MINGW].flatten.freeze
|
301
|
-
X64_LINUX = Gem::Platform.new("x86_64-linux")
|
302
|
-
X64_LINUX_MUSL = Gem::Platform.new("x86_64-linux-musl")
|
303
|
-
|
304
|
-
if X64_LINUX === X64_LINUX_MUSL
|
305
|
-
remove_method :===
|
306
|
-
|
307
|
-
def ===(other)
|
308
|
-
return nil unless Gem::Platform === other
|
309
|
-
|
310
|
-
# universal-mingw32 matches x64-mingw-ucrt
|
311
|
-
return true if (@cpu == "universal" || other.cpu == "universal") &&
|
312
|
-
@os.start_with?("mingw") && other.os.start_with?("mingw")
|
313
|
-
|
314
|
-
# cpu
|
315
|
-
([nil,"universal"].include?(@cpu) || [nil, "universal"].include?(other.cpu) || @cpu == other.cpu ||
|
316
|
-
(@cpu == "arm" && other.cpu.start_with?("armv"))) &&
|
317
|
-
|
318
|
-
# os
|
319
|
-
@os == other.os &&
|
320
|
-
|
321
|
-
# version
|
322
|
-
(
|
323
|
-
(@os != "linux" && (@version.nil? || other.version.nil?)) ||
|
324
|
-
(@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
|
325
|
-
@version == other.version
|
326
|
-
)
|
327
|
-
end
|
328
|
-
|
329
|
-
# This is a copy of RubyGems 3.3.23 or higher `normalized_linux_method`.
|
330
|
-
# Once only 3.3.23 is supported, we can use the method in RubyGems.
|
331
|
-
def normalized_linux_version_ext
|
332
|
-
return nil unless @version
|
333
|
-
|
334
|
-
without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
|
335
|
-
return nil if without_gnu_nor_abi_modifiers.empty?
|
336
|
-
|
337
|
-
without_gnu_nor_abi_modifiers
|
338
|
-
end
|
339
|
-
end
|
340
|
-
end
|
341
|
-
|
342
|
-
Platform.singleton_class.module_eval do
|
343
|
-
unless Platform.singleton_methods.include?(:match_spec?)
|
344
|
-
def match_spec?(spec)
|
345
|
-
match_gem?(spec.platform, spec.name)
|
346
|
-
end
|
347
|
-
|
348
|
-
def match_gem?(platform, gem_name)
|
349
|
-
match_platforms?(platform, Gem.platforms)
|
350
|
-
end
|
351
|
-
end
|
352
|
-
|
353
|
-
match_platforms_defined = Gem::Platform.respond_to?(:match_platforms?, true)
|
354
|
-
|
355
|
-
if !match_platforms_defined || Gem::Platform.send(:match_platforms?, Gem::Platform::X64_LINUX_MUSL, [Gem::Platform::X64_LINUX])
|
356
|
-
|
357
|
-
private
|
358
|
-
|
359
|
-
remove_method :match_platforms? if match_platforms_defined
|
360
|
-
|
361
|
-
def match_platforms?(platform, platforms)
|
362
|
-
platforms.any? do |local_platform|
|
363
|
-
platform.nil? ||
|
364
|
-
local_platform == platform ||
|
365
|
-
(local_platform != Gem::Platform::RUBY && platform =~ local_platform)
|
366
|
-
end
|
367
|
-
end
|
368
|
-
end
|
369
|
-
end
|
370
|
-
|
371
372
|
# On universal Rubies, resolve the "universal" arch to the real CPU arch, without changing the extension directory.
|
372
373
|
class BasicSpecification
|
373
374
|
if /^universal\.(?<arch>.*?)-/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
|
@@ -134,18 +134,6 @@ module Bundler
|
|
134
134
|
loaded_gem_paths.flatten
|
135
135
|
end
|
136
136
|
|
137
|
-
def load_plugins
|
138
|
-
Gem.load_plugins
|
139
|
-
end
|
140
|
-
|
141
|
-
def load_plugin_files(plugin_files)
|
142
|
-
Gem.load_plugin_files(plugin_files)
|
143
|
-
end
|
144
|
-
|
145
|
-
def load_env_plugins
|
146
|
-
Gem.load_env_plugins
|
147
|
-
end
|
148
|
-
|
149
137
|
def ui=(obj)
|
150
138
|
Gem::DefaultUserInteraction.ui = obj
|
151
139
|
end
|
@@ -189,7 +177,7 @@ module Bundler
|
|
189
177
|
end
|
190
178
|
end
|
191
179
|
|
192
|
-
def replace_gem(
|
180
|
+
def replace_gem(specs_by_name)
|
193
181
|
executables = nil
|
194
182
|
|
195
183
|
[::Kernel.singleton_class, ::Kernel].each do |kernel_class|
|
@@ -286,7 +274,7 @@ module Bundler
|
|
286
274
|
else
|
287
275
|
Gem::BUNDLED_GEMS.replace_require(specs) if Gem::BUNDLED_GEMS.respond_to?(:replace_require)
|
288
276
|
end
|
289
|
-
replace_gem(
|
277
|
+
replace_gem(specs_by_name)
|
290
278
|
stub_rubygems(specs_by_name.values)
|
291
279
|
replace_bin_path(specs_by_name)
|
292
280
|
|
@@ -305,7 +293,6 @@ module Bundler
|
|
305
293
|
default_spec_name = default_spec.name
|
306
294
|
next if specs_by_name.key?(default_spec_name)
|
307
295
|
|
308
|
-
specs << default_spec
|
309
296
|
specs_by_name[default_spec_name] = default_spec
|
310
297
|
end
|
311
298
|
|
data/lib/bundler/runtime.rb
CHANGED
@@ -50,35 +50,30 @@ module Bundler
|
|
50
50
|
Plugin.hook(Plugin::Events::GEM_BEFORE_REQUIRE_ALL, dependencies)
|
51
51
|
|
52
52
|
dependencies.each do |dep|
|
53
|
-
required_file = nil
|
54
53
|
Plugin.hook(Plugin::Events::GEM_BEFORE_REQUIRE, dep)
|
55
54
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
55
|
+
# Loop through all the specified autorequires for the
|
56
|
+
# dependency. If there are none, use the dependency's name
|
57
|
+
# as the autorequire.
|
58
|
+
Array(dep.autorequire || dep.name).each do |file|
|
59
|
+
# Allow `require: true` as an alias for `require: <name>`
|
60
|
+
file = dep.name if file == true
|
61
|
+
required_file = file
|
62
|
+
begin
|
63
|
+
Kernel.require required_file
|
64
|
+
rescue LoadError => e
|
65
|
+
if dep.autorequire.nil? && e.path == required_file
|
66
|
+
if required_file.include?("-")
|
67
|
+
required_file = required_file.tr("-", "/")
|
68
|
+
retry
|
69
|
+
end
|
70
|
+
else
|
68
71
|
raise Bundler::GemRequireError.new e,
|
69
72
|
"There was an error while trying to load the gem '#{file}'."
|
70
73
|
end
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
if dep.autorequire.nil? && dep.name.include?("-")
|
76
|
-
begin
|
77
|
-
namespaced_file = dep.name.tr("-", "/")
|
78
|
-
Kernel.require namespaced_file
|
79
|
-
rescue LoadError => e
|
80
|
-
raise if e.path != namespaced_file
|
81
|
-
end
|
74
|
+
rescue RuntimeError => e
|
75
|
+
raise Bundler::GemRequireError.new e,
|
76
|
+
"There was an error while trying to load the gem '#{file}'."
|
82
77
|
end
|
83
78
|
end
|
84
79
|
|
data/lib/bundler/source/git.rb
CHANGED
@@ -19,6 +19,7 @@ module Bundler
|
|
19
19
|
@allow_remote = false
|
20
20
|
@allow_cached = false
|
21
21
|
@allow_local = options["allow_local"] || false
|
22
|
+
@prefer_local = false
|
22
23
|
@checksum_store = Checksum::Store.new
|
23
24
|
|
24
25
|
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
|
@@ -30,6 +31,10 @@ module Bundler
|
|
30
31
|
@caches ||= [cache_path, *Bundler.rubygems.gem_cache]
|
31
32
|
end
|
32
33
|
|
34
|
+
def prefer_local!
|
35
|
+
@prefer_local = true
|
36
|
+
end
|
37
|
+
|
33
38
|
def local_only!
|
34
39
|
@specs = nil
|
35
40
|
@allow_local = true
|
@@ -37,6 +42,10 @@ module Bundler
|
|
37
42
|
@allow_remote = false
|
38
43
|
end
|
39
44
|
|
45
|
+
def local_only?
|
46
|
+
@allow_local && !@allow_remote
|
47
|
+
end
|
48
|
+
|
40
49
|
def local!
|
41
50
|
return if @allow_local
|
42
51
|
|
@@ -139,9 +148,15 @@ module Bundler
|
|
139
148
|
index.merge!(cached_specs) if @allow_cached
|
140
149
|
index.merge!(installed_specs) if @allow_local
|
141
150
|
|
142
|
-
|
143
|
-
|
144
|
-
|
151
|
+
if @allow_local
|
152
|
+
if @prefer_local
|
153
|
+
index.merge!(default_specs)
|
154
|
+
else
|
155
|
+
# complete with default specs, only if not already available in the
|
156
|
+
# index through remote, cached, or installed specs
|
157
|
+
index.use(default_specs)
|
158
|
+
end
|
159
|
+
end
|
145
160
|
|
146
161
|
index
|
147
162
|
end
|
@@ -439,7 +454,7 @@ module Bundler
|
|
439
454
|
end
|
440
455
|
|
441
456
|
def installed?(spec)
|
442
|
-
installed_specs[spec].any? && !spec.
|
457
|
+
installed_specs[spec].any? && !spec.installation_missing?
|
443
458
|
end
|
444
459
|
|
445
460
|
def rubygems_dir
|
data/lib/bundler/source.rb
CHANGED
data/lib/bundler/source_list.rb
CHANGED
data/lib/bundler/spec_set.rb
CHANGED
@@ -83,15 +83,13 @@ module Bundler
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def []=(key, value)
|
86
|
-
|
86
|
+
delete_by_name(key)
|
87
87
|
|
88
|
-
|
88
|
+
add_spec(value)
|
89
89
|
end
|
90
90
|
|
91
91
|
def delete(specs)
|
92
|
-
Array(specs).each {|spec|
|
93
|
-
|
94
|
-
reset!
|
92
|
+
Array(specs).each {|spec| remove_spec(spec) }
|
95
93
|
end
|
96
94
|
|
97
95
|
def sort!
|
@@ -117,8 +115,7 @@ module Bundler
|
|
117
115
|
def materialized_for_all_platforms
|
118
116
|
@specs.map do |s|
|
119
117
|
next s unless s.is_a?(LazySpecification)
|
120
|
-
s.
|
121
|
-
spec = s.materialize_strictly
|
118
|
+
spec = s.materialize_for_cache
|
122
119
|
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
123
120
|
spec
|
124
121
|
end
|
@@ -133,8 +130,8 @@ module Bundler
|
|
133
130
|
validation_set.incomplete_specs.any?
|
134
131
|
end
|
135
132
|
|
136
|
-
def missing_specs_for(
|
137
|
-
materialize_dependencies(
|
133
|
+
def missing_specs_for(deps)
|
134
|
+
materialize_dependencies(deps)
|
138
135
|
|
139
136
|
missing_specs
|
140
137
|
end
|
@@ -163,10 +160,20 @@ module Bundler
|
|
163
160
|
@specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
|
164
161
|
end
|
165
162
|
|
163
|
+
def specs_with_additional_variants_from(other)
|
164
|
+
sorted | additional_variants_from(other)
|
165
|
+
end
|
166
|
+
|
166
167
|
def delete_by_name(name)
|
167
168
|
@specs.reject! {|spec| spec.name == name }
|
169
|
+
@sorted&.reject! {|spec| spec.name == name }
|
170
|
+
return if @lookup.nil?
|
168
171
|
|
169
|
-
|
172
|
+
@lookup[name] = nil
|
173
|
+
end
|
174
|
+
|
175
|
+
def version_for(name)
|
176
|
+
self[name].first&.version
|
170
177
|
end
|
171
178
|
|
172
179
|
def what_required(spec)
|
@@ -204,6 +211,10 @@ module Bundler
|
|
204
211
|
s.matches_current_metadata? && valid_dependencies?(s)
|
205
212
|
end
|
206
213
|
|
214
|
+
def to_s
|
215
|
+
map(&:full_name).to_s
|
216
|
+
end
|
217
|
+
|
207
218
|
private
|
208
219
|
|
209
220
|
def materialize_dependencies(dependencies, platforms = [nil], skips: [])
|
@@ -237,11 +248,6 @@ module Bundler
|
|
237
248
|
@materializations.filter_map(&:materialized_spec)
|
238
249
|
end
|
239
250
|
|
240
|
-
def reset!
|
241
|
-
@sorted = nil
|
242
|
-
@lookup = nil
|
243
|
-
end
|
244
|
-
|
245
251
|
def complete_platform(platform)
|
246
252
|
new_specs = []
|
247
253
|
|
@@ -261,9 +267,7 @@ module Bundler
|
|
261
267
|
end
|
262
268
|
|
263
269
|
if valid_platform && new_specs.any?
|
264
|
-
|
265
|
-
|
266
|
-
reset!
|
270
|
+
new_specs.each {|spec| add_spec(spec) }
|
267
271
|
end
|
268
272
|
|
269
273
|
valid_platform
|
@@ -273,20 +277,23 @@ module Bundler
|
|
273
277
|
@specs.flat_map {|spec| spec.source.specs.search([spec.name, spec.version]).map(&:platform) }.uniq
|
274
278
|
end
|
275
279
|
|
280
|
+
def additional_variants_from(other)
|
281
|
+
other.select do |spec|
|
282
|
+
version_for(spec.name) == spec.version && valid_dependencies?(spec)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
276
286
|
def valid_dependencies?(s)
|
277
287
|
validate_deps(s) == :valid
|
278
288
|
end
|
279
289
|
|
280
290
|
def sorted
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
" on each other, creating an infinite loop. Please remove either" \
|
288
|
-
" gem '#{cgems[0]}' or gem '#{cgems[1]}' and try again."
|
289
|
-
end
|
291
|
+
@sorted ||= ([@specs.find {|s| s.name == "rake" }] + tsort).compact.uniq
|
292
|
+
rescue TSort::Cyclic => error
|
293
|
+
cgems = extract_circular_gems(error)
|
294
|
+
raise CyclicDependencyError, "Your bundle requires gems that depend" \
|
295
|
+
" on each other, creating an infinite loop. Please remove either" \
|
296
|
+
" gem '#{cgems[0]}' or gem '#{cgems[1]}' and try again."
|
290
297
|
end
|
291
298
|
|
292
299
|
def extract_circular_gems(error)
|
@@ -297,8 +304,7 @@ module Bundler
|
|
297
304
|
@lookup ||= begin
|
298
305
|
lookup = {}
|
299
306
|
@specs.each do |s|
|
300
|
-
lookup
|
301
|
-
lookup[s.name] << s
|
307
|
+
index_spec(lookup, s.name, s)
|
302
308
|
end
|
303
309
|
lookup
|
304
310
|
end
|
@@ -319,5 +325,36 @@ module Bundler
|
|
319
325
|
specs_for_name.each {|s2| yield s2 }
|
320
326
|
end
|
321
327
|
end
|
328
|
+
|
329
|
+
def add_spec(spec)
|
330
|
+
@specs << spec
|
331
|
+
|
332
|
+
name = spec.name
|
333
|
+
|
334
|
+
@sorted&.insert(@sorted.bsearch_index {|s| s.name >= name } || @sorted.size, spec)
|
335
|
+
return if @lookup.nil?
|
336
|
+
|
337
|
+
index_spec(@lookup, name, spec)
|
338
|
+
end
|
339
|
+
|
340
|
+
def remove_spec(spec)
|
341
|
+
@specs.delete(spec)
|
342
|
+
@sorted&.delete(spec)
|
343
|
+
return if @lookup.nil?
|
344
|
+
|
345
|
+
indexed_specs = @lookup[spec.name]
|
346
|
+
return unless indexed_specs
|
347
|
+
|
348
|
+
if indexed_specs.size > 1
|
349
|
+
@lookup[spec.name].delete(spec)
|
350
|
+
else
|
351
|
+
@lookup[spec.name] = nil
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
def index_spec(hash, key, value)
|
356
|
+
hash[key] ||= []
|
357
|
+
hash[key] << value
|
358
|
+
end
|
322
359
|
end
|
323
360
|
end
|
data/lib/bundler/version.rb
CHANGED
data/lib/bundler.rb
CHANGED
@@ -212,7 +212,6 @@ module Bundler
|
|
212
212
|
# Bundler.require(:test) # requires second_gem
|
213
213
|
#
|
214
214
|
def require(*groups)
|
215
|
-
load_plugins
|
216
215
|
setup(*groups).require(*groups)
|
217
216
|
end
|
218
217
|
|
@@ -548,15 +547,7 @@ module Bundler
|
|
548
547
|
def load_gemspec_uncached(file, validate = false)
|
549
548
|
path = Pathname.new(file)
|
550
549
|
contents = read_file(file)
|
551
|
-
spec =
|
552
|
-
eval_yaml_gemspec(path, contents)
|
553
|
-
else
|
554
|
-
# Eval the gemspec from its parent directory, because some gemspecs
|
555
|
-
# depend on "./" relative paths.
|
556
|
-
SharedHelpers.chdir(path.dirname.to_s) do
|
557
|
-
eval_gemspec(path, contents)
|
558
|
-
end
|
559
|
-
end
|
550
|
+
spec = eval_gemspec(path, contents)
|
560
551
|
return unless spec
|
561
552
|
spec.loaded_from = path.expand_path.to_s
|
562
553
|
Bundler.rubygems.validate(spec) if validate
|
@@ -576,23 +567,6 @@ module Bundler
|
|
576
567
|
@feature_flag ||= FeatureFlag.new(VERSION)
|
577
568
|
end
|
578
569
|
|
579
|
-
def load_plugins(definition = Bundler.definition)
|
580
|
-
return if defined?(@load_plugins_ran)
|
581
|
-
|
582
|
-
Bundler.rubygems.load_plugins
|
583
|
-
|
584
|
-
requested_path_gems = definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
|
585
|
-
path_plugin_files = requested_path_gems.flat_map do |spec|
|
586
|
-
spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
|
587
|
-
rescue TypeError
|
588
|
-
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
|
589
|
-
raise Gem::InvalidSpecificationException, error_message
|
590
|
-
end
|
591
|
-
Bundler.rubygems.load_plugin_files(path_plugin_files)
|
592
|
-
Bundler.rubygems.load_env_plugins
|
593
|
-
@load_plugins_ran = true
|
594
|
-
end
|
595
|
-
|
596
570
|
def reset!
|
597
571
|
reset_paths!
|
598
572
|
Plugin.reset!
|
@@ -675,12 +649,18 @@ module Bundler
|
|
675
649
|
Kernel.require "psych"
|
676
650
|
|
677
651
|
Gem::Specification.from_yaml(contents)
|
678
|
-
rescue ::Psych::SyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
|
679
|
-
eval_gemspec(path, contents)
|
680
652
|
end
|
681
653
|
|
682
654
|
def eval_gemspec(path, contents)
|
683
|
-
|
655
|
+
if contents.start_with?("---") # YAML header
|
656
|
+
eval_yaml_gemspec(path, contents)
|
657
|
+
else
|
658
|
+
# Eval the gemspec from its parent directory, because some gemspecs
|
659
|
+
# depend on "./" relative paths.
|
660
|
+
SharedHelpers.chdir(path.dirname.to_s) do
|
661
|
+
eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
|
662
|
+
end
|
663
|
+
end
|
684
664
|
rescue ScriptError, StandardError => e
|
685
665
|
msg = "There was an error while loading `#{path.basename}`: #{e.message}"
|
686
666
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Arko
|
@@ -21,7 +21,7 @@ authors:
|
|
21
21
|
- Yehuda Katz
|
22
22
|
bindir: exe
|
23
23
|
cert_chain: []
|
24
|
-
date:
|
24
|
+
date: 2025-02-17 00:00:00.000000000 Z
|
25
25
|
dependencies: []
|
26
26
|
description: Bundler manages an application's dependencies through its entire life,
|
27
27
|
across many machines, systematically and repeatably
|
@@ -411,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
411
411
|
- !ruby/object:Gem::Version
|
412
412
|
version: 3.3.3
|
413
413
|
requirements: []
|
414
|
-
rubygems_version: 3.6.
|
414
|
+
rubygems_version: 3.6.4
|
415
415
|
specification_version: 4
|
416
416
|
summary: The best way to manage your application's dependencies
|
417
417
|
test_files: []
|