bundler 2.6.5 → 2.7.1
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 +1172 -1024
- data/README.md +7 -7
- data/bundler.gemspec +2 -2
- data/lib/bundler/build_metadata.rb +10 -11
- data/lib/bundler/checksum.rb +22 -12
- data/lib/bundler/cli/common.rb +1 -1
- data/lib/bundler/cli/config.rb +2 -2
- data/lib/bundler/cli/doctor/diagnose.rb +167 -0
- data/lib/bundler/cli/doctor/ssl.rb +249 -0
- data/lib/bundler/cli/doctor.rb +27 -155
- data/lib/bundler/cli/gem.rb +62 -30
- data/lib/bundler/cli/inject.rb +2 -2
- data/lib/bundler/cli/install.rb +5 -5
- data/lib/bundler/cli/issue.rb +2 -2
- data/lib/bundler/cli/lock.rb +2 -1
- data/lib/bundler/cli/outdated.rb +1 -1
- data/lib/bundler/cli/update.rb +3 -3
- data/lib/bundler/cli.rb +26 -49
- data/lib/bundler/compact_index_client/cache.rb +1 -1
- data/lib/bundler/compact_index_client/parser.rb +1 -1
- data/lib/bundler/compact_index_client/updater.rb +2 -1
- data/lib/bundler/compact_index_client.rb +1 -5
- data/lib/bundler/current_ruby.rb +27 -3
- data/lib/bundler/definition.rb +184 -151
- data/lib/bundler/dependency.rb +1 -1
- data/lib/bundler/dsl.rb +35 -26
- data/lib/bundler/errors.rb +18 -0
- data/lib/bundler/feature_flag.rb +15 -12
- data/lib/bundler/fetcher/dependency.rb +2 -1
- data/lib/bundler/fetcher/downloader.rb +33 -7
- data/lib/bundler/fetcher.rb +49 -19
- data/lib/bundler/friendly_errors.rb +3 -2
- data/lib/bundler/index.rb +7 -2
- data/lib/bundler/injector.rb +9 -9
- data/lib/bundler/installer.rb +6 -5
- data/lib/bundler/lazy_specification.rb +38 -19
- data/lib/bundler/lockfile_parser.rb +29 -10
- data/lib/bundler/man/bundle-add.1 +1 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +175 -129
- data/lib/bundler/man/bundle-config.1.ronn +93 -88
- data/lib/bundler/man/bundle-console.1 +1 -1
- data/lib/bundler/man/bundle-doctor.1 +43 -4
- data/lib/bundler/man/bundle-doctor.1.ronn +48 -4
- data/lib/bundler/man/bundle-env.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +3 -3
- data/lib/bundler/man/bundle-exec.1.ronn +2 -2
- data/lib/bundler/man/bundle-fund.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +67 -44
- data/lib/bundler/man/bundle-gem.1.ronn +8 -4
- data/lib/bundler/man/bundle-help.1 +1 -1
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-inject.1 +2 -2
- data/lib/bundler/man/bundle-inject.1.ronn +1 -1
- data/lib/bundler/man/bundle-install.1 +4 -4
- data/lib/bundler/man/bundle-install.1.ronn +3 -4
- data/lib/bundler/man/bundle-issue.1 +1 -1
- data/lib/bundler/man/bundle-licenses.1 +1 -1
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-plugin.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +5 -5
- data/lib/bundler/man/bundle-update.1.ronn +4 -4
- data/lib/bundler/man/bundle-version.1 +1 -1
- data/lib/bundler/man/bundle-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/match_platform.rb +31 -12
- data/lib/bundler/materialization.rb +2 -2
- data/lib/bundler/plugin/api/source.rb +1 -1
- data/lib/bundler/plugin/index.rb +1 -1
- data/lib/bundler/plugin/installer/path.rb +8 -0
- data/lib/bundler/plugin.rb +1 -1
- data/lib/bundler/resolver/candidate.rb +12 -9
- data/lib/bundler/resolver/package.rb +1 -1
- data/lib/bundler/resolver/strategy.rb +40 -0
- data/lib/bundler/resolver.rb +18 -27
- data/lib/bundler/rubygems_ext.rb +131 -120
- data/lib/bundler/rubygems_integration.rb +11 -6
- data/lib/bundler/runtime.rb +9 -6
- data/lib/bundler/self_manager.rb +32 -42
- data/lib/bundler/settings/validator.rb +0 -23
- data/lib/bundler/settings.rb +4 -6
- data/lib/bundler/shared_helpers.rb +10 -4
- data/lib/bundler/source/gemspec.rb +1 -4
- data/lib/bundler/source/git/git_proxy.rb +17 -6
- data/lib/bundler/source/git.rb +5 -1
- data/lib/bundler/source/path.rb +9 -2
- data/lib/bundler/source/rubygems/remote.rb +11 -3
- data/lib/bundler/source_list.rb +30 -16
- data/lib/bundler/source_map.rb +1 -1
- data/lib/bundler/spec_set.rb +55 -16
- data/lib/bundler/templates/Executable +0 -11
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -5
- data/lib/bundler/ui/shell.rb +2 -2
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +53 -3
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +11 -0
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +81 -42
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +4 -24
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +20 -8
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +17 -29
- 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 +10 -2
- data/lib/bundler/worker.rb +1 -1
- data/lib/bundler.rb +14 -12
- metadata +9 -16
- data/lib/bundler/compact_index_client/gem_parser.rb +0 -32
- data/lib/bundler/gem_helpers.rb +0 -144
- data/lib/bundler/templates/Executable.bundler +0 -109
- data/lib/bundler/vendor/connection_pool/.document +0 -1
- data/lib/bundler/vendor/fileutils/.document +0 -1
- data/lib/bundler/vendor/net-http-persistent/.document +0 -1
- data/lib/bundler/vendor/pub_grub/.document +0 -1
- data/lib/bundler/vendor/securerandom/.document +0 -1
- data/lib/bundler/vendor/thor/.document +0 -1
- data/lib/bundler/vendor/tsort/.document +0 -1
- data/lib/bundler/vendor/uri/.document +0 -1
data/lib/bundler/rubygems_ext.rb
CHANGED
@@ -13,15 +13,6 @@ require "rubygems" unless defined?(Gem)
|
|
13
13
|
# `Gem::Source` from the redefined `Gem::Specification#source`.
|
14
14
|
require "rubygems/source"
|
15
15
|
|
16
|
-
# Cherry-pick fixes to `Gem.ruby_version` to be useful for modern Bundler
|
17
|
-
# versions and ignore patchlevels
|
18
|
-
# (https://github.com/rubygems/rubygems/pull/5472,
|
19
|
-
# https://github.com/rubygems/rubygems/pull/5486). May be removed once RubyGems
|
20
|
-
# 3.3.12 support is dropped.
|
21
|
-
unless Gem.ruby_version.to_s == RUBY_VERSION || RUBY_PATCHLEVEL == -1
|
22
|
-
Gem.instance_variable_set(:@ruby_version, Gem::Version.new(RUBY_VERSION))
|
23
|
-
end
|
24
|
-
|
25
16
|
module Gem
|
26
17
|
# Can be removed once RubyGems 3.5.11 support is dropped
|
27
18
|
unless Gem.respond_to?(:freebsd_platform?)
|
@@ -61,81 +52,122 @@ module Gem
|
|
61
52
|
require "rubygems/platform"
|
62
53
|
|
63
54
|
class Platform
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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
|
55
|
+
# Can be removed once RubyGems 3.6.9 support is dropped
|
56
|
+
unless respond_to?(:generic)
|
57
|
+
JAVA = Gem::Platform.new("java") # :nodoc:
|
58
|
+
MSWIN = Gem::Platform.new("mswin32") # :nodoc:
|
59
|
+
MSWIN64 = Gem::Platform.new("mswin64") # :nodoc:
|
60
|
+
MINGW = Gem::Platform.new("x86-mingw32") # :nodoc:
|
61
|
+
X64_MINGW_LEGACY = Gem::Platform.new("x64-mingw32") # :nodoc:
|
62
|
+
X64_MINGW = Gem::Platform.new("x64-mingw-ucrt") # :nodoc:
|
63
|
+
UNIVERSAL_MINGW = Gem::Platform.new("universal-mingw") # :nodoc:
|
64
|
+
WINDOWS = [MSWIN, MSWIN64, UNIVERSAL_MINGW].freeze # :nodoc:
|
65
|
+
X64_LINUX = Gem::Platform.new("x86_64-linux") # :nodoc:
|
66
|
+
X64_LINUX_MUSL = Gem::Platform.new("x86_64-linux-musl") # :nodoc:
|
67
|
+
|
68
|
+
GENERICS = [JAVA, *WINDOWS].freeze # :nodoc:
|
69
|
+
private_constant :GENERICS
|
70
|
+
|
71
|
+
GENERIC_CACHE = GENERICS.each_with_object({}) {|g, h| h[g] = g } # :nodoc:
|
72
|
+
private_constant :GENERIC_CACHE
|
99
73
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
return nil unless @version
|
74
|
+
class << self
|
75
|
+
##
|
76
|
+
# Returns the generic platform for the given platform.
|
104
77
|
|
105
|
-
|
106
|
-
|
78
|
+
def generic(platform)
|
79
|
+
return Gem::Platform::RUBY if platform.nil? || platform == Gem::Platform::RUBY
|
107
80
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
81
|
+
GENERIC_CACHE[platform] ||= begin
|
82
|
+
found = GENERICS.find do |match|
|
83
|
+
platform === match
|
84
|
+
end
|
85
|
+
found || Gem::Platform::RUBY
|
86
|
+
end
|
87
|
+
end
|
112
88
|
|
113
|
-
|
114
|
-
|
115
|
-
def match_spec?(spec)
|
116
|
-
match_gem?(spec.platform, spec.name)
|
117
|
-
end
|
89
|
+
##
|
90
|
+
# Returns the platform specificity match for the given spec platform and user platform.
|
118
91
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
92
|
+
def platform_specificity_match(spec_platform, user_platform)
|
93
|
+
return -1 if spec_platform == user_platform
|
94
|
+
return 1_000_000 if spec_platform.nil? || spec_platform == Gem::Platform::RUBY || user_platform == Gem::Platform::RUBY
|
95
|
+
|
96
|
+
os_match(spec_platform, user_platform) +
|
97
|
+
cpu_match(spec_platform, user_platform) * 10 +
|
98
|
+
version_match(spec_platform, user_platform) * 100
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Sorts and filters the best platform match for the given matching specs and platform.
|
103
|
+
|
104
|
+
def sort_and_filter_best_platform_match(matching, platform)
|
105
|
+
return matching if matching.one?
|
106
|
+
|
107
|
+
exact = matching.select {|spec| spec.platform == platform }
|
108
|
+
return exact if exact.any?
|
123
109
|
|
124
|
-
|
110
|
+
sorted_matching = sort_best_platform_match(matching, platform)
|
111
|
+
exemplary_spec = sorted_matching.first
|
125
112
|
|
126
|
-
|
113
|
+
sorted_matching.take_while {|spec| same_specificity?(platform, spec, exemplary_spec) && same_deps?(spec, exemplary_spec) }
|
114
|
+
end
|
127
115
|
|
128
|
-
|
116
|
+
##
|
117
|
+
# Sorts the best platform match for the given matching specs and platform.
|
129
118
|
|
130
|
-
|
119
|
+
def sort_best_platform_match(matching, platform)
|
120
|
+
matching.sort_by.with_index do |spec, i|
|
121
|
+
[
|
122
|
+
platform_specificity_match(spec.platform, platform),
|
123
|
+
i, # for stable sort
|
124
|
+
]
|
125
|
+
end
|
126
|
+
end
|
131
127
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
128
|
+
private
|
129
|
+
|
130
|
+
def same_specificity?(platform, spec, exemplary_spec)
|
131
|
+
platform_specificity_match(spec.platform, platform) == platform_specificity_match(exemplary_spec.platform, platform)
|
132
|
+
end
|
133
|
+
|
134
|
+
def same_deps?(spec, exemplary_spec)
|
135
|
+
spec.required_ruby_version == exemplary_spec.required_ruby_version &&
|
136
|
+
spec.required_rubygems_version == exemplary_spec.required_rubygems_version &&
|
137
|
+
spec.dependencies.sort == exemplary_spec.dependencies.sort
|
138
|
+
end
|
139
|
+
|
140
|
+
def os_match(spec_platform, user_platform)
|
141
|
+
if spec_platform.os == user_platform.os
|
142
|
+
0
|
143
|
+
else
|
144
|
+
1
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def cpu_match(spec_platform, user_platform)
|
149
|
+
if spec_platform.cpu == user_platform.cpu
|
150
|
+
0
|
151
|
+
elsif spec_platform.cpu == "arm" && user_platform.cpu.to_s.start_with?("arm")
|
152
|
+
0
|
153
|
+
elsif spec_platform.cpu.nil? || spec_platform.cpu == "universal"
|
154
|
+
1
|
155
|
+
else
|
156
|
+
2
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def version_match(spec_platform, user_platform)
|
161
|
+
if spec_platform.version == user_platform.version
|
162
|
+
0
|
163
|
+
elsif spec_platform.version.nil?
|
164
|
+
1
|
165
|
+
else
|
166
|
+
2
|
167
|
+
end
|
137
168
|
end
|
138
169
|
end
|
170
|
+
|
139
171
|
end
|
140
172
|
end
|
141
173
|
|
@@ -144,9 +176,6 @@ module Gem
|
|
144
176
|
# Can be removed once RubyGems 3.5.14 support is dropped
|
145
177
|
VALIDATES_FOR_RESOLUTION = Specification.new.respond_to?(:validate_for_resolution).freeze
|
146
178
|
|
147
|
-
# Can be removed once RubyGems 3.3.15 support is dropped
|
148
|
-
FLATTENS_REQUIRED_PATHS = Specification.new.respond_to?(:flatten_require_paths).freeze
|
149
|
-
|
150
179
|
class Specification
|
151
180
|
# Can be removed once RubyGems 3.5.15 support is dropped
|
152
181
|
correct_array_attributes = @@default_value.select {|_k,v| v.is_a?(Array) }.keys
|
@@ -158,7 +187,6 @@ module Gem
|
|
158
187
|
require_relative "match_platform"
|
159
188
|
|
160
189
|
include ::Bundler::MatchMetadata
|
161
|
-
include ::Bundler::MatchPlatform
|
162
190
|
|
163
191
|
attr_accessor :remote, :relative_loaded_from
|
164
192
|
|
@@ -214,23 +242,6 @@ module Gem
|
|
214
242
|
full_gem_path
|
215
243
|
end
|
216
244
|
|
217
|
-
unless const_defined?(:LATEST_RUBY_WITHOUT_PATCH_VERSIONS)
|
218
|
-
LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1")
|
219
|
-
|
220
|
-
alias_method :rg_required_ruby_version=, :required_ruby_version=
|
221
|
-
def required_ruby_version=(req)
|
222
|
-
self.rg_required_ruby_version = req
|
223
|
-
|
224
|
-
@required_ruby_version.requirements.map! do |op, v|
|
225
|
-
if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4
|
226
|
-
[op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))]
|
227
|
-
else
|
228
|
-
[op, v]
|
229
|
-
end
|
230
|
-
end
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
245
|
def insecurely_materialized?
|
235
246
|
false
|
236
247
|
end
|
@@ -262,31 +273,26 @@ module Gem
|
|
262
273
|
!default_gem? && !File.directory?(full_gem_path)
|
263
274
|
end
|
264
275
|
|
276
|
+
def lock_name
|
277
|
+
@lock_name ||= name_tuple.lock_name
|
278
|
+
end
|
279
|
+
|
265
280
|
unless VALIDATES_FOR_RESOLUTION
|
266
281
|
def validate_for_resolution
|
267
282
|
SpecificationPolicy.new(self).validate_for_resolution
|
268
283
|
end
|
269
284
|
end
|
270
285
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
warn "#{name} #{version} includes a gemspec with `require_paths` set to an array of arrays. Newer versions of this gem might've already fixed this"
|
276
|
-
raw_require_paths.flatten!
|
277
|
-
end
|
286
|
+
if Gem.rubygems_version < Gem::Version.new("3.5.22")
|
287
|
+
module FixPathSourceMissingExtensions
|
288
|
+
def missing_extensions?
|
289
|
+
return false if %w[Bundler::Source::Path Bundler::Source::Gemspec].include?(source.class.name)
|
278
290
|
|
279
|
-
|
280
|
-
module RequirePathFlattener
|
281
|
-
def from_yaml(input)
|
282
|
-
spec = super(input)
|
283
|
-
spec.flatten_require_paths
|
284
|
-
spec
|
285
|
-
end
|
291
|
+
super
|
286
292
|
end
|
287
|
-
|
288
|
-
prepend RequirePathFlattener
|
289
293
|
end
|
294
|
+
|
295
|
+
prepend FixPathSourceMissingExtensions
|
290
296
|
end
|
291
297
|
|
292
298
|
private
|
@@ -397,6 +403,11 @@ module Gem
|
|
397
403
|
@ignored = missing_extensions?
|
398
404
|
end
|
399
405
|
end
|
406
|
+
|
407
|
+
# Can be removed once RubyGems 3.6.9 support is dropped
|
408
|
+
unless new.respond_to?(:installable_on_platform?)
|
409
|
+
include(::Bundler::MatchPlatform)
|
410
|
+
end
|
400
411
|
end
|
401
412
|
|
402
413
|
require "rubygems/name_tuple"
|
@@ -443,6 +454,17 @@ module Gem
|
|
443
454
|
end
|
444
455
|
end
|
445
456
|
|
457
|
+
unless Gem.rubygems_version >= Gem::Version.new("3.6.7")
|
458
|
+
module UnfreezeCompactIndexParsedResponse
|
459
|
+
def parse(line)
|
460
|
+
version, platform, dependencies, requirements = super
|
461
|
+
[version, platform, dependencies.frozen? ? dependencies.dup : dependencies, requirements.frozen? ? requirements.dup : requirements]
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
Resolver::APISet::GemParser.prepend(UnfreezeCompactIndexParsedResponse)
|
466
|
+
end
|
467
|
+
|
446
468
|
if Gem.rubygems_version < Gem::Version.new("3.6.0")
|
447
469
|
class Package; end
|
448
470
|
require "rubygems/package/tar_reader"
|
@@ -456,15 +478,4 @@ module Gem
|
|
456
478
|
|
457
479
|
Package::TarReader::Entry.prepend(FixFullNameEncoding)
|
458
480
|
end
|
459
|
-
|
460
|
-
require "rubygems/uri"
|
461
|
-
|
462
|
-
# Can be removed once RubyGems 3.3.15 support is dropped
|
463
|
-
unless Gem::Uri.respond_to?(:redact)
|
464
|
-
class Uri
|
465
|
-
def self.redact(uri)
|
466
|
-
new(uri).redacted
|
467
|
-
end
|
468
|
-
end
|
469
|
-
end
|
470
481
|
end
|
@@ -214,16 +214,11 @@ module Bundler
|
|
214
214
|
e.requirement = dep.requirement
|
215
215
|
raise e
|
216
216
|
end
|
217
|
-
|
218
|
-
# backwards compatibility shim, see https://github.com/rubygems/bundler/issues/5102
|
219
|
-
kernel_class.send(:public, :gem) if Bundler.feature_flag.setup_makes_kernel_gem_public?
|
220
217
|
end
|
221
218
|
end
|
222
219
|
|
223
220
|
# Used to give better error messages when activating specs outside of the current bundle
|
224
221
|
def replace_bin_path(specs_by_name)
|
225
|
-
gem_class = (class << Gem; self; end)
|
226
|
-
|
227
222
|
redefine_method(gem_class, :find_spec_for_exe) do |gem_name, *args|
|
228
223
|
exec_name = args.first
|
229
224
|
raise ArgumentError, "you must supply exec_name" unless exec_name
|
@@ -345,9 +340,13 @@ module Bundler
|
|
345
340
|
Gem::Specification.all = specs
|
346
341
|
end
|
347
342
|
|
348
|
-
redefine_method(
|
343
|
+
redefine_method(gem_class, :finish_resolve) do |*|
|
349
344
|
[]
|
350
345
|
end
|
346
|
+
|
347
|
+
redefine_method(gem_class, :load_plugins) do |*|
|
348
|
+
load_plugin_files specs.flat_map(&:plugins)
|
349
|
+
end
|
351
350
|
end
|
352
351
|
|
353
352
|
def plain_specs
|
@@ -447,6 +446,12 @@ module Bundler
|
|
447
446
|
def default_stubs
|
448
447
|
Gem::Specification.default_stubs("*.gemspec")
|
449
448
|
end
|
449
|
+
|
450
|
+
private
|
451
|
+
|
452
|
+
def gem_class
|
453
|
+
class << Gem; self; end
|
454
|
+
end
|
450
455
|
end
|
451
456
|
|
452
457
|
def self.rubygems
|
data/lib/bundler/runtime.rb
CHANGED
@@ -71,7 +71,7 @@ module Bundler
|
|
71
71
|
raise Bundler::GemRequireError.new e,
|
72
72
|
"There was an error while trying to load the gem '#{file}'."
|
73
73
|
end
|
74
|
-
rescue
|
74
|
+
rescue StandardError => e
|
75
75
|
raise Bundler::GemRequireError.new e,
|
76
76
|
"There was an error while trying to load the gem '#{file}'."
|
77
77
|
end
|
@@ -130,11 +130,14 @@ module Bundler
|
|
130
130
|
|
131
131
|
specs_to_cache.each do |spec|
|
132
132
|
next if spec.name == "bundler"
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
|
134
|
+
source = spec.source
|
135
|
+
next if source.is_a?(Source::Gemspec)
|
136
|
+
|
137
|
+
if source.respond_to?(:migrate_cache)
|
138
|
+
source.migrate_cache(custom_path, local: local)
|
139
|
+
elsif source.respond_to?(:cache)
|
140
|
+
source.cache(spec, custom_path)
|
138
141
|
end
|
139
142
|
end
|
140
143
|
|
data/lib/bundler/self_manager.rb
CHANGED
@@ -7,13 +7,15 @@ module Bundler
|
|
7
7
|
#
|
8
8
|
class SelfManager
|
9
9
|
def restart_with_locked_bundler_if_needed
|
10
|
-
|
10
|
+
restart_version = find_restart_version
|
11
|
+
return unless restart_version && installed?(restart_version)
|
11
12
|
|
12
13
|
restart_with(restart_version)
|
13
14
|
end
|
14
15
|
|
15
16
|
def install_locked_bundler_and_restart_with_it_if_needed
|
16
|
-
|
17
|
+
restart_version = find_restart_version
|
18
|
+
return unless restart_version
|
17
19
|
|
18
20
|
if restart_version == lockfile_version
|
19
21
|
Bundler.ui.info \
|
@@ -29,8 +31,6 @@ module Bundler
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def update_bundler_and_restart_with_it_if_needed(target)
|
32
|
-
return unless autoswitching_applies?
|
33
|
-
|
34
34
|
spec = resolve_update_version_from(target)
|
35
35
|
return unless spec
|
36
36
|
|
@@ -38,7 +38,7 @@ module Bundler
|
|
38
38
|
|
39
39
|
Bundler.ui.info "Updating bundler to #{version}."
|
40
40
|
|
41
|
-
install(spec)
|
41
|
+
install(spec) unless installed?(version)
|
42
42
|
|
43
43
|
restart_with(version)
|
44
44
|
end
|
@@ -68,47 +68,37 @@ module Bundler
|
|
68
68
|
|
69
69
|
def restart_with(version)
|
70
70
|
configured_gem_home = ENV["GEM_HOME"]
|
71
|
+
configured_orig_gem_home = ENV["BUNDLER_ORIG_GEM_HOME"]
|
71
72
|
configured_gem_path = ENV["GEM_PATH"]
|
73
|
+
configured_orig_gem_path = ENV["BUNDLER_ORIG_GEM_PATH"]
|
72
74
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
# future, we may be able to properly reconstruct the original Ruby
|
77
|
-
# invocation (see https://bugs.ruby-lang.org/issues/6648), but for now
|
78
|
-
# there's no way to do it, so we need to be explicit about how to re-exec.
|
79
|
-
# This may be a feature end users request at some point, but maybe by that
|
80
|
-
# time, we have builtin tools to do. So for now, we use an undocumented
|
81
|
-
# ENV variable only for our specs.
|
82
|
-
bundler_spec_original_cmd = ENV["BUNDLER_SPEC_ORIGINAL_CMD"]
|
83
|
-
if bundler_spec_original_cmd
|
84
|
-
require "shellwords"
|
85
|
-
cmd = [*Shellwords.shellsplit(bundler_spec_original_cmd), *ARGV]
|
86
|
-
else
|
87
|
-
argv0 = File.exist?($PROGRAM_NAME) ? $PROGRAM_NAME : Process.argv0
|
88
|
-
cmd = [argv0, *ARGV]
|
89
|
-
cmd.unshift(Gem.ruby) unless File.executable?(argv0)
|
90
|
-
end
|
75
|
+
argv0 = File.exist?($PROGRAM_NAME) ? $PROGRAM_NAME : Process.argv0
|
76
|
+
cmd = [argv0, *ARGV]
|
77
|
+
cmd.unshift(Gem.ruby) unless File.executable?(argv0)
|
91
78
|
|
92
79
|
Bundler.with_original_env do
|
93
80
|
Kernel.exec(
|
94
|
-
{
|
81
|
+
{
|
82
|
+
"GEM_HOME" => configured_gem_home,
|
83
|
+
"BUNDLER_ORIG_GEM_HOME" => configured_orig_gem_home,
|
84
|
+
"GEM_PATH" => configured_gem_path,
|
85
|
+
"BUNDLER_ORIG_GEM_PATH" => configured_orig_gem_path,
|
86
|
+
"BUNDLER_VERSION" => version.to_s,
|
87
|
+
},
|
95
88
|
*cmd
|
96
89
|
)
|
97
90
|
end
|
98
91
|
end
|
99
92
|
|
100
|
-
def needs_switching?
|
93
|
+
def needs_switching?(restart_version)
|
101
94
|
autoswitching_applies? &&
|
102
|
-
Bundler.settings[:version] != "system" &&
|
103
95
|
released?(restart_version) &&
|
104
|
-
!running?(restart_version)
|
105
|
-
!updating?
|
96
|
+
!running?(restart_version)
|
106
97
|
end
|
107
98
|
|
108
99
|
def autoswitching_applies?
|
109
100
|
ENV["BUNDLER_VERSION"].nil? &&
|
110
101
|
ruby_can_restart_with_same_arguments? &&
|
111
|
-
SharedHelpers.in_bundle? &&
|
112
102
|
lockfile_version
|
113
103
|
end
|
114
104
|
|
@@ -142,6 +132,7 @@ module Bundler
|
|
142
132
|
end
|
143
133
|
|
144
134
|
def find_latest_matching_spec(requirement)
|
135
|
+
Bundler.configure
|
145
136
|
local_result = find_latest_matching_spec_from_collection(local_specs, requirement)
|
146
137
|
return local_result if local_result && requirement.specific?
|
147
138
|
|
@@ -171,18 +162,14 @@ module Bundler
|
|
171
162
|
$PROGRAM_NAME != "-e"
|
172
163
|
end
|
173
164
|
|
174
|
-
def
|
175
|
-
"update".start_with?(ARGV.first || " ") && ARGV[1..-1].any? {|a| a.start_with?("--bundler") }
|
176
|
-
end
|
177
|
-
|
178
|
-
def installed?
|
165
|
+
def installed?(restart_version)
|
179
166
|
Bundler.configure
|
180
167
|
|
181
168
|
Bundler.rubygems.find_bundler(restart_version.to_s)
|
182
169
|
end
|
183
170
|
|
184
171
|
def current_version
|
185
|
-
@current_version ||=
|
172
|
+
@current_version ||= Bundler.gem_version
|
186
173
|
end
|
187
174
|
|
188
175
|
def lockfile_version
|
@@ -194,13 +181,16 @@ module Bundler
|
|
194
181
|
@lockfile_version = nil
|
195
182
|
end
|
196
183
|
|
197
|
-
def
|
198
|
-
return
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
184
|
+
def find_restart_version
|
185
|
+
return unless SharedHelpers.in_bundle?
|
186
|
+
|
187
|
+
configured_version = Bundler.settings[:version]
|
188
|
+
return if configured_version == "system"
|
189
|
+
|
190
|
+
restart_version = configured_version == "lockfile" ? lockfile_version : Gem::Version.new(configured_version)
|
191
|
+
return unless needs_switching?(restart_version)
|
192
|
+
|
193
|
+
restart_version
|
204
194
|
end
|
205
195
|
end
|
206
196
|
end
|
@@ -74,29 +74,6 @@ module Bundler
|
|
74
74
|
fail!(key, value, "`#{other_key}` is current set to #{other_setting.inspect}", "the `#{conflicting.join("`, `")}` groups conflict")
|
75
75
|
end
|
76
76
|
end
|
77
|
-
|
78
|
-
rule %w[path], "relative paths are expanded relative to the current working directory" do |key, value, settings|
|
79
|
-
next if value.nil?
|
80
|
-
|
81
|
-
path = Pathname.new(value)
|
82
|
-
next if !path.relative? || !Bundler.feature_flag.path_relative_to_cwd?
|
83
|
-
|
84
|
-
path = path.expand_path
|
85
|
-
|
86
|
-
root = begin
|
87
|
-
Bundler.root
|
88
|
-
rescue GemfileNotFound
|
89
|
-
Pathname.pwd.expand_path
|
90
|
-
end
|
91
|
-
|
92
|
-
path = begin
|
93
|
-
path.relative_path_from(root)
|
94
|
-
rescue ArgumentError
|
95
|
-
path
|
96
|
-
end
|
97
|
-
|
98
|
-
set(settings, key, path.to_s)
|
99
|
-
end
|
100
77
|
end
|
101
78
|
end
|
102
79
|
end
|
data/lib/bundler/settings.rb
CHANGED
@@ -8,12 +8,10 @@ module Bundler
|
|
8
8
|
|
9
9
|
BOOL_KEYS = %w[
|
10
10
|
allow_offline_install
|
11
|
-
auto_clean_without_path
|
12
11
|
auto_install
|
13
12
|
cache_all
|
14
13
|
cache_all_platforms
|
15
14
|
clean
|
16
|
-
default_install_uses_path
|
17
15
|
deployment
|
18
16
|
disable_checksum_validation
|
19
17
|
disable_exec_load
|
@@ -27,6 +25,7 @@ module Bundler
|
|
27
25
|
gem.changelog
|
28
26
|
gem.coc
|
29
27
|
gem.mit
|
28
|
+
gem.bundle
|
30
29
|
git.allow_insecure
|
31
30
|
global_gem_cache
|
32
31
|
ignore_messages
|
@@ -35,15 +34,13 @@ module Bundler
|
|
35
34
|
lockfile_checksums
|
36
35
|
no_install
|
37
36
|
no_prune
|
38
|
-
path_relative_to_cwd
|
39
37
|
path.system
|
40
38
|
plugins
|
41
39
|
prefer_patch
|
42
|
-
print_only_version_number
|
43
|
-
setup_makes_kernel_gem_public
|
44
40
|
silence_deprecations
|
45
41
|
silence_root_warning
|
46
42
|
update_requires_all_flag
|
43
|
+
verbose
|
47
44
|
].freeze
|
48
45
|
|
49
46
|
REMEMBERED_KEYS = %w[
|
@@ -86,6 +83,7 @@ module Bundler
|
|
86
83
|
gemfile
|
87
84
|
path
|
88
85
|
shebang
|
86
|
+
simulate_version
|
89
87
|
system_bindir
|
90
88
|
trust-policy
|
91
89
|
version
|
@@ -274,7 +272,7 @@ module Bundler
|
|
274
272
|
def use_system_gems?
|
275
273
|
return true if system_path
|
276
274
|
return false if explicit_path
|
277
|
-
!Bundler.feature_flag.
|
275
|
+
!Bundler.feature_flag.bundler_4_mode?
|
278
276
|
end
|
279
277
|
|
280
278
|
def base_path
|
@@ -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
|
@@ -129,13 +133,16 @@ module Bundler
|
|
129
133
|
removed_message += suffix if removed_message
|
130
134
|
end
|
131
135
|
|
132
|
-
|
133
|
-
|
136
|
+
require_relative "../bundler"
|
137
|
+
|
138
|
+
feature_flag = Bundler.feature_flag
|
139
|
+
|
140
|
+
if feature_flag.removed_major?(major_version)
|
134
141
|
require_relative "errors"
|
135
142
|
raise DeprecatedError, "[REMOVED] #{removed_message || message}"
|
136
143
|
end
|
137
144
|
|
138
|
-
return unless
|
145
|
+
return unless feature_flag.deprecated_major?(major_version) && prints_major_deprecations?
|
139
146
|
Bundler.ui.warn("[DEPRECATED] #{message}")
|
140
147
|
end
|
141
148
|
|
@@ -382,7 +389,6 @@ module Bundler
|
|
382
389
|
end
|
383
390
|
|
384
391
|
def prints_major_deprecations?
|
385
|
-
require_relative "../bundler"
|
386
392
|
return false if Bundler.settings[:silence_deprecations]
|
387
393
|
require_relative "deprecate"
|
388
394
|
return false if Bundler::Deprecate.skip
|