rubygems-update 3.6.9 → 3.7.0
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 +853 -790
- data/CONTRIBUTING.md +9 -0
- data/Manifest.txt +4 -21
- data/README.md +1 -1
- data/SECURITY.md +7 -0
- data/bundler/CHANGELOG.md +1093 -1033
- data/bundler/README.md +7 -7
- data/bundler/bundler.gemspec +2 -2
- data/bundler/lib/bundler/build_metadata.rb +10 -11
- data/bundler/lib/bundler/cli/common.rb +1 -1
- data/bundler/lib/bundler/cli/config.rb +2 -2
- data/bundler/lib/bundler/cli/gem.rb +62 -30
- data/bundler/lib/bundler/cli/install.rb +4 -4
- data/bundler/lib/bundler/cli/outdated.rb +1 -1
- data/bundler/lib/bundler/cli/update.rb +2 -2
- data/bundler/lib/bundler/cli.rb +10 -14
- data/bundler/lib/bundler/compact_index_client.rb +1 -5
- data/bundler/lib/bundler/current_ruby.rb +27 -3
- data/bundler/lib/bundler/definition.rb +21 -22
- data/bundler/lib/bundler/dependency.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +33 -23
- data/bundler/lib/bundler/feature_flag.rb +15 -12
- data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
- data/bundler/lib/bundler/fetcher/downloader.rb +33 -7
- data/bundler/lib/bundler/fetcher.rb +49 -19
- data/bundler/lib/bundler/friendly_errors.rb +2 -1
- data/bundler/lib/bundler/index.rb +7 -2
- data/bundler/lib/bundler/installer.rb +5 -4
- data/bundler/lib/bundler/lazy_specification.rb +9 -7
- data/bundler/lib/bundler/lockfile_parser.rb +21 -5
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +172 -126
- data/bundler/lib/bundler/man/bundle-config.1.ronn +91 -91
- data/bundler/lib/bundler/man/bundle-console.1 +1 -1
- data/bundler/lib/bundler/man/bundle-doctor.1 +43 -4
- data/bundler/lib/bundler/man/bundle-doctor.1.ronn +48 -4
- data/bundler/lib/bundler/man/bundle-env.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
- data/bundler/lib/bundler/man/bundle-fund.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +67 -44
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +8 -4
- data/bundler/lib/bundler/man/bundle-help.1 +1 -1
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +2 -2
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +1 -1
- data/bundler/lib/bundler/man/bundle-issue.1 +1 -1
- data/bundler/lib/bundler/man/bundle-licenses.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-version.1 +1 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/match_platform.rb +31 -12
- data/bundler/lib/bundler/materialization.rb +2 -2
- data/bundler/lib/bundler/resolver/package.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +1 -3
- data/bundler/lib/bundler/rubygems_ext.rb +116 -120
- data/bundler/lib/bundler/rubygems_integration.rb +11 -6
- data/bundler/lib/bundler/runtime.rb +1 -1
- data/bundler/lib/bundler/self_manager.rb +32 -42
- data/bundler/lib/bundler/settings/validator.rb +0 -23
- data/bundler/lib/bundler/settings.rb +4 -6
- data/bundler/lib/bundler/shared_helpers.rb +6 -4
- data/bundler/lib/bundler/source/git/git_proxy.rb +3 -3
- data/bundler/lib/bundler/source/path.rb +7 -0
- data/bundler/lib/bundler/source_list.rb +1 -5
- data/bundler/lib/bundler/source_map.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +7 -3
- data/bundler/lib/bundler/templates/Executable +0 -11
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -5
- data/bundler/lib/bundler/ui/shell.rb +2 -2
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +81 -42
- data/bundler/lib/bundler/version.rb +10 -2
- data/bundler/lib/bundler/worker.rb +1 -1
- data/bundler/lib/bundler.rb +14 -12
- data/doc/bundler/UPGRADING.md +137 -127
- data/doc/rubygems/CONTRIBUTING.md +1 -1
- data/lib/rubygems/basic_specification.rb +7 -0
- data/lib/rubygems/commands/pristine_command.rb +9 -12
- data/lib/rubygems/commands/setup_command.rb +2 -2
- data/lib/rubygems/core_ext/kernel_require.rb +5 -2
- data/lib/rubygems/ext/cargo_builder.rb +4 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +10 -3
- data/lib/rubygems/gemcutter_utilities.rb +1 -1
- data/lib/rubygems/installer.rb +45 -50
- data/lib/rubygems/platform.rb +142 -39
- data/lib/rubygems/remote_fetcher.rb +3 -3
- data/lib/rubygems/request_set.rb +3 -6
- data/lib/rubygems/resolver/best_set.rb +1 -1
- data/lib/rubygems/resolver/source_set.rb +1 -1
- data/lib/rubygems/resolver.rb +1 -1
- data/lib/rubygems/s3_uri_signer.rb +5 -3
- data/lib/rubygems/source.rb +28 -22
- data/lib/rubygems/specification.rb +2 -2
- data/lib/rubygems/uri_formatter.rb +2 -1
- data/lib/rubygems/util/licenses.rb +21 -0
- data/lib/rubygems/vendor/net-http/lib/net/http.rb +14 -19
- data/lib/rubygems/vendor/resolv/lib/resolv.rb +50 -22
- data/lib/rubygems.rb +65 -7
- data/rubygems-update.gemspec +2 -2
- data/setup.rb +1 -1
- metadata +7 -24
- data/bundler/lib/bundler/gem_helpers.rb +0 -144
- data/bundler/lib/bundler/templates/Executable.bundler +0 -109
- data/bundler/lib/bundler/vendor/fileutils/.document +0 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/.document +0 -1
- data/bundler/lib/bundler/vendor/pub_grub/.document +0 -1
- data/bundler/lib/bundler/vendor/securerandom/.document +0 -1
- data/bundler/lib/bundler/vendor/thor/.document +0 -1
- data/bundler/lib/bundler/vendor/tsort/.document +0 -1
- data/bundler/lib/bundler/vendor/uri/.document +0 -1
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/rubygems/vendor/molinillo/.document +0 -1
- data/lib/rubygems/vendor/net-http/.document +0 -1
- data/lib/rubygems/vendor/net-protocol/.document +0 -1
- data/lib/rubygems/vendor/optparse/.document +0 -1
- data/lib/rubygems/vendor/resolv/.document +0 -1
- data/lib/rubygems/vendor/securerandom/.document +0 -1
- data/lib/rubygems/vendor/timeout/.document +0 -1
- data/lib/rubygems/vendor/tsort/.document +0 -1
- data/lib/rubygems/vendor/uri/.document +0 -1
- /data/lib/rubygems/ssl_certs/rubygems.org/{GlobalSignRootCA_R3.pem → GlobalSign.pem} +0 -0
- /data/{bundler/lib/bundler/vendor/connection_pool → lib/rubygems/vendor}/.document +0 -0
@@ -30,7 +30,7 @@ module Bundler
|
|
30
30
|
def platform_specs(specs)
|
31
31
|
platforms.map do |platform|
|
32
32
|
prefer_locked = @new_platforms.include?(platform) ? false : !unlock?
|
33
|
-
|
33
|
+
MatchPlatform.select_best_platform_match(specs, platform, prefer_locked: prefer_locked)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -14,8 +14,6 @@ module Bundler
|
|
14
14
|
require_relative "resolver/root"
|
15
15
|
require_relative "resolver/strategy"
|
16
16
|
|
17
|
-
include GemHelpers
|
18
|
-
|
19
17
|
def initialize(base, gem_version_promoter, most_specific_locked_platform = nil)
|
20
18
|
@source_requirements = base.source_requirements
|
21
19
|
@base = base
|
@@ -273,7 +271,7 @@ module Bundler
|
|
273
271
|
next groups if platform_specs.all?(&:empty?)
|
274
272
|
end
|
275
273
|
|
276
|
-
ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
|
274
|
+
ruby_specs = MatchPlatform.select_best_platform_match(specs, Gem::Platform::RUBY)
|
277
275
|
ruby_group = Resolver::SpecGroup.new(ruby_specs)
|
278
276
|
|
279
277
|
unless ruby_group.empty?
|
@@ -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.
|
123
103
|
|
124
|
-
|
104
|
+
def sort_and_filter_best_platform_match(matching, platform)
|
105
|
+
return matching if matching.one?
|
125
106
|
|
126
|
-
|
107
|
+
exact = matching.select {|spec| spec.platform == platform }
|
108
|
+
return exact if exact.any?
|
127
109
|
|
128
|
-
|
110
|
+
sorted_matching = sort_best_platform_match(matching, platform)
|
111
|
+
exemplary_spec = sorted_matching.first
|
129
112
|
|
130
|
-
|
113
|
+
sorted_matching.take_while {|spec| same_specificity?(platform, spec, exemplary_spec) && same_deps?(spec, exemplary_spec) }
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# Sorts the best platform match for the given matching specs and platform.
|
118
|
+
|
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
|
127
|
+
|
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
|
131
133
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
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
|
@@ -272,25 +283,16 @@ module Gem
|
|
272
283
|
end
|
273
284
|
end
|
274
285
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
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"
|
280
|
-
raw_require_paths.flatten!
|
281
|
-
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)
|
282
290
|
|
283
|
-
|
284
|
-
module RequirePathFlattener
|
285
|
-
def from_yaml(input)
|
286
|
-
spec = super(input)
|
287
|
-
spec.flatten_require_paths
|
288
|
-
spec
|
289
|
-
end
|
291
|
+
super
|
290
292
|
end
|
291
|
-
|
292
|
-
prepend RequirePathFlattener
|
293
293
|
end
|
294
|
+
|
295
|
+
prepend FixPathSourceMissingExtensions
|
294
296
|
end
|
295
297
|
|
296
298
|
private
|
@@ -401,6 +403,11 @@ module Gem
|
|
401
403
|
@ignored = missing_extensions?
|
402
404
|
end
|
403
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
|
404
411
|
end
|
405
412
|
|
406
413
|
require "rubygems/name_tuple"
|
@@ -471,15 +478,4 @@ module Gem
|
|
471
478
|
|
472
479
|
Package::TarReader::Entry.prepend(FixFullNameEncoding)
|
473
480
|
end
|
474
|
-
|
475
|
-
require "rubygems/uri"
|
476
|
-
|
477
|
-
# Can be removed once RubyGems 3.3.15 support is dropped
|
478
|
-
unless Gem::Uri.respond_to?(:redact)
|
479
|
-
class Uri
|
480
|
-
def self.redact(uri)
|
481
|
-
new(uri).redacted
|
482
|
-
end
|
483
|
-
end
|
484
|
-
end
|
485
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
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -133,13 +133,16 @@ module Bundler
|
|
133
133
|
removed_message += suffix if removed_message
|
134
134
|
end
|
135
135
|
|
136
|
-
|
137
|
-
|
136
|
+
require_relative "../bundler"
|
137
|
+
|
138
|
+
feature_flag = Bundler.feature_flag
|
139
|
+
|
140
|
+
if feature_flag.removed_major?(major_version)
|
138
141
|
require_relative "errors"
|
139
142
|
raise DeprecatedError, "[REMOVED] #{removed_message || message}"
|
140
143
|
end
|
141
144
|
|
142
|
-
return unless
|
145
|
+
return unless feature_flag.deprecated_major?(major_version) && prints_major_deprecations?
|
143
146
|
Bundler.ui.warn("[DEPRECATED] #{message}")
|
144
147
|
end
|
145
148
|
|
@@ -386,7 +389,6 @@ module Bundler
|
|
386
389
|
end
|
387
390
|
|
388
391
|
def prints_major_deprecations?
|
389
|
-
require_relative "../bundler"
|
390
392
|
return false if Bundler.settings[:silence_deprecations]
|
391
393
|
require_relative "deprecate"
|
392
394
|
return false if Bundler::Deprecate.skip
|
@@ -305,8 +305,8 @@ module Bundler
|
|
305
305
|
end
|
306
306
|
|
307
307
|
def has_revision_cached?
|
308
|
-
return unless
|
309
|
-
git("cat-file", "-e",
|
308
|
+
return unless commit && path.exist?
|
309
|
+
git("cat-file", "-e", commit, dir: path)
|
310
310
|
true
|
311
311
|
rescue GitError
|
312
312
|
false
|
@@ -408,7 +408,7 @@ module Bundler
|
|
408
408
|
def capture3_args_for(cmd, dir)
|
409
409
|
return ["git", *cmd] unless dir
|
410
410
|
|
411
|
-
if Bundler.feature_flag.
|
411
|
+
if Bundler.feature_flag.bundler_4_mode? || supports_minus_c?
|
412
412
|
["git", "-C", dir.to_s, *cmd]
|
413
413
|
else
|
414
414
|
["git", *cmd, { chdir: dir.to_s }]
|