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
@@ -128,10 +128,10 @@ command to remove old versions.
|
|
128
128
|
if updated.empty?
|
129
129
|
say "Nothing to update"
|
130
130
|
else
|
131
|
-
say "Gems updated: #{updated_names.join(
|
131
|
+
say "Gems updated: #{updated_names.join(" ")}"
|
132
132
|
end
|
133
|
-
say "Gems already up-to-date: #{up_to_date_names.join(
|
134
|
-
say "Gems not currently installed: #{not_installed_names.join(
|
133
|
+
say "Gems already up-to-date: #{up_to_date_names.join(" ")}" unless up_to_date_names.empty?
|
134
|
+
say "Gems not currently installed: #{not_installed_names.join(" ")}" unless not_installed_names.empty?
|
135
135
|
end
|
136
136
|
|
137
137
|
def fetch_remote_gems(spec) # :nodoc:
|
@@ -231,7 +231,7 @@ command to remove old versions.
|
|
231
231
|
highest_remote_tup = highest_remote_name_tuple(rubygems_update)
|
232
232
|
target = highest_remote_tup ? highest_remote_tup.version : version
|
233
233
|
|
234
|
-
|
234
|
+
[target, requirement]
|
235
235
|
end
|
236
236
|
|
237
237
|
def update_gem(name, version = Gem::Requirement.default)
|
data/lib/rubygems/config_file.rb
CHANGED
@@ -202,7 +202,7 @@ class Gem::ConfigFile
|
|
202
202
|
@hash = @hash.merge environment_config
|
203
203
|
end
|
204
204
|
|
205
|
-
# HACK these override command-line args, which is bad
|
205
|
+
# HACK: these override command-line args, which is bad
|
206
206
|
@backtrace = @hash[:backtrace] if @hash.key? :backtrace
|
207
207
|
@bulk_threshold = @hash[:bulk_threshold] if @hash.key? :bulk_threshold
|
208
208
|
@home = @hash[:gemhome] if @hash.key? :gemhome
|
@@ -241,9 +241,9 @@ class Gem::ConfigFile
|
|
241
241
|
return if Gem.win_platform? # windows doesn't write 0600 as 0600
|
242
242
|
return unless File.exist? credentials_path
|
243
243
|
|
244
|
-
existing_permissions = File.stat(credentials_path).mode &
|
244
|
+
existing_permissions = File.stat(credentials_path).mode & 0o777
|
245
245
|
|
246
|
-
return if existing_permissions ==
|
246
|
+
return if existing_permissions == 0o600
|
247
247
|
|
248
248
|
alert_error <<-ERROR
|
249
249
|
Your gem push credentials file located at:
|
@@ -324,11 +324,9 @@ if you believe they were disclosed to a third party.
|
|
324
324
|
require "fileutils"
|
325
325
|
FileUtils.mkdir_p(dirname)
|
326
326
|
|
327
|
-
|
328
|
-
|
329
|
-
permissions = 0600 & (~File.umask)
|
327
|
+
permissions = 0o600 & (~File.umask)
|
330
328
|
File.open(credentials_path, "w", permissions) do |f|
|
331
|
-
f.write config
|
329
|
+
f.write self.class.dump_with_rubygems_yaml(config)
|
332
330
|
end
|
333
331
|
|
334
332
|
load_api_keys # reload
|
@@ -344,20 +342,18 @@ if you believe they were disclosed to a third party.
|
|
344
342
|
end
|
345
343
|
|
346
344
|
def load_file(filename)
|
347
|
-
Gem.load_yaml
|
348
|
-
|
349
345
|
yaml_errors = [ArgumentError]
|
350
|
-
yaml_errors << Psych::SyntaxError if defined?(Psych::SyntaxError)
|
351
346
|
|
352
347
|
return {} unless filename && !filename.empty? && File.exist?(filename)
|
353
348
|
|
354
349
|
begin
|
355
|
-
|
356
|
-
|
350
|
+
config = self.class.load_with_rubygems_config_hash(File.read(filename))
|
351
|
+
if config.keys.any? {|k| k.to_s.gsub(%r{https?:\/\/}, "").include?(": ") }
|
357
352
|
warn "Failed to load #{filename} because it doesn't contain valid YAML hash"
|
358
353
|
return {}
|
354
|
+
else
|
355
|
+
return config
|
359
356
|
end
|
360
|
-
return content
|
361
357
|
rescue *yaml_errors => e
|
362
358
|
warn "Failed to load #{filename}, #{e}"
|
363
359
|
rescue Errno::EACCES
|
@@ -483,11 +479,11 @@ if you believe they were disclosed to a third party.
|
|
483
479
|
|
484
480
|
@hash.each do |key, value|
|
485
481
|
key = key.to_s
|
486
|
-
next if key
|
482
|
+
next if key&.match?(re)
|
487
483
|
yaml_hash[key.to_s] = value
|
488
484
|
end
|
489
485
|
|
490
|
-
yaml_hash
|
486
|
+
self.class.dump_with_rubygems_yaml(yaml_hash)
|
491
487
|
end
|
492
488
|
|
493
489
|
# Writes out this config file, replacing its source.
|
@@ -522,6 +518,57 @@ if you believe they were disclosed to a third party.
|
|
522
518
|
attr_reader :hash
|
523
519
|
protected :hash
|
524
520
|
|
521
|
+
def self.dump_with_rubygems_yaml(content)
|
522
|
+
content.transform_keys! do |k|
|
523
|
+
k.is_a?(Symbol) ? ":#{k}" : k
|
524
|
+
end
|
525
|
+
|
526
|
+
require_relative "yaml_serializer"
|
527
|
+
Gem::YAMLSerializer.dump(content)
|
528
|
+
end
|
529
|
+
|
530
|
+
def self.load_with_rubygems_config_hash(yaml)
|
531
|
+
require_relative "yaml_serializer"
|
532
|
+
|
533
|
+
content = Gem::YAMLSerializer.load(yaml)
|
534
|
+
|
535
|
+
content.transform_keys! do |k|
|
536
|
+
if k.match?(/\A:(.*)\Z/)
|
537
|
+
k[1..-1].to_sym
|
538
|
+
elsif k.include?("__") || k.match?(%r{/\Z})
|
539
|
+
if k.is_a?(Symbol)
|
540
|
+
k.to_s.gsub(/__/,".").gsub(%r{/\Z}, "").to_sym
|
541
|
+
else
|
542
|
+
k.dup.gsub(/__/,".").gsub(%r{/\Z}, "")
|
543
|
+
end
|
544
|
+
else
|
545
|
+
k
|
546
|
+
end
|
547
|
+
end
|
548
|
+
|
549
|
+
content.transform_values! do |v|
|
550
|
+
if v.is_a?(String)
|
551
|
+
if v.match?(/\A:(.*)\Z/)
|
552
|
+
v[1..-1].to_sym
|
553
|
+
elsif v.match?(/\A[+-]?\d+\Z/)
|
554
|
+
v.to_i
|
555
|
+
elsif v.match?(/\Atrue|false\Z/)
|
556
|
+
v == "true"
|
557
|
+
elsif v.empty?
|
558
|
+
nil
|
559
|
+
else
|
560
|
+
v
|
561
|
+
end
|
562
|
+
elsif v.is_a?(Hash) && v.empty?
|
563
|
+
nil
|
564
|
+
else
|
565
|
+
v
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
569
|
+
content
|
570
|
+
end
|
571
|
+
|
525
572
|
private
|
526
573
|
|
527
574
|
def set_config_file_name(args)
|
@@ -534,7 +581,7 @@ if you believe they were disclosed to a third party.
|
|
534
581
|
need_config_file_name = false
|
535
582
|
elsif arg =~ /^--config-file=(.*)/
|
536
583
|
@config_file_name = $1
|
537
|
-
elsif
|
584
|
+
elsif /^--config-file$/.match?(arg)
|
538
585
|
need_config_file_name = true
|
539
586
|
end
|
540
587
|
end
|
@@ -39,7 +39,7 @@ module Kernel
|
|
39
39
|
|
40
40
|
if gem_name.is_a? Gem::Dependency
|
41
41
|
unless Gem::Deprecate.skip
|
42
|
-
warn "#{Gem.location_of_caller.join
|
42
|
+
warn "#{Gem.location_of_caller.join ":"}:Warning: Kernel.gem no longer "\
|
43
43
|
"accepts a Gem::Dependency object, please pass the name "\
|
44
44
|
"and requirements directly"
|
45
45
|
end
|
@@ -128,7 +128,7 @@ module Kernel
|
|
128
128
|
|
129
129
|
if names.size > 1
|
130
130
|
RUBYGEMS_ACTIVATION_MONITOR.exit
|
131
|
-
raise Gem::LoadError, "#{path} found in multiple gems: #{names.join
|
131
|
+
raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ", "}"
|
132
132
|
end
|
133
133
|
|
134
134
|
# Ok, now find a gem that has no conflicts, starting
|
@@ -146,7 +146,7 @@ module Kernel
|
|
146
146
|
end
|
147
147
|
|
148
148
|
RUBYGEMS_ACTIVATION_MONITOR.exit
|
149
|
-
|
149
|
+
gem_original_require(path)
|
150
150
|
rescue LoadError => load_error
|
151
151
|
if load_error.path == path
|
152
152
|
RUBYGEMS_ACTIVATION_MONITOR.enter
|
data/lib/rubygems/defaults.rb
CHANGED
@@ -80,7 +80,7 @@ module Gem
|
|
80
80
|
|
81
81
|
def self.find_home
|
82
82
|
Dir.home.dup
|
83
|
-
rescue
|
83
|
+
rescue StandardError
|
84
84
|
if Gem.win_platform?
|
85
85
|
File.expand_path File.join(ENV["HOMEDRIVE"] || ENV["SystemDrive"], "/")
|
86
86
|
else
|
@@ -184,7 +184,11 @@ module Gem
|
|
184
184
|
# Deduce Ruby's --program-prefix and --program-suffix from its install name
|
185
185
|
|
186
186
|
def self.default_exec_format
|
187
|
-
exec_format =
|
187
|
+
exec_format = begin
|
188
|
+
RbConfig::CONFIG["ruby_install_name"].sub("ruby", "%s")
|
189
|
+
rescue StandardError
|
190
|
+
"%s"
|
191
|
+
end
|
188
192
|
|
189
193
|
unless exec_format.include?("%s")
|
190
194
|
raise Gem::Exception,
|
@@ -19,12 +19,12 @@ class Gem::DependencyInstaller
|
|
19
19
|
DEFAULT_OPTIONS = { # :nodoc:
|
20
20
|
:env_shebang => false,
|
21
21
|
:document => %w[ri],
|
22
|
-
:domain => :both, # HACK dup
|
22
|
+
:domain => :both, # HACK: dup
|
23
23
|
:force => false,
|
24
|
-
:format_executable => false, # HACK dup
|
24
|
+
:format_executable => false, # HACK: dup
|
25
25
|
:ignore_dependencies => false,
|
26
26
|
:prerelease => false,
|
27
|
-
:security_policy => nil, # HACK NoSecurity requires OpenSSL. AlmostNo? Low?
|
27
|
+
:security_policy => nil, # HACK: NoSecurity requires OpenSSL. AlmostNo? Low?
|
28
28
|
:wrappers => true,
|
29
29
|
:build_args => nil,
|
30
30
|
:build_docs_in_background => false,
|
@@ -292,7 +292,7 @@ class Gem::DependencyInstaller
|
|
292
292
|
src = Gem::Source::SpecificFile.new dep_or_name
|
293
293
|
installer_set.add_local dep_or_name, src.spec, src
|
294
294
|
version = src.spec.version if version == Gem::Requirement.default
|
295
|
-
elsif dep_or_name =~ /\.gem$/
|
295
|
+
elsif dep_or_name =~ /\.gem$/ # rubocop:disable Performance/RegexpMatch
|
296
296
|
Dir[dep_or_name].each do |name|
|
297
297
|
src = Gem::Source::SpecificFile.new name
|
298
298
|
installer_set.add_local dep_or_name, src.spec, src
|
data/lib/rubygems/deprecate.rb
CHANGED
@@ -83,7 +83,8 @@ module Gem::Deprecate
|
|
83
83
|
# Temporarily turn off warnings. Intended for tests only.
|
84
84
|
|
85
85
|
def skip_during
|
86
|
-
|
86
|
+
original = Gem::Deprecate.skip
|
87
|
+
Gem::Deprecate.skip = true
|
87
88
|
yield
|
88
89
|
ensure
|
89
90
|
Gem::Deprecate.skip = original
|
data/lib/rubygems/doctor.rb
CHANGED
@@ -33,7 +33,7 @@ class Gem::Doctor
|
|
33
33
|
Gem::REPOSITORY_SUBDIRECTORIES.sort -
|
34
34
|
REPOSITORY_EXTENSION_MAP.map {|(k,_)| k }.sort
|
35
35
|
|
36
|
-
raise "Update REPOSITORY_EXTENSION_MAP, missing: #{missing.join
|
36
|
+
raise "Update REPOSITORY_EXTENSION_MAP, missing: #{missing.join ", "}" unless
|
37
37
|
missing.empty?
|
38
38
|
|
39
39
|
##
|
@@ -111,7 +111,7 @@ class Gem::Doctor
|
|
111
111
|
|
112
112
|
basename = File.basename(child, extension)
|
113
113
|
next if installed_specs.include? basename
|
114
|
-
next if /^rubygems-\d
|
114
|
+
next if /^rubygems-\d/.match?(basename)
|
115
115
|
next if "specifications" == sub_directory && "default" == basename
|
116
116
|
next if "plugins" == sub_directory && Gem.plugin_suffix_regexp =~ (basename)
|
117
117
|
|
data/lib/rubygems/errors.rb
CHANGED
data/lib/rubygems/exceptions.rb
CHANGED
@@ -264,7 +264,7 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
|
|
264
264
|
def initialize(dep, platform_mismatch=nil)
|
265
265
|
if platform_mismatch && !platform_mismatch.empty?
|
266
266
|
plats = platform_mismatch.map {|x| x.platform.to_s }.sort.uniq
|
267
|
-
super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(
|
267
|
+
super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(", ")}"
|
268
268
|
else
|
269
269
|
if dep.explicit?
|
270
270
|
super "Unable to resolve dependency: user requested '#{dep}'"
|
data/lib/rubygems/ext/builder.rb
CHANGED
@@ -77,7 +77,8 @@ class Gem::Ext::Builder
|
|
77
77
|
verbose = Gem.configuration.really_verbose
|
78
78
|
|
79
79
|
begin
|
80
|
-
rubygems_gemdeps
|
80
|
+
rubygems_gemdeps = ENV["RUBYGEMS_GEMDEPS"]
|
81
|
+
ENV["RUBYGEMS_GEMDEPS"] = nil
|
81
82
|
if verbose
|
82
83
|
puts("current directory: #{dir}")
|
83
84
|
p(command)
|
@@ -90,7 +91,7 @@ class Gem::Ext::Builder
|
|
90
91
|
build_env = { "SOURCE_DATE_EPOCH" => Gem.source_date_epoch_string }.merge(env)
|
91
92
|
output, status = begin
|
92
93
|
Open3.capture2e(build_env, *command, :chdir => dir)
|
93
|
-
rescue => error
|
94
|
+
rescue StandardError => error
|
94
95
|
raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
|
95
96
|
end
|
96
97
|
if verbose
|
@@ -190,7 +191,7 @@ EOF
|
|
190
191
|
verbose { results.join("\n") }
|
191
192
|
|
192
193
|
write_gem_make_out results.join "\n"
|
193
|
-
rescue => e
|
194
|
+
rescue StandardError => e
|
194
195
|
results << e.message
|
195
196
|
build_error(results.join("\n"), $@)
|
196
197
|
end
|
@@ -206,7 +207,7 @@ EOF
|
|
206
207
|
if @build_args.empty?
|
207
208
|
say "Building native extensions. This could take a while..."
|
208
209
|
else
|
209
|
-
say "Building native extensions with: '#{@build_args.join
|
210
|
+
say "Building native extensions with: '#{@build_args.join " "}'"
|
210
211
|
say "This could take a while..."
|
211
212
|
end
|
212
213
|
|
@@ -199,7 +199,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|
199
199
|
output, status =
|
200
200
|
begin
|
201
201
|
Open3.capture2e(cargo, "metadata", "--no-deps", "--format-version", "1", :chdir => cargo_dir)
|
202
|
-
rescue => error
|
202
|
+
rescue StandardError => error
|
203
203
|
raise Gem::InstallError, "cargo metadata failed #{error.message}"
|
204
204
|
end
|
205
205
|
|
@@ -313,7 +313,7 @@ EOF
|
|
313
313
|
deffile_path
|
314
314
|
end
|
315
315
|
|
316
|
-
# We have to basically reimplement RbConfig::CONFIG['SOEXT'] here to support
|
316
|
+
# We have to basically reimplement <code>RbConfig::CONFIG['SOEXT']</code> here to support
|
317
317
|
# Ruby < 2.5
|
318
318
|
#
|
319
319
|
# @see https://github.com/ruby/ruby/blob/c87c027f18c005460746a74c07cd80ee355b16e4/configure.ac#L3185
|
@@ -43,7 +43,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
43
43
|
|
44
44
|
full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
|
45
45
|
|
46
|
-
# TODO remove in RubyGems 4
|
46
|
+
# TODO: remove in RubyGems 4
|
47
47
|
if Gem.install_extension_in_lib && lib_dir
|
48
48
|
FileUtils.mkdir_p lib_dir
|
49
49
|
entries = Dir.entries(full_tmp_dest) - %w[. ..]
|
@@ -10,7 +10,7 @@ require_relative "../shellwords"
|
|
10
10
|
|
11
11
|
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
12
12
|
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd)
|
13
|
-
if File.basename(extension)
|
13
|
+
if /mkrf_conf/i.match?(File.basename(extension))
|
14
14
|
run([Gem.ruby, File.basename(extension), *args], results, class_name, extension_dir)
|
15
15
|
end
|
16
16
|
|
data/lib/rubygems/gem_runner.rb
CHANGED
@@ -216,7 +216,7 @@ module Gem::GemcutterUtilities
|
|
216
216
|
say clean_text(response.body)
|
217
217
|
end
|
218
218
|
when Net::HTTPPermanentRedirect, Net::HTTPRedirection then
|
219
|
-
message = "The request has redirected permanently to #{response[
|
219
|
+
message = "The request has redirected permanently to #{response["location"]}. Please check your defined push host URL."
|
220
220
|
message = "#{error_prefix}: #{message}" if error_prefix
|
221
221
|
|
222
222
|
say clean_text(message)
|
@@ -338,7 +338,7 @@ module Gem::GemcutterUtilities
|
|
338
338
|
end
|
339
339
|
|
340
340
|
with_response response do |resp|
|
341
|
-
Gem::
|
341
|
+
Gem::ConfigFile.load_with_rubygems_config_hash(clean_text(resp.body))
|
342
342
|
end
|
343
343
|
end
|
344
344
|
|
data/lib/rubygems/indexer.rb
CHANGED
@@ -142,7 +142,7 @@ module Gem::InstallUpdateOptions
|
|
142
142
|
end unless v
|
143
143
|
|
144
144
|
unless v
|
145
|
-
message = v ? v : "(tried #{Gem::GEM_DEP_FILES.join
|
145
|
+
message = v ? v : "(tried #{Gem::GEM_DEP_FILES.join ", "})"
|
146
146
|
|
147
147
|
raise Gem::OptionParser::InvalidArgument,
|
148
148
|
"cannot find gem dependencies file #{message}"
|
data/lib/rubygems/installer.rb
CHANGED
@@ -230,11 +230,11 @@ class Gem::Installer
|
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
|
-
next unless line
|
233
|
+
next unless line&.match?(shebang)
|
234
234
|
|
235
235
|
io.gets # blankline
|
236
236
|
|
237
|
-
# TODO detect a specially formatted comment instead of trying
|
237
|
+
# TODO: detect a specially formatted comment instead of trying
|
238
238
|
# to find a string inside Ruby code.
|
239
239
|
next unless io.gets.to_s.include?("This file was generated by RubyGems")
|
240
240
|
|
@@ -316,7 +316,7 @@ class Gem::Installer
|
|
316
316
|
FileUtils.rm_rf spec.extension_dir
|
317
317
|
|
318
318
|
dir_mode = options[:dir_mode]
|
319
|
-
FileUtils.mkdir_p gem_dir, :mode => dir_mode &&
|
319
|
+
FileUtils.mkdir_p gem_dir, :mode => dir_mode && 0o755
|
320
320
|
|
321
321
|
if @options[:install_as_default]
|
322
322
|
extract_bin
|
@@ -348,11 +348,6 @@ class Gem::Installer
|
|
348
348
|
run_post_install_hooks
|
349
349
|
|
350
350
|
spec
|
351
|
-
|
352
|
-
# TODO This rescue is in the wrong place. What is raising this exception?
|
353
|
-
# move this rescue to around the code that actually might raise it.
|
354
|
-
rescue Zlib::GzipFile::Error
|
355
|
-
raise Gem::InstallError, "gzip error installing #{gem}"
|
356
351
|
end
|
357
352
|
|
358
353
|
def run_pre_install_hooks # :nodoc:
|
@@ -494,7 +489,7 @@ class Gem::Installer
|
|
494
489
|
next unless File.exist? bin_path
|
495
490
|
|
496
491
|
mode = File.stat(bin_path).mode
|
497
|
-
dir_mode = options[:prog_mode] || (mode |
|
492
|
+
dir_mode = options[:prog_mode] || (mode | 0o111)
|
498
493
|
|
499
494
|
unless dir_mode == mode
|
500
495
|
require "fileutils"
|
@@ -537,9 +532,9 @@ class Gem::Installer
|
|
537
532
|
require "fileutils"
|
538
533
|
FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
|
539
534
|
|
540
|
-
File.open bin_script_path, "wb",
|
535
|
+
File.open bin_script_path, "wb", 0o755 do |file|
|
541
536
|
file.print app_script_text(filename)
|
542
|
-
file.chmod(options[:prog_mode] ||
|
537
|
+
file.chmod(options[:prog_mode] || 0o755)
|
543
538
|
end
|
544
539
|
|
545
540
|
verbose bin_script_path
|
@@ -709,12 +704,12 @@ class Gem::Installer
|
|
709
704
|
end
|
710
705
|
|
711
706
|
def verify_gem_home # :nodoc:
|
712
|
-
FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] &&
|
707
|
+
FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] && 0o755
|
713
708
|
raise Gem::FilePermissionError, gem_home unless File.writable?(gem_home)
|
714
709
|
end
|
715
710
|
|
716
711
|
def verify_spec
|
717
|
-
unless
|
712
|
+
unless Gem::Specification::VALID_NAME_PATTERN.match?(spec.name)
|
718
713
|
raise Gem::InstallError, "#{spec} has an invalid name"
|
719
714
|
end
|
720
715
|
|
@@ -726,11 +721,11 @@ class Gem::Installer
|
|
726
721
|
raise Gem::InstallError, "#{spec} has an invalid extensions"
|
727
722
|
end
|
728
723
|
|
729
|
-
if spec.platform.to_s
|
724
|
+
if /\R/.match?(spec.platform.to_s)
|
730
725
|
raise Gem::InstallError, "#{spec.platform} is an invalid platform"
|
731
726
|
end
|
732
727
|
|
733
|
-
unless
|
728
|
+
unless /\A\d+\z/.match?(spec.specification_version.to_s)
|
734
729
|
raise Gem::InstallError, "#{spec} has an invalid specification_version"
|
735
730
|
end
|
736
731
|
|
@@ -747,9 +742,9 @@ class Gem::Installer
|
|
747
742
|
# Return the text for an application file.
|
748
743
|
|
749
744
|
def app_script_text(bin_file_name)
|
750
|
-
#
|
745
|
+
# NOTE: that the `load` lines cannot be indented, as old RG versions match
|
751
746
|
# against the beginning of the line
|
752
|
-
|
747
|
+
<<-TEXT
|
753
748
|
#{shebang bin_file_name}
|
754
749
|
#
|
755
750
|
# This file was generated by RubyGems.
|
@@ -806,7 +801,7 @@ TEXT
|
|
806
801
|
rb_topdir = RbConfig::TOPDIR || File.dirname(rb_config["bindir"])
|
807
802
|
|
808
803
|
# get ruby executable file name from RbConfig
|
809
|
-
ruby_exe = "#{rb_config[
|
804
|
+
ruby_exe = "#{rb_config["RUBY_INSTALL_NAME"]}#{rb_config["EXEEXT"]}"
|
810
805
|
ruby_exe = "ruby.exe" if ruby_exe.empty?
|
811
806
|
|
812
807
|
if File.exist?(File.join bindir, ruby_exe)
|
@@ -931,7 +926,7 @@ TEXT
|
|
931
926
|
build_info_dir = File.join gem_home, "build_info"
|
932
927
|
|
933
928
|
dir_mode = options[:dir_mode]
|
934
|
-
FileUtils.mkdir_p build_info_dir, :mode => dir_mode &&
|
929
|
+
FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0o755
|
935
930
|
|
936
931
|
build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
|
937
932
|
|
@@ -954,7 +949,7 @@ TEXT
|
|
954
949
|
|
955
950
|
def ensure_writable_dir(dir) # :nodoc:
|
956
951
|
begin
|
957
|
-
Dir.mkdir dir, *[options[:dir_mode] &&
|
952
|
+
Dir.mkdir dir, *[options[:dir_mode] && 0o755].compact
|
958
953
|
rescue SystemCallError
|
959
954
|
raise unless File.directory? dir
|
960
955
|
end
|
@@ -105,7 +105,7 @@ module Gem::LocalRemoteOptions
|
|
105
105
|
|
106
106
|
add_option(:"Local/Remote", "-s", "--source URL", URI::HTTP,
|
107
107
|
"Append URL to list of remote gem sources") do |source, options|
|
108
|
-
source << "/"
|
108
|
+
source << "/" unless source.end_with?("/")
|
109
109
|
|
110
110
|
if options.delete :sources_cleared
|
111
111
|
Gem.sources = [source]
|
data/lib/rubygems/package/old.rb
CHANGED
@@ -78,7 +78,7 @@ class Gem::Package::Old < Gem::Package
|
|
78
78
|
|
79
79
|
FileUtils.rm_rf destination
|
80
80
|
|
81
|
-
FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode &&
|
81
|
+
FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0o755
|
82
82
|
|
83
83
|
File.open destination, "wb", file_mode(entry["mode"]) do |out|
|
84
84
|
out.write file_data
|
@@ -125,7 +125,7 @@ class Gem::Package::TarHeader
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def self.strict_oct(str)
|
128
|
-
return str.strip.oct if
|
128
|
+
return str.strip.oct if /\A[0-7]*\z/.match?(str.strip)
|
129
129
|
|
130
130
|
raise ArgumentError, "#{str.inspect} is not an octal string"
|
131
131
|
end
|
@@ -135,7 +135,7 @@ class Gem::Package::TarHeader
|
|
135
135
|
# \ff flags a negative 256-based number
|
136
136
|
# In case we have a match, parse it as a signed binary value
|
137
137
|
# in big-endian order, except that the high-order bit is ignored.
|
138
|
-
return str.unpack("N2").last if
|
138
|
+
return str.unpack("N2").last if /\A[\x80\xff]/n.match?(str)
|
139
139
|
strict_oct(str)
|
140
140
|
end
|
141
141
|
|
@@ -50,7 +50,14 @@ class Gem::Package::TarReader
|
|
50
50
|
return enum_for __method__ unless block_given?
|
51
51
|
|
52
52
|
until @io.eof? do
|
53
|
-
|
53
|
+
begin
|
54
|
+
header = Gem::Package::TarHeader.from @io
|
55
|
+
rescue ArgumentError => e
|
56
|
+
# Specialize only exceptions from Gem::Package::TarHeader.strict_oct
|
57
|
+
raise e unless e.message.match?(/ is not an octal string$/)
|
58
|
+
raise Gem::Package::TarInvalidError, e.message
|
59
|
+
end
|
60
|
+
|
54
61
|
return if header.empty?
|
55
62
|
entry = Gem::Package::TarReader::Entry.new header, @io
|
56
63
|
yield entry
|
@@ -83,7 +90,7 @@ class Gem::Package::TarReader
|
|
83
90
|
|
84
91
|
return unless found
|
85
92
|
|
86
|
-
|
93
|
+
yield found
|
87
94
|
ensure
|
88
95
|
rewind
|
89
96
|
end
|
@@ -190,7 +190,7 @@ class Gem::Package::TarWriter
|
|
190
190
|
if signer.key
|
191
191
|
signature = signer.sign signature_digest.digest
|
192
192
|
|
193
|
-
add_file_simple "#{name}.sig",
|
193
|
+
add_file_simple "#{name}.sig", 0o444, signature.length do |io|
|
194
194
|
io.write signature
|
195
195
|
end
|
196
196
|
end
|
@@ -324,6 +324,6 @@ class Gem::Package::TarWriter
|
|
324
324
|
end
|
325
325
|
end
|
326
326
|
|
327
|
-
|
327
|
+
[name, prefix]
|
328
328
|
end
|
329
329
|
end
|