rubygems-update 3.4.20 → 3.4.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +55 -0
- data/Manifest.txt +6 -0
- data/bundler/CHANGELOG.md +55 -3
- data/bundler/README.md +1 -2
- data/bundler/lib/bundler/build_metadata.rb +3 -3
- data/bundler/lib/bundler/cli/check.rb +1 -1
- data/bundler/lib/bundler/cli/gem.rb +4 -3
- data/bundler/lib/bundler/cli/install.rb +2 -2
- data/bundler/lib/bundler/cli/lock.rb +26 -23
- data/bundler/lib/bundler/cli/open.rb +5 -7
- data/bundler/lib/bundler/definition.rb +43 -26
- data/bundler/lib/bundler/endpoint_specification.rb +1 -1
- data/bundler/lib/bundler/env.rb +2 -2
- data/bundler/lib/bundler/errors.rb +15 -0
- data/bundler/lib/bundler/gem_helpers.rb +7 -0
- data/bundler/lib/bundler/gem_version_promoter.rb +2 -2
- data/bundler/lib/bundler/injector.rb +1 -1
- data/bundler/lib/bundler/installer/gem_installer.rb +5 -5
- data/bundler/lib/bundler/installer/parallel_installer.rb +0 -26
- data/bundler/lib/bundler/installer/standalone.rb +13 -6
- data/bundler/lib/bundler/lazy_specification.rb +4 -0
- data/bundler/lib/bundler/lockfile_parser.rb +29 -24
- 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 +1 -1
- data/bundler/lib/bundler/man/bundle-console.1 +1 -1
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +2 -2
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +2 -3
- data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
- 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 +1 -1
- data/bundler/lib/bundler/man/bundle-install.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 +17 -17
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +5 -5
- 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/plugin/index.rb +8 -0
- data/bundler/lib/bundler/plugin.rb +9 -2
- data/bundler/lib/bundler/resolver/package.rb +5 -0
- data/bundler/lib/bundler/resolver.rb +27 -7
- data/bundler/lib/bundler/ruby_version.rb +8 -1
- data/bundler/lib/bundler/rubygems_ext.rb +3 -4
- data/bundler/lib/bundler/rubygems_gem_installer.rb +23 -8
- data/bundler/lib/bundler/settings.rb +53 -16
- data/bundler/lib/bundler/shared_helpers.rb +16 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +21 -4
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +7 -4
- data/bundler/lib/bundler/stub_specification.rb +4 -2
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +6 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/ui/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +1 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +21 -9
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +3 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +8 -10
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +15 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +15 -15
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +140 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +13 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +4 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +16 -25
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +20 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +33 -17
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +27 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +44 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +40 -30
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +26 -150
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +4 -46
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -45
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb +49 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +134 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +155 -8
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler/yaml_serializer.rb +12 -8
- data/bundler/lib/bundler.rb +0 -8
- data/lib/rubygems/basic_specification.rb +1 -1
- data/lib/rubygems/command.rb +5 -5
- data/lib/rubygems/command_manager.rb +1 -1
- data/lib/rubygems/commands/cert_command.rb +3 -3
- data/lib/rubygems/commands/check_command.rb +5 -1
- data/lib/rubygems/commands/cleanup_command.rb +1 -1
- data/lib/rubygems/commands/contents_command.rb +2 -2
- data/lib/rubygems/commands/environment_command.rb +2 -2
- data/lib/rubygems/commands/help_command.rb +3 -3
- data/lib/rubygems/commands/open_command.rb +1 -3
- data/lib/rubygems/commands/owner_command.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +10 -10
- data/lib/rubygems/commands/specification_command.rb +5 -1
- data/lib/rubygems/commands/stale_command.rb +1 -1
- data/lib/rubygems/commands/uninstall_command.rb +4 -4
- data/lib/rubygems/commands/unpack_command.rb +3 -3
- data/lib/rubygems/commands/update_command.rb +4 -4
- data/lib/rubygems/commands/yank_command.rb +1 -1
- data/lib/rubygems/config_file.rb +63 -16
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +2 -2
- data/lib/rubygems/defaults.rb +6 -2
- data/lib/rubygems/dependency_installer.rb +4 -4
- data/lib/rubygems/deprecate.rb +2 -1
- data/lib/rubygems/doctor.rb +2 -2
- data/lib/rubygems/errors.rb +1 -1
- data/lib/rubygems/exceptions.rb +1 -1
- data/lib/rubygems/ext/builder.rb +5 -4
- data/lib/rubygems/ext/cargo_builder.rb +2 -2
- data/lib/rubygems/ext/ext_conf_builder.rb +1 -1
- data/lib/rubygems/ext/rake_builder.rb +1 -1
- data/lib/rubygems/gem_runner.rb +5 -1
- data/lib/rubygems/gemcutter_utilities.rb +2 -2
- data/lib/rubygems/indexer.rb +1 -1
- data/lib/rubygems/install_update_options.rb +1 -1
- data/lib/rubygems/installer.rb +15 -20
- data/lib/rubygems/local_remote_options.rb +1 -1
- data/lib/rubygems/package/digest_io.rb +1 -1
- data/lib/rubygems/package/old.rb +1 -1
- data/lib/rubygems/package/tar_header.rb +2 -2
- data/lib/rubygems/package/tar_reader.rb +9 -2
- data/lib/rubygems/package/tar_writer.rb +2 -2
- data/lib/rubygems/package.rb +9 -9
- data/lib/rubygems/path_support.rb +1 -1
- data/lib/rubygems/platform.rb +12 -6
- data/lib/rubygems/query_utils.rb +4 -4
- data/lib/rubygems/remote_fetcher.rb +12 -4
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
- data/lib/rubygems/request_set.rb +2 -1
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver/api_set.rb +2 -1
- data/lib/rubygems/resolver/api_specification.rb +1 -1
- data/lib/rubygems/resolver.rb +3 -3
- data/lib/rubygems/security/signer.rb +10 -2
- data/lib/rubygems/security/trust_dir.rb +5 -5
- data/lib/rubygems/security.rb +1 -1
- data/lib/rubygems/security_option.rb +1 -1
- data/lib/rubygems/source/local.rb +2 -1
- data/lib/rubygems/source.rb +5 -1
- data/lib/rubygems/source_list.rb +1 -1
- data/lib/rubygems/spec_fetcher.rb +2 -2
- data/lib/rubygems/specification.rb +30 -23
- data/lib/rubygems/specification_policy.rb +11 -11
- data/lib/rubygems/uninstaller.rb +3 -3
- data/lib/rubygems/update_suggestion.rb +1 -1
- data/lib/rubygems/user_interaction.rb +2 -2
- data/lib/rubygems/util/licenses.rb +48 -0
- data/lib/rubygems/util.rb +5 -1
- data/lib/rubygems/validator.rb +1 -1
- data/lib/rubygems/version.rb +6 -5
- data/lib/rubygems/yaml_serializer.rb +93 -0
- data/lib/rubygems.rb +9 -9
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +2 -0
- data/test/rubygems/bundler_test_gem.rb +6 -3
- data/test/rubygems/helper.rb +29 -21
- data/test/rubygems/package/tar_test_case.rb +2 -2
- data/test/rubygems/test_gem.rb +51 -26
- data/test/rubygems/test_gem_command.rb +3 -1
- data/test/rubygems/test_gem_command_manager.rb +6 -6
- data/test/rubygems/test_gem_commands_cert_command.rb +23 -23
- data/test/rubygems/test_gem_commands_cleanup_command.rb +2 -2
- data/test/rubygems/test_gem_commands_environment_command.rb +2 -1
- data/test/rubygems/test_gem_commands_exec_command.rb +5 -1
- data/test/rubygems/test_gem_commands_install_command.rb +5 -5
- data/test/rubygems/test_gem_commands_open_command.rb +5 -2
- data/test/rubygems/test_gem_commands_pristine_command.rb +2 -2
- data/test/rubygems/test_gem_commands_push_command.rb +7 -6
- data/test/rubygems/test_gem_commands_signin_command.rb +8 -8
- data/test/rubygems/test_gem_commands_uninstall_command.rb +21 -1
- data/test/rubygems/test_gem_commands_unpack_command.rb +2 -2
- data/test/rubygems/test_gem_config_file.rb +46 -12
- data/test/rubygems/test_gem_ext_builder.rb +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder.rb +2 -2
- data/test/rubygems/test_gem_gemcutter_utilities.rb +8 -5
- data/test/rubygems/test_gem_install_update_options.rb +3 -3
- data/test/rubygems/test_gem_installer.rb +16 -16
- data/test/rubygems/test_gem_package.rb +35 -34
- data/test/rubygems/test_gem_package_old.rb +1 -1
- data/test/rubygems/test_gem_package_tar_header.rb +3 -3
- data/test/rubygems/test_gem_package_tar_reader.rb +19 -4
- data/test/rubygems/test_gem_package_tar_writer.rb +28 -28
- data/test/rubygems/test_gem_rdoc.rb +2 -2
- data/test/rubygems/test_gem_remote_fetcher.rb +13 -9
- data/test/rubygems/test_gem_request.rb +5 -5
- data/test/rubygems/test_gem_request_connection_pools.rb +2 -1
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +14 -7
- data/test/rubygems/test_gem_security.rb +2 -2
- data/test/rubygems/test_gem_security_policy.rb +2 -2
- data/test/rubygems/test_gem_security_signer.rb +2 -2
- data/test/rubygems/test_gem_security_trust_dir.rb +6 -6
- data/test/rubygems/test_gem_spec_fetcher.rb +2 -2
- data/test/rubygems/test_gem_specification.rb +29 -29
- data/test/rubygems/test_gem_stream_ui.rb +1 -1
- data/test/rubygems/test_gem_update_suggestion.rb +12 -6
- data/test/rubygems/test_gem_util.rb +2 -2
- data/test/rubygems/test_gem_version.rb +4 -2
- data/test/rubygems/utilities.rb +4 -3
- metadata +9 -3
@@ -21,6 +21,7 @@ module Bundler
|
|
21
21
|
@locked_version = locked_specs[name].first&.version
|
22
22
|
@unlock = unlock
|
23
23
|
@dependency = dependency || Dependency.new(name, @locked_version)
|
24
|
+
@top_level = !dependency.nil?
|
24
25
|
@prerelease = @dependency.prerelease? || @locked_version&.prerelease? || prerelease ? :consider_first : :ignore
|
25
26
|
end
|
26
27
|
|
@@ -32,6 +33,10 @@ module Bundler
|
|
32
33
|
false
|
33
34
|
end
|
34
35
|
|
36
|
+
def top_level?
|
37
|
+
@top_level
|
38
|
+
end
|
39
|
+
|
35
40
|
def meta?
|
36
41
|
@name.end_with?("\0")
|
37
42
|
end
|
@@ -131,7 +131,7 @@ module Bundler
|
|
131
131
|
|
132
132
|
if base_requirements[name]
|
133
133
|
names_to_unlock << name
|
134
|
-
elsif package.ignores_prereleases?
|
134
|
+
elsif package.ignores_prereleases? && @all_specs[name].any? {|s| s.version.prerelease? }
|
135
135
|
names_to_allow_prereleases_for << name
|
136
136
|
end
|
137
137
|
|
@@ -248,8 +248,22 @@ module Bundler
|
|
248
248
|
results = filter_matching_specs(results, locked_requirement) if locked_requirement
|
249
249
|
|
250
250
|
versions = results.group_by(&:version).reduce([]) do |groups, (version, specs)|
|
251
|
-
platform_specs = package.platforms.
|
252
|
-
|
251
|
+
platform_specs = package.platforms.map {|platform| select_best_platform_match(specs, platform) }
|
252
|
+
|
253
|
+
# If package is a top-level dependency,
|
254
|
+
# candidate is only valid if there are matching versions for all resolution platforms.
|
255
|
+
#
|
256
|
+
# If package is not a top-level deependency,
|
257
|
+
# then it's not necessary that it has matching versions for all platforms, since it may have been introduced only as
|
258
|
+
# a dependency for a platform specific variant, so it will only need to have a valid version for that platform.
|
259
|
+
#
|
260
|
+
if package.top_level?
|
261
|
+
next groups if platform_specs.any?(&:empty?)
|
262
|
+
else
|
263
|
+
next groups if platform_specs.all?(&:empty?)
|
264
|
+
end
|
265
|
+
|
266
|
+
platform_specs.flatten!
|
253
267
|
|
254
268
|
ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
|
255
269
|
groups << Resolver::Candidate.new(version, :specs => ruby_specs) if ruby_specs.any?
|
@@ -295,15 +309,21 @@ module Bundler
|
|
295
309
|
end
|
296
310
|
specs_matching_requirement = filter_matching_specs(specs, package.dependency.requirement)
|
297
311
|
|
298
|
-
if specs_matching_requirement.any?
|
312
|
+
not_found_message = if specs_matching_requirement.any?
|
299
313
|
specs = specs_matching_requirement
|
300
314
|
matching_part = requirement_label
|
301
315
|
platforms = package.platforms
|
302
|
-
|
303
|
-
|
316
|
+
|
317
|
+
if platforms.size == 1
|
318
|
+
"Could not find gem '#{requirement_label}' with platform '#{platforms.first}'"
|
319
|
+
else
|
320
|
+
"Could not find gems matching '#{requirement_label}' valid for all resolution platforms (#{platforms.join(", ")})"
|
321
|
+
end
|
322
|
+
else
|
323
|
+
"Could not find gem '#{requirement_label}'"
|
304
324
|
end
|
305
325
|
|
306
|
-
message = String.new("
|
326
|
+
message = String.new("#{not_found_message} in #{source}#{cache_message}.\n")
|
307
327
|
|
308
328
|
if specs.any?
|
309
329
|
message << "\n#{other_specs_matching_message(specs, matching_part)}"
|
@@ -23,7 +23,7 @@ module Bundler
|
|
23
23
|
# specified must match the version.
|
24
24
|
|
25
25
|
@versions = Array(versions).map do |v|
|
26
|
-
op, v = Gem::Requirement.parse(v)
|
26
|
+
op, v = Gem::Requirement.parse(normalize_version(v))
|
27
27
|
op == "=" ? v.to_s : "#{op} #{v}"
|
28
28
|
end
|
29
29
|
|
@@ -112,6 +112,13 @@ module Bundler
|
|
112
112
|
|
113
113
|
private
|
114
114
|
|
115
|
+
# Ruby's official preview version format uses a `-`: Example: 3.3.0-preview2
|
116
|
+
# However, RubyGems recognizes preview version format with a `.`: Example: 3.3.0.preview2
|
117
|
+
# Returns version string after replacing `-` with `.`
|
118
|
+
def normalize_version(version)
|
119
|
+
version.tr("-", ".")
|
120
|
+
end
|
121
|
+
|
115
122
|
def matches?(requirements, version)
|
116
123
|
# Handles RUBY_PATCHLEVEL of -1 for instances like ruby-head
|
117
124
|
return requirements == version if requirements.to_s == "-1" || version.to_s == "-1"
|
@@ -320,7 +320,7 @@ module Gem
|
|
320
320
|
end
|
321
321
|
|
322
322
|
# On universal Rubies, resolve the "universal" arch to the real CPU arch, without changing the extension directory.
|
323
|
-
class
|
323
|
+
class BasicSpecification
|
324
324
|
if /^universal\.(?<arch>.*?)-/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
|
325
325
|
local_platform = Platform.local
|
326
326
|
if local_platform.cpu == "universal"
|
@@ -333,9 +333,8 @@ module Gem
|
|
333
333
|
end
|
334
334
|
|
335
335
|
def extensions_dir
|
336
|
-
|
337
|
-
File.join(base_dir, "extensions", ORIGINAL_LOCAL_PLATFORM,
|
338
|
-
Gem.extension_api_version)
|
336
|
+
@extensions_dir ||=
|
337
|
+
Gem.default_ext_dir_for(base_dir) || File.join(base_dir, "extensions", ORIGINAL_LOCAL_PLATFORM, Gem.extension_api_version)
|
339
338
|
end
|
340
339
|
end
|
341
340
|
end
|
@@ -45,6 +45,14 @@ module Bundler
|
|
45
45
|
spec
|
46
46
|
end
|
47
47
|
|
48
|
+
def pre_install_checks
|
49
|
+
super && validate_bundler_checksum(options[:bundler_expected_checksum])
|
50
|
+
rescue Gem::FilePermissionError
|
51
|
+
# Ignore permission checks in RubyGems. Instead, go on, and try to write
|
52
|
+
# for real. We properly handle permission errors when they happen.
|
53
|
+
nil
|
54
|
+
end
|
55
|
+
|
48
56
|
def generate_plugins
|
49
57
|
return unless Gem::Installer.instance_methods(false).include?(:generate_plugins)
|
50
58
|
|
@@ -60,10 +68,6 @@ module Bundler
|
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
63
|
-
def pre_install_checks
|
64
|
-
super && validate_bundler_checksum(options[:bundler_expected_checksum])
|
65
|
-
end
|
66
|
-
|
67
71
|
def build_extensions
|
68
72
|
extension_cache_path = options[:bundler_extension_cache_path]
|
69
73
|
extension_dir = spec.extension_dir
|
@@ -108,11 +112,22 @@ module Bundler
|
|
108
112
|
end
|
109
113
|
|
110
114
|
def strict_rm_rf(dir)
|
111
|
-
|
112
|
-
|
113
|
-
|
115
|
+
return unless File.exist?(dir)
|
116
|
+
|
117
|
+
parent = File.dirname(dir)
|
118
|
+
parent_st = File.stat(parent)
|
119
|
+
|
120
|
+
if parent_st.world_writable? && !parent_st.sticky?
|
121
|
+
raise InsecureInstallPathError.new(parent)
|
122
|
+
end
|
123
|
+
|
124
|
+
begin
|
125
|
+
FileUtils.remove_entry_secure(dir)
|
126
|
+
rescue StandardError => e
|
127
|
+
raise unless File.exist?(dir)
|
114
128
|
|
115
|
-
|
129
|
+
raise DirectoryRemovalError.new(e, "Could not delete previous installation of `#{dir}`")
|
130
|
+
end
|
116
131
|
end
|
117
132
|
|
118
133
|
def validate_bundler_checksum(checksum)
|
@@ -95,6 +95,8 @@ module Bundler
|
|
95
95
|
|
96
96
|
@global_config = load_config(global_config_file)
|
97
97
|
@temporary = {}
|
98
|
+
|
99
|
+
@key_cache = {}
|
98
100
|
end
|
99
101
|
|
100
102
|
def [](name)
|
@@ -310,7 +312,7 @@ module Bundler
|
|
310
312
|
end
|
311
313
|
|
312
314
|
def key_for(key)
|
313
|
-
self.class.key_for(key)
|
315
|
+
@key_cache[key] ||= self.class.key_for(key)
|
314
316
|
end
|
315
317
|
|
316
318
|
private
|
@@ -342,12 +344,12 @@ module Bundler
|
|
342
344
|
end
|
343
345
|
|
344
346
|
def is_bool(name)
|
345
|
-
name = name
|
347
|
+
name = self.class.key_to_s(name)
|
346
348
|
BOOL_KEYS.include?(name) || BOOL_KEYS.include?(parent_setting_for(name))
|
347
349
|
end
|
348
350
|
|
349
351
|
def is_string(name)
|
350
|
-
name = name
|
352
|
+
name = self.class.key_to_s(name)
|
351
353
|
STRING_KEYS.include?(name) || name.start_with?("local.") || name.start_with?("mirror.") || name.start_with?("build.")
|
352
354
|
end
|
353
355
|
|
@@ -363,11 +365,11 @@ module Bundler
|
|
363
365
|
end
|
364
366
|
|
365
367
|
def is_num(key)
|
366
|
-
NUMBER_KEYS.include?(key
|
368
|
+
NUMBER_KEYS.include?(self.class.key_to_s(key))
|
367
369
|
end
|
368
370
|
|
369
371
|
def is_array(key)
|
370
|
-
ARRAY_KEYS.include?(key
|
372
|
+
ARRAY_KEYS.include?(self.class.key_to_s(key))
|
371
373
|
end
|
372
374
|
|
373
375
|
def is_credential(key)
|
@@ -390,7 +392,7 @@ module Bundler
|
|
390
392
|
end
|
391
393
|
|
392
394
|
def set_key(raw_key, value, hash, file)
|
393
|
-
raw_key = raw_key
|
395
|
+
raw_key = self.class.key_to_s(raw_key)
|
394
396
|
value = array_to_s(value) if is_array(raw_key)
|
395
397
|
|
396
398
|
key = key_for(raw_key)
|
@@ -405,13 +407,12 @@ module Bundler
|
|
405
407
|
return unless file
|
406
408
|
SharedHelpers.filesystem_access(file) do |p|
|
407
409
|
FileUtils.mkdir_p(p.dirname)
|
408
|
-
|
409
|
-
p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
|
410
|
+
p.open("w") {|f| f.write(serializer_class.dump(hash)) }
|
410
411
|
end
|
411
412
|
end
|
412
413
|
|
413
414
|
def converted_value(value, key)
|
414
|
-
key = key
|
415
|
+
key = self.class.key_to_s(key)
|
415
416
|
|
416
417
|
if is_array(key)
|
417
418
|
to_array(value)
|
@@ -470,24 +471,31 @@ module Bundler
|
|
470
471
|
SharedHelpers.filesystem_access(config_file, :read) do |file|
|
471
472
|
valid_file = file.exist? && !file.size.zero?
|
472
473
|
return {} unless valid_file
|
473
|
-
|
474
|
-
YAMLSerializer.load(file.read).inject({}) do |config, (k, v)|
|
475
|
-
new_k = k
|
476
|
-
|
474
|
+
serializer_class.load(file.read).inject({}) do |config, (k, v)|
|
477
475
|
if k.include?("-")
|
478
476
|
Bundler.ui.warn "Your #{file} config includes `#{k}`, which contains the dash character (`-`).\n" \
|
479
477
|
"This is deprecated, because configuration through `ENV` should be possible, but `ENV` keys cannot include dashes.\n" \
|
480
478
|
"Please edit #{file} and replace any dashes in configuration keys with a triple underscore (`___`)."
|
481
479
|
|
482
|
-
|
480
|
+
# string hash keys are frozen
|
481
|
+
k = k.gsub("-", "___")
|
483
482
|
end
|
484
483
|
|
485
|
-
config[
|
484
|
+
config[k] = v
|
486
485
|
config
|
487
486
|
end
|
488
487
|
end
|
489
488
|
end
|
490
489
|
|
490
|
+
def serializer_class
|
491
|
+
require "rubygems/yaml_serializer"
|
492
|
+
Gem::YAMLSerializer
|
493
|
+
rescue LoadError
|
494
|
+
# TODO: Remove this when RubyGems 3.4 is EOL
|
495
|
+
require_relative "yaml_serializer"
|
496
|
+
YAMLSerializer
|
497
|
+
end
|
498
|
+
|
491
499
|
PER_URI_OPTIONS = %w[
|
492
500
|
fallback_timeout
|
493
501
|
].freeze
|
@@ -503,7 +511,7 @@ module Bundler
|
|
503
511
|
|
504
512
|
def self.key_for(key)
|
505
513
|
key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
|
506
|
-
key = key.
|
514
|
+
key = key_to_s(key).gsub(".", "__")
|
507
515
|
key.gsub!("-", "___")
|
508
516
|
key.upcase!
|
509
517
|
|
@@ -527,5 +535,34 @@ module Bundler
|
|
527
535
|
end
|
528
536
|
"#{prefix}#{uri}#{suffix}"
|
529
537
|
end
|
538
|
+
|
539
|
+
# This is a hot method, so avoid respond_to? checks on every invocation
|
540
|
+
if :read.respond_to?(:name)
|
541
|
+
def self.key_to_s(key)
|
542
|
+
case key
|
543
|
+
when String
|
544
|
+
key
|
545
|
+
when Symbol
|
546
|
+
key.name
|
547
|
+
when Bundler::URI::HTTP
|
548
|
+
key.to_s
|
549
|
+
else
|
550
|
+
raise ArgumentError, "Invalid key: #{key.inspect}"
|
551
|
+
end
|
552
|
+
end
|
553
|
+
else
|
554
|
+
def self.key_to_s(key)
|
555
|
+
case key
|
556
|
+
when String
|
557
|
+
key
|
558
|
+
when Symbol
|
559
|
+
key.to_s
|
560
|
+
when Bundler::URI::HTTP
|
561
|
+
key.to_s
|
562
|
+
else
|
563
|
+
raise ArgumentError, "Invalid key: #{key.inspect}"
|
564
|
+
end
|
565
|
+
end
|
566
|
+
end
|
530
567
|
end
|
531
568
|
end
|
@@ -197,6 +197,21 @@ module Bundler
|
|
197
197
|
filesystem_access(gemfile_path) {|g| File.open(g, "w") {|file| file.puts contents } }
|
198
198
|
end
|
199
199
|
|
200
|
+
def relative_gemfile_path
|
201
|
+
relative_path_to(Bundler.default_gemfile)
|
202
|
+
end
|
203
|
+
|
204
|
+
def relative_lockfile_path
|
205
|
+
relative_path_to(Bundler.default_lockfile)
|
206
|
+
end
|
207
|
+
|
208
|
+
def relative_path_to(destination, from: pwd)
|
209
|
+
Pathname.new(destination).relative_path_from(from).to_s
|
210
|
+
rescue ArgumentError
|
211
|
+
# on Windows, if source and destination are on different drivers, there's no relative path from one to the other
|
212
|
+
destination
|
213
|
+
end
|
214
|
+
|
200
215
|
private
|
201
216
|
|
202
217
|
def validate_bundle_path
|
@@ -297,7 +312,7 @@ module Bundler
|
|
297
312
|
def set_rubyopt
|
298
313
|
rubyopt = [ENV["RUBYOPT"]].compact
|
299
314
|
setup_require = "-r#{File.expand_path("setup", __dir__)}"
|
300
|
-
return if !rubyopt.empty? && rubyopt.first =~ /#{setup_require}/
|
315
|
+
return if !rubyopt.empty? && rubyopt.first =~ /#{Regexp.escape(setup_require)}/
|
301
316
|
rubyopt.unshift setup_require
|
302
317
|
Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
|
303
318
|
end
|
@@ -130,7 +130,12 @@ module Bundler
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
|
133
|
+
ref = @commit_ref || (locked_to_full_sha? && @revision)
|
134
|
+
if ref
|
135
|
+
git "config", "uploadpack.allowAnySHA1InWant", "true", :dir => path.to_s if @commit_ref.nil? && needs_allow_any_sha1_in_want?
|
136
|
+
|
137
|
+
git "fetch", "--force", "--quiet", *extra_fetch_args(ref), :dir => destination
|
138
|
+
end
|
134
139
|
|
135
140
|
git "reset", "--hard", @revision, :dir => destination
|
136
141
|
|
@@ -247,7 +252,15 @@ module Bundler
|
|
247
252
|
end
|
248
253
|
|
249
254
|
def pinned_to_full_sha?
|
250
|
-
ref
|
255
|
+
full_sha_revision?(ref)
|
256
|
+
end
|
257
|
+
|
258
|
+
def locked_to_full_sha?
|
259
|
+
full_sha_revision?(@revision)
|
260
|
+
end
|
261
|
+
|
262
|
+
def full_sha_revision?(ref)
|
263
|
+
ref&.match?(/\A\h{40}\z/)
|
251
264
|
end
|
252
265
|
|
253
266
|
def git_null(*command, dir: nil)
|
@@ -411,9 +424,9 @@ module Bundler
|
|
411
424
|
["--depth", depth.to_s]
|
412
425
|
end
|
413
426
|
|
414
|
-
def extra_fetch_args
|
427
|
+
def extra_fetch_args(ref)
|
415
428
|
extra_args = [path.to_s, *depth_args]
|
416
|
-
extra_args.push(
|
429
|
+
extra_args.push(ref)
|
417
430
|
extra_args
|
418
431
|
end
|
419
432
|
|
@@ -425,6 +438,10 @@ module Bundler
|
|
425
438
|
@supports_minus_c ||= Gem::Version.new(version) >= Gem::Version.new("1.8.5")
|
426
439
|
end
|
427
440
|
|
441
|
+
def needs_allow_any_sha1_in_want?
|
442
|
+
@needs_allow_any_sha1_in_want ||= Gem::Version.new(version) <= Gem::Version.new("2.13.7")
|
443
|
+
end
|
444
|
+
|
428
445
|
def supports_fetching_unreachable_refs?
|
429
446
|
@supports_fetching_unreachable_refs ||= Gem::Version.new(version) >= Gem::Version.new("2.5.0")
|
430
447
|
end
|
@@ -5,7 +5,7 @@ module Bundler
|
|
5
5
|
class Metadata < Source
|
6
6
|
def specs
|
7
7
|
@specs ||= Index.build do |idx|
|
8
|
-
idx << Gem::Specification.new("Ruby\0",
|
8
|
+
idx << Gem::Specification.new("Ruby\0", Bundler::RubyVersion.system.gem_version)
|
9
9
|
idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.default
|
11
11
|
end
|
@@ -100,12 +100,12 @@ module Bundler
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
def
|
103
|
+
def incomplete_for_platform?(deps, platform)
|
104
104
|
return false if @specs.empty?
|
105
105
|
|
106
106
|
@incomplete_specs = []
|
107
107
|
|
108
|
-
self.for(deps, true, [
|
108
|
+
self.for(deps, true, [platform])
|
109
109
|
|
110
110
|
@incomplete_specs.any?
|
111
111
|
end
|
@@ -200,8 +200,11 @@ module Bundler
|
|
200
200
|
|
201
201
|
def specs_for_dependency(dep, platform)
|
202
202
|
specs_for_name = lookup[dep.name]
|
203
|
-
|
204
|
-
|
203
|
+
matching_specs = if dep.force_ruby_platform
|
204
|
+
GemHelpers.force_ruby_platform(specs_for_name)
|
205
|
+
else
|
206
|
+
GemHelpers.select_best_platform_match(specs_for_name, platform || Bundler.local_platform)
|
207
|
+
end
|
205
208
|
matching_specs.map!(&:materialize_for_installation).compact! if platform.nil?
|
206
209
|
matching_specs
|
207
210
|
end
|
@@ -16,7 +16,8 @@ module Bundler
|
|
16
16
|
# Stub has no concept of source, which means that extension_dir may be wrong
|
17
17
|
# This is the case for git-based gems. So, instead manually assign the extension dir
|
18
18
|
return unless source.respond_to?(:extension_dir_name)
|
19
|
-
|
19
|
+
unique_extension_dir = [source.extension_dir_name, File.basename(full_gem_path)].uniq.join("-")
|
20
|
+
path = File.join(stub.extensions_dir, unique_extension_dir)
|
20
21
|
stub.extension_dir = File.expand_path(path)
|
21
22
|
end
|
22
23
|
|
@@ -56,7 +57,7 @@ module Bundler
|
|
56
57
|
end
|
57
58
|
|
58
59
|
def gem_build_complete_path
|
59
|
-
|
60
|
+
stub.gem_build_complete_path
|
60
61
|
end
|
61
62
|
|
62
63
|
def default_gem?
|
@@ -108,6 +109,7 @@ module Bundler
|
|
108
109
|
end
|
109
110
|
|
110
111
|
rs.source = source
|
112
|
+
rs.base_dir = stub.base_dir
|
111
113
|
|
112
114
|
rs
|
113
115
|
end
|
@@ -46,7 +46,9 @@ require "rb_sys/extensiontask"
|
|
46
46
|
|
47
47
|
task build: :compile
|
48
48
|
|
49
|
-
|
49
|
+
GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec")
|
50
|
+
|
51
|
+
RbSys::ExtensionTask.new(<%= config[:name].inspect %>, GEMSPEC) do |ext|
|
50
52
|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
|
51
53
|
end
|
52
54
|
<% else -%>
|
@@ -54,7 +56,9 @@ require "rake/extensiontask"
|
|
54
56
|
|
55
57
|
task build: :compile
|
56
58
|
|
57
|
-
|
59
|
+
GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec")
|
60
|
+
|
61
|
+
Rake::ExtensionTask.new("<%= config[:underscored_name] %>", GEMSPEC) do |ext|
|
58
62
|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
|
59
63
|
end
|
60
64
|
<% end -%>
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.files = Dir.chdir(__dir__) do
|
31
31
|
`git ls-files -z`.split("\x0").reject do |f|
|
32
32
|
(File.expand_path(f) == __FILE__) ||
|
33
|
-
f.start_with?(*%w[bin/ test/ spec/ features/ .git
|
33
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git <%= config[:ci_config_path] %>appveyor Gemfile])
|
34
34
|
end
|
35
35
|
end
|
36
36
|
spec.bindir = "exe"
|
@@ -147,7 +147,7 @@ module Bundler
|
|
147
147
|
spaces ? text.gsub(/#{spaces}/, "") : text
|
148
148
|
end
|
149
149
|
|
150
|
-
def word_wrap(text, line_width =
|
150
|
+
def word_wrap(text, line_width = Thor::Terminal.terminal_width)
|
151
151
|
strip_leading_spaces(text).split("\n").collect do |line|
|
152
152
|
line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line
|
153
153
|
end * "\n"
|
@@ -11,20 +11,32 @@ class Bundler::Persistent::Net::HTTP::Persistent::Pool < Bundler::ConnectionPool
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def checkin net_http_args
|
14
|
-
|
14
|
+
if net_http_args.is_a?(Hash) && net_http_args.size == 1 && net_http_args[:force]
|
15
|
+
# Bundler::ConnectionPool 2.4+ calls `checkin(force: true)` after fork.
|
16
|
+
# When this happens, we should remove all connections from Thread.current
|
17
|
+
if stacks = Thread.current[@key]
|
18
|
+
stacks.each do |http_args, connections|
|
19
|
+
connections.each do |conn|
|
20
|
+
@available.push conn, connection_args: http_args
|
21
|
+
end
|
22
|
+
connections.clear
|
23
|
+
end
|
24
|
+
end
|
25
|
+
else
|
26
|
+
stack = Thread.current[@key][net_http_args] ||= []
|
15
27
|
|
16
|
-
|
17
|
-
|
28
|
+
raise Bundler::ConnectionPool::Error, 'no connections are checked out' if
|
29
|
+
stack.empty?
|
18
30
|
|
19
|
-
|
31
|
+
conn = stack.pop
|
20
32
|
|
21
|
-
|
22
|
-
|
33
|
+
if stack.empty?
|
34
|
+
@available.push conn, connection_args: net_http_args
|
23
35
|
|
24
|
-
|
25
|
-
|
36
|
+
Thread.current[@key].delete(net_http_args)
|
37
|
+
Thread.current[@key] = nil if Thread.current[@key].empty?
|
38
|
+
end
|
26
39
|
end
|
27
|
-
|
28
40
|
nil
|
29
41
|
end
|
30
42
|
|
@@ -174,7 +174,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
174
174
|
##
|
175
175
|
# The version of Bundler::Persistent::Net::HTTP::Persistent you are using
|
176
176
|
|
177
|
-
VERSION = '4.0.
|
177
|
+
VERSION = '4.0.2'
|
178
178
|
|
179
179
|
##
|
180
180
|
# Error class for errors raised by Bundler::Persistent::Net::HTTP::Persistent. Various
|
@@ -43,7 +43,8 @@ class Bundler::Thor
|
|
43
43
|
# Boolean:: true if it is identical, false otherwise.
|
44
44
|
#
|
45
45
|
def identical?
|
46
|
-
|
46
|
+
# binread uses ASCII-8BIT, so to avoid false negatives, the string must use the same
|
47
|
+
exists? && File.binread(destination) == String.new(render).force_encoding("ASCII-8BIT")
|
47
48
|
end
|
48
49
|
|
49
50
|
# Holds the content to be added to the file.
|
@@ -60,7 +61,7 @@ class Bundler::Thor
|
|
60
61
|
invoke_with_conflict_check do
|
61
62
|
require "fileutils"
|
62
63
|
FileUtils.mkdir_p(File.dirname(destination))
|
63
|
-
File.open(destination, "wb") { |f| f.write render }
|
64
|
+
File.open(destination, "wb", config[:perm]) { |f| f.write render }
|
64
65
|
end
|
65
66
|
given_destination
|
66
67
|
end
|
@@ -58,7 +58,7 @@ class Bundler::Thor
|
|
58
58
|
def initialize(base, source, destination = nil, config = {}, &block)
|
59
59
|
@source = File.expand_path(Dir[Util.escape_globs(base.find_in_source_paths(source.to_s))].first)
|
60
60
|
@block = block
|
61
|
-
super(base, destination, {:
|
61
|
+
super(base, destination, {recursive: true}.merge(config))
|
62
62
|
end
|
63
63
|
|
64
64
|
def invoke!
|