bundler 2.6.2 → 2.6.6
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 +91 -0
- data/README.md +2 -2
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/checksum.rb +1 -1
- data/lib/bundler/cli/console.rb +8 -6
- data/lib/bundler/cli/doctor.rb +23 -19
- data/lib/bundler/cli/info.rb +4 -4
- data/lib/bundler/cli/inject.rb +2 -2
- data/lib/bundler/cli/issue.rb +1 -1
- data/lib/bundler/cli/lock.rb +2 -1
- data/lib/bundler/cli/outdated.rb +6 -4
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/compact_index_client/updater.rb +2 -1
- data/lib/bundler/current_ruby.rb +23 -33
- data/lib/bundler/definition.rb +125 -112
- 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 +22 -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/injector.rb +9 -9
- 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 +8 -8
- data/lib/bundler/man/bundle-config.1.ronn +9 -4
- 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 +5 -5
- data/lib/bundler/man/bundle-exec.1.ronn +2 -2
- 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 +5 -1
- data/lib/bundler/resolver/base.rb +2 -1
- data/lib/bundler/resolver/candidate.rb +11 -8
- data/lib/bundler/resolver/package.rb +8 -4
- data/lib/bundler/resolver/spec_group.rb +1 -25
- data/lib/bundler/resolver.rb +14 -4
- data/lib/bundler/ruby_dsl.rb +12 -3
- data/lib/bundler/rubygems_ext.rb +82 -81
- data/lib/bundler/rubygems_integration.rb +2 -15
- data/lib/bundler/runtime.rb +19 -24
- data/lib/bundler/shared_helpers.rb +4 -0
- data/lib/bundler/source/git/git_proxy.rb +6 -0
- data/lib/bundler/source/git.rb +6 -1
- data/lib/bundler/source/rubygems/remote.rb +11 -3
- 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/vendor/uri/lib/uri/common.rb +7 -3
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +12 -11
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +6 -6
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- 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,7 +258,7 @@ module Gem
|
|
177
258
|
dependencies - development_dependencies
|
178
259
|
end
|
179
260
|
|
180
|
-
def
|
261
|
+
def installation_missing?
|
181
262
|
!default_gem? && !File.directory?(full_gem_path)
|
182
263
|
end
|
183
264
|
|
@@ -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
|
|
@@ -115,6 +115,10 @@ module Bundler
|
|
115
115
|
raise NoSpaceOnDeviceError.new(path, action)
|
116
116
|
rescue Errno::ENOTSUP
|
117
117
|
raise OperationNotSupportedError.new(path, action)
|
118
|
+
rescue Errno::EPERM
|
119
|
+
raise OperationNotPermittedError.new(path, action)
|
120
|
+
rescue Errno::EROFS
|
121
|
+
raise ReadOnlyFileSystemError.new(path, action)
|
118
122
|
rescue Errno::EEXIST, Errno::ENOENT
|
119
123
|
raise
|
120
124
|
rescue SystemCallError => e
|
@@ -147,6 +147,12 @@ module Bundler
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
+
def installed_to?(destination)
|
151
|
+
# if copy_to is interrupted, it may leave a partially installed directory that
|
152
|
+
# contains .git but no other files -- consider this not to be installed
|
153
|
+
Dir.exist?(destination) && (Dir.children(destination) - [".git"]).any?
|
154
|
+
end
|
155
|
+
|
150
156
|
private
|
151
157
|
|
152
158
|
def git_remote_fetch(args)
|
data/lib/bundler/source/git.rb
CHANGED
@@ -282,6 +282,7 @@ module Bundler
|
|
282
282
|
FileUtils.rm_rf(app_cache_path)
|
283
283
|
git_proxy.checkout if migrate || requires_checkout?
|
284
284
|
git_proxy.copy_to(app_cache_path, @submodules)
|
285
|
+
serialize_gemspecs_in(app_cache_path)
|
285
286
|
end
|
286
287
|
|
287
288
|
def checkout
|
@@ -359,7 +360,11 @@ module Bundler
|
|
359
360
|
end
|
360
361
|
|
361
362
|
def locked_revision_checked_out?
|
362
|
-
locked_revision && locked_revision == revision &&
|
363
|
+
locked_revision && locked_revision == revision && installed?
|
364
|
+
end
|
365
|
+
|
366
|
+
def installed?
|
367
|
+
git_proxy.installed_to?(install_path)
|
363
368
|
end
|
364
369
|
|
365
370
|
def base_name
|
@@ -16,6 +16,9 @@ module Bundler
|
|
16
16
|
@anonymized_uri = remove_auth(@uri).freeze
|
17
17
|
end
|
18
18
|
|
19
|
+
MAX_CACHE_SLUG_HOST_SIZE = 255 - 1 - 32 # 255 minus dot minus MD5 length
|
20
|
+
private_constant :MAX_CACHE_SLUG_HOST_SIZE
|
21
|
+
|
19
22
|
# @return [String] A slug suitable for use as a cache key for this
|
20
23
|
# remote.
|
21
24
|
#
|
@@ -28,10 +31,15 @@ module Bundler
|
|
28
31
|
host = cache_uri.to_s.start_with?("file://") ? nil : cache_uri.host
|
29
32
|
|
30
33
|
uri_parts = [host, cache_uri.user, cache_uri.port, cache_uri.path]
|
31
|
-
|
34
|
+
uri_parts.compact!
|
35
|
+
uri_digest = SharedHelpers.digest(:MD5).hexdigest(uri_parts.join("."))
|
36
|
+
|
37
|
+
uri_parts.pop
|
38
|
+
host_parts = uri_parts.join(".")
|
39
|
+
return uri_digest if host_parts.empty?
|
32
40
|
|
33
|
-
|
34
|
-
|
41
|
+
shortened_host_parts = host_parts[0...MAX_CACHE_SLUG_HOST_SIZE]
|
42
|
+
[shortened_host_parts, uri_digest].join(".")
|
35
43
|
end
|
36
44
|
end
|
37
45
|
|
@@ -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
|
@@ -13,15 +13,19 @@ require_relative "rfc2396_parser"
|
|
13
13
|
require_relative "rfc3986_parser"
|
14
14
|
|
15
15
|
module Bundler::URI
|
16
|
+
# The default parser instance for RFC 2396.
|
16
17
|
RFC2396_PARSER = RFC2396_Parser.new
|
17
18
|
Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
|
18
19
|
|
20
|
+
# The default parser instance for RFC 3986.
|
19
21
|
RFC3986_PARSER = RFC3986_Parser.new
|
20
22
|
Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
|
21
23
|
|
24
|
+
# The default parser instance.
|
22
25
|
DEFAULT_PARSER = RFC3986_PARSER
|
23
26
|
Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
|
24
27
|
|
28
|
+
# Set the default parser instance.
|
25
29
|
def self.parser=(parser = RFC3986_PARSER)
|
26
30
|
remove_const(:Parser) if defined?(::Bundler::URI::Parser)
|
27
31
|
const_set("Parser", parser.class)
|
@@ -40,7 +44,7 @@ module Bundler::URI
|
|
40
44
|
end
|
41
45
|
self.parser = RFC3986_PARSER
|
42
46
|
|
43
|
-
def self.const_missing(const)
|
47
|
+
def self.const_missing(const) # :nodoc:
|
44
48
|
if const == :REGEXP
|
45
49
|
warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
|
46
50
|
Bundler::URI::RFC2396_REGEXP
|
@@ -87,7 +91,7 @@ module Bundler::URI
|
|
87
91
|
module_function :make_components_hash
|
88
92
|
end
|
89
93
|
|
90
|
-
module Schemes
|
94
|
+
module Schemes # :nodoc:
|
91
95
|
end
|
92
96
|
private_constant :Schemes
|
93
97
|
|
@@ -305,7 +309,7 @@ module Bundler::URI
|
|
305
309
|
256.times do |i|
|
306
310
|
TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
|
307
311
|
end
|
308
|
-
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze
|
312
|
+
TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze # :nodoc:
|
309
313
|
TBLENCWWWCOMP_[' '] = '+'
|
310
314
|
TBLENCWWWCOMP_.freeze
|
311
315
|
TBLDECWWWCOMP_ = {} # :nodoc:
|