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
data/lib/rubygems/package.rb
CHANGED
@@ -187,7 +187,7 @@ class Gem::Package
|
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
190
|
-
|
190
|
+
[spec, metadata]
|
191
191
|
end
|
192
192
|
|
193
193
|
##
|
@@ -230,7 +230,7 @@ class Gem::Package
|
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
|
-
tar.add_file_signed "checksums.yaml.gz",
|
233
|
+
tar.add_file_signed "checksums.yaml.gz", 0o444, @signer do |io|
|
234
234
|
gzip_to io do |gz_io|
|
235
235
|
Psych.dump checksums_by_algorithm, gz_io
|
236
236
|
end
|
@@ -242,7 +242,7 @@ class Gem::Package
|
|
242
242
|
# and adds this file to the +tar+.
|
243
243
|
|
244
244
|
def add_contents(tar) # :nodoc:
|
245
|
-
digests = tar.add_file_signed "data.tar.gz",
|
245
|
+
digests = tar.add_file_signed "data.tar.gz", 0o444, @signer do |io|
|
246
246
|
gzip_to io do |gz_io|
|
247
247
|
Gem::Package::TarWriter.new gz_io do |data_tar|
|
248
248
|
add_files data_tar
|
@@ -278,7 +278,7 @@ class Gem::Package
|
|
278
278
|
# Adds the package's Gem::Specification to the +tar+ file
|
279
279
|
|
280
280
|
def add_metadata(tar) # :nodoc:
|
281
|
-
digests = tar.add_file_signed "metadata.gz",
|
281
|
+
digests = tar.add_file_signed "metadata.gz", 0o444, @signer do |io|
|
282
282
|
gzip_to io do |gz_io|
|
283
283
|
gz_io.write @spec.to_yaml
|
284
284
|
end
|
@@ -384,7 +384,7 @@ EOM
|
|
384
384
|
def extract_files(destination_dir, pattern = "*")
|
385
385
|
verify unless @spec
|
386
386
|
|
387
|
-
FileUtils.mkdir_p destination_dir, :mode => dir_mode &&
|
387
|
+
FileUtils.mkdir_p destination_dir, :mode => dir_mode && 0o755
|
388
388
|
|
389
389
|
@gem.with_read_io do |io|
|
390
390
|
reader = Gem::Package::TarReader.new io
|
@@ -438,7 +438,7 @@ EOM
|
|
438
438
|
FileUtils.rm_rf destination
|
439
439
|
|
440
440
|
mkdir_options = {}
|
441
|
-
mkdir_options[:mode] = dir_mode ?
|
441
|
+
mkdir_options[:mode] = dir_mode ? 0o755 : (entry.header.mode if entry.directory?)
|
442
442
|
mkdir =
|
443
443
|
if entry.directory?
|
444
444
|
destination
|
@@ -474,7 +474,7 @@ EOM
|
|
474
474
|
end
|
475
475
|
|
476
476
|
def file_mode(mode) # :nodoc:
|
477
|
-
((mode &
|
477
|
+
((mode & 0o111).zero? ? data_mode : prog_mode) ||
|
478
478
|
# If we're not using one of the default modes, then we're going to fall
|
479
479
|
# back to the mode from the tarball. In this case we need to mask it down
|
480
480
|
# to fit into 2^16 bits (the maximum value for a mode in CRuby since it
|
@@ -676,7 +676,7 @@ EOM
|
|
676
676
|
when "data.tar.gz" then
|
677
677
|
verify_gz entry
|
678
678
|
end
|
679
|
-
rescue
|
679
|
+
rescue StandardError
|
680
680
|
warn "Exception while verifying #{@gem.path}"
|
681
681
|
raise
|
682
682
|
end
|
@@ -699,7 +699,7 @@ EOM
|
|
699
699
|
end
|
700
700
|
|
701
701
|
if (duplicates = @files.group_by {|f| f }.select {|k,v| v.size > 1 }.map(&:first)) && duplicates.any?
|
702
|
-
raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(
|
702
|
+
raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(", ")})"
|
703
703
|
end
|
704
704
|
end
|
705
705
|
|
@@ -53,7 +53,7 @@ class Gem::PathSupport
|
|
53
53
|
gem_path = gpaths.split(Gem.path_separator)
|
54
54
|
# Handle the path_separator being set to a regexp, which will cause
|
55
55
|
# end_with? to error
|
56
|
-
if
|
56
|
+
if /#{Gem.path_separator}\z/.match?(gpaths)
|
57
57
|
gem_path += default_path
|
58
58
|
end
|
59
59
|
|
data/lib/rubygems/platform.rb
CHANGED
@@ -13,9 +13,11 @@ class Gem::Platform
|
|
13
13
|
attr_accessor :cpu, :os, :version
|
14
14
|
|
15
15
|
def self.local
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
@local ||= begin
|
17
|
+
arch = RbConfig::CONFIG["arch"]
|
18
|
+
arch = "#{arch}_60" if /mswin(?:32|64)$/.match?(arch)
|
19
|
+
new(arch)
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
def self.match(platform)
|
@@ -37,7 +39,7 @@ class Gem::Platform
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def self.match_gem?(platform, gem_name)
|
40
|
-
#
|
42
|
+
# NOTE: this method might be redefined by Ruby implementations to
|
41
43
|
# customize behavior per RUBY_ENGINE, gem_name or other criteria.
|
42
44
|
match_platforms?(platform, Gem.platforms)
|
43
45
|
end
|
@@ -90,7 +92,10 @@ class Gem::Platform
|
|
90
92
|
end
|
91
93
|
|
92
94
|
os, = arch
|
93
|
-
|
95
|
+
if os.nil?
|
96
|
+
@cpu = nil
|
97
|
+
os = cpu
|
98
|
+
end # legacy jruby
|
94
99
|
|
95
100
|
@os, @version = case os
|
96
101
|
when /aix(\d+)?/ then [ "aix", $1 ]
|
@@ -107,7 +112,8 @@ class Gem::Platform
|
|
107
112
|
when /mingw32/ then [ "mingw32", nil ]
|
108
113
|
when /mingw-?(\w+)?/ then [ "mingw", $1 ]
|
109
114
|
when /(mswin\d+)(\_(\d+))?/ then
|
110
|
-
os
|
115
|
+
os = $1
|
116
|
+
version = $3
|
111
117
|
@cpu = "x86" if @cpu.nil? && os =~ /32$/
|
112
118
|
[os, version]
|
113
119
|
when /netbsdelf/ then [ "netbsdelf", nil ]
|
data/lib/rubygems/query_utils.rb
CHANGED
@@ -264,7 +264,7 @@ module Gem::QueryUtils
|
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
|
-
entry << " (#{list.join
|
267
|
+
entry << " (#{list.join ", "})"
|
268
268
|
end
|
269
269
|
|
270
270
|
def make_entry(entry_tuples, platforms)
|
@@ -283,7 +283,7 @@ module Gem::QueryUtils
|
|
283
283
|
end
|
284
284
|
|
285
285
|
def spec_authors(entry, spec)
|
286
|
-
authors = "Author#{spec.authors.length > 1 ?
|
286
|
+
authors = "Author#{spec.authors.length > 1 ? "s" : ""}: ".dup
|
287
287
|
authors << spec.authors.join(", ")
|
288
288
|
entry << format_text(authors, 68, 4)
|
289
289
|
end
|
@@ -297,7 +297,7 @@ module Gem::QueryUtils
|
|
297
297
|
def spec_license(entry, spec)
|
298
298
|
return if spec.license.nil? || spec.license.empty?
|
299
299
|
|
300
|
-
licenses = "License#{spec.licenses.length > 1 ?
|
300
|
+
licenses = "License#{spec.licenses.length > 1 ? "s" : ""}: ".dup
|
301
301
|
licenses << spec.licenses.join(", ")
|
302
302
|
entry << "\n" << format_text(licenses, 68, 4)
|
303
303
|
end
|
@@ -328,7 +328,7 @@ module Gem::QueryUtils
|
|
328
328
|
|
329
329
|
if platforms.length == 1
|
330
330
|
title = platforms.values.length == 1 ? "Platform" : "Platforms"
|
331
|
-
entry << " #{title}: #{platforms.values.sort.join(
|
331
|
+
entry << " #{title}: #{platforms.values.sort.join(", ")}\n"
|
332
332
|
else
|
333
333
|
entry << " Platforms:\n"
|
334
334
|
|
@@ -125,14 +125,18 @@ class Gem::RemoteFetcher
|
|
125
125
|
local_gem_path = File.join cache_dir, gem_file_name
|
126
126
|
|
127
127
|
require "fileutils"
|
128
|
-
|
128
|
+
begin
|
129
|
+
FileUtils.mkdir_p cache_dir
|
130
|
+
rescue StandardError
|
131
|
+
nil
|
132
|
+
end unless File.exist? cache_dir
|
129
133
|
|
130
134
|
source_uri = Gem::Uri.new(source_uri)
|
131
135
|
|
132
136
|
scheme = source_uri.scheme
|
133
137
|
|
134
138
|
# URI.parse gets confused by MS Windows paths with forward slashes.
|
135
|
-
scheme = nil if
|
139
|
+
scheme = nil if /^[a-z]$/i.match?(scheme)
|
136
140
|
|
137
141
|
# REFACTOR: split this up and dispatch on scheme (eg download_http)
|
138
142
|
# REFACTOR: be sure to clean up fake fetcher when you do this... cleaner
|
@@ -170,7 +174,7 @@ class Gem::RemoteFetcher
|
|
170
174
|
end
|
171
175
|
|
172
176
|
verbose "Using local gem #{local_gem_path}"
|
173
|
-
when nil then # TODO test for local overriding cache
|
177
|
+
when nil then # TODO: test for local overriding cache
|
174
178
|
source_path = if Gem.win_platform? && source_uri.scheme &&
|
175
179
|
!source_uri.path.include?(":")
|
176
180
|
"#{source_uri.scheme}:#{source_uri.path}"
|
@@ -281,7 +285,11 @@ class Gem::RemoteFetcher
|
|
281
285
|
# passes the data.
|
282
286
|
|
283
287
|
def cache_update_path(uri, path = nil, update = true)
|
284
|
-
mtime =
|
288
|
+
mtime = begin
|
289
|
+
path && File.stat(path).mtime
|
290
|
+
rescue StandardError
|
291
|
+
nil
|
292
|
+
end
|
285
293
|
|
286
294
|
data = fetch_path(uri, mtime)
|
287
295
|
|
data/lib/rubygems/request.rb
CHANGED
@@ -238,7 +238,7 @@ class Gem::Request
|
|
238
238
|
verbose "fatal error"
|
239
239
|
|
240
240
|
raise Gem::RemoteFetcher::FetchError.new("fatal error", @uri)
|
241
|
-
# HACK work around EOFError bug in Net::HTTP
|
241
|
+
# HACK: work around EOFError bug in Net::HTTP
|
242
242
|
# NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible
|
243
243
|
# to install gems.
|
244
244
|
rescue EOFError, Timeout::Error,
|
data/lib/rubygems/request_set.rb
CHANGED
@@ -255,7 +255,8 @@ class Gem::RequestSet
|
|
255
255
|
end
|
256
256
|
|
257
257
|
def install_into(dir, force = true, options = {})
|
258
|
-
gem_home
|
258
|
+
gem_home = ENV["GEM_HOME"]
|
259
|
+
ENV["GEM_HOME"] = dir
|
259
260
|
|
260
261
|
existing = force ? [] : specs_in(dir)
|
261
262
|
existing.delete_if {|s| @always_install.include? s }
|
data/lib/rubygems/requirement.rb
CHANGED
@@ -22,7 +22,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
|
|
22
22
|
# Creates an APISpecification for the given +set+ from the rubygems.org
|
23
23
|
# +api_data+.
|
24
24
|
#
|
25
|
-
# See https://guides.rubygems.org/rubygems-org-api/#
|
25
|
+
# See https://guides.rubygems.org/rubygems-org-api/#misc-methods for the
|
26
26
|
# format of the +api_data+.
|
27
27
|
|
28
28
|
def initialize(set, api_data)
|
data/lib/rubygems/resolver.rb
CHANGED
@@ -145,7 +145,7 @@ class Gem::Resolver
|
|
145
145
|
activation_request =
|
146
146
|
Gem::Resolver::ActivationRequest.new spec, dep, possible
|
147
147
|
|
148
|
-
|
148
|
+
[spec, activation_request]
|
149
149
|
end
|
150
150
|
|
151
151
|
def requests(s, act, reqs=[]) # :nodoc:
|
@@ -213,7 +213,7 @@ class Gem::Resolver
|
|
213
213
|
|
214
214
|
matching_platform = select_local_platforms all
|
215
215
|
|
216
|
-
|
216
|
+
[matching_platform, all]
|
217
217
|
end
|
218
218
|
|
219
219
|
##
|
@@ -247,7 +247,7 @@ class Gem::Resolver
|
|
247
247
|
|
248
248
|
sources.each do |source|
|
249
249
|
groups[source].
|
250
|
-
sort_by {|spec| [spec.version, spec.platform =~ Gem::Platform.local ? 1 : 0] }.
|
250
|
+
sort_by {|spec| [spec.version, spec.platform =~ Gem::Platform.local ? 1 : 0] }. # rubocop:disable Performance/RegexpMatch
|
251
251
|
map {|spec| ActivationRequest.new spec, dependency }.
|
252
252
|
each {|activation_request| activation_requests << activation_request }
|
253
253
|
end
|
@@ -175,10 +175,18 @@ class Gem::Security::Signer
|
|
175
175
|
old_cert = @cert_chain.last
|
176
176
|
|
177
177
|
disk_cert_path = File.join(Gem.default_cert_path)
|
178
|
-
disk_cert =
|
178
|
+
disk_cert = begin
|
179
|
+
File.read(disk_cert_path)
|
180
|
+
rescue StandardError
|
181
|
+
nil
|
182
|
+
end
|
179
183
|
|
180
184
|
disk_key_path = File.join(Gem.default_key_path)
|
181
|
-
disk_key =
|
185
|
+
disk_key = begin
|
186
|
+
OpenSSL::PKey.read(File.read(disk_key_path), @passphrase)
|
187
|
+
rescue StandardError
|
188
|
+
nil
|
189
|
+
end
|
182
190
|
|
183
191
|
return unless disk_key
|
184
192
|
|
@@ -9,8 +9,8 @@ class Gem::Security::TrustDir
|
|
9
9
|
# Default permissions for the trust directory and its contents
|
10
10
|
|
11
11
|
DEFAULT_PERMISSIONS = {
|
12
|
-
:trust_dir =>
|
13
|
-
:trusted_cert =>
|
12
|
+
:trust_dir => 0o700,
|
13
|
+
:trusted_cert => 0o600,
|
14
14
|
}.freeze
|
15
15
|
|
16
16
|
##
|
@@ -49,7 +49,7 @@ class Gem::Security::TrustDir
|
|
49
49
|
|
50
50
|
yield certificate, certificate_file
|
51
51
|
rescue OpenSSL::X509::CertificateError
|
52
|
-
next # HACK warn
|
52
|
+
next # HACK: warn
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -91,7 +91,7 @@ class Gem::Security::TrustDir
|
|
91
91
|
|
92
92
|
destination = cert_path certificate
|
93
93
|
|
94
|
-
File.open destination, "wb",
|
94
|
+
File.open destination, "wb", 0o600 do |io|
|
95
95
|
io.write certificate.to_pem
|
96
96
|
io.chmod(@permissions[:trusted_cert])
|
97
97
|
end
|
@@ -109,7 +109,7 @@ class Gem::Security::TrustDir
|
|
109
109
|
"trust directory #{@dir} is not a directory" unless
|
110
110
|
File.directory? @dir
|
111
111
|
|
112
|
-
FileUtils.chmod
|
112
|
+
FileUtils.chmod 0o700, @dir
|
113
113
|
else
|
114
114
|
FileUtils.mkdir_p @dir, :mode => @permissions[:trust_dir]
|
115
115
|
end
|
data/lib/rubygems/security.rb
CHANGED
@@ -602,7 +602,7 @@ module Gem::Security
|
|
602
602
|
# +permissions+. If passed +cipher+ and +passphrase+ those arguments will be
|
603
603
|
# passed to +to_pem+.
|
604
604
|
|
605
|
-
def self.write(pemmable, path, permissions =
|
605
|
+
def self.write(pemmable, path, permissions = 0o600, passphrase = nil, cipher = KEY_CIPHER)
|
606
606
|
path = File.expand_path path
|
607
607
|
|
608
608
|
File.open path, "wb", permissions do |io|
|
@@ -29,7 +29,7 @@ module Gem::SecurityOption
|
|
29
29
|
policy = Gem::Security::Policies[value]
|
30
30
|
unless policy
|
31
31
|
valid = Gem::Security::Policies.keys.sort
|
32
|
-
raise Gem::OptionParser::InvalidArgument, "#{value} (#{valid.join
|
32
|
+
raise Gem::OptionParser::InvalidArgument, "#{value} (#{valid.join ", "} are valid)"
|
33
33
|
end
|
34
34
|
policy
|
35
35
|
end
|
@@ -42,10 +42,11 @@ class Gem::Source::Local < Gem::Source
|
|
42
42
|
|
43
43
|
Dir["*.gem"].each do |file|
|
44
44
|
pkg = Gem::Package.new(file)
|
45
|
+
spec = pkg.spec
|
45
46
|
rescue SystemCallError, Gem::Package::FormatError
|
46
47
|
# ignore
|
47
48
|
else
|
48
|
-
tup =
|
49
|
+
tup = spec.name_tuple
|
49
50
|
@specs[tup] = [File.expand_path(file), pkg]
|
50
51
|
|
51
52
|
case type
|
data/lib/rubygems/source.rb
CHANGED
@@ -137,7 +137,11 @@ class Gem::Source
|
|
137
137
|
|
138
138
|
if File.exist? local_spec
|
139
139
|
spec = Gem.read_binary local_spec
|
140
|
-
spec =
|
140
|
+
spec = begin
|
141
|
+
Marshal.load(spec)
|
142
|
+
rescue StandardError
|
143
|
+
nil
|
144
|
+
end
|
141
145
|
return spec if spec
|
142
146
|
end
|
143
147
|
|
data/lib/rubygems/source_list.rb
CHANGED
@@ -124,7 +124,7 @@ class Gem::SpecFetcher
|
|
124
124
|
|
125
125
|
tuples = tuples.sort_by {|x| x[0].version }
|
126
126
|
|
127
|
-
|
127
|
+
[tuples, errors]
|
128
128
|
end
|
129
129
|
|
130
130
|
##
|
@@ -162,7 +162,7 @@ class Gem::SpecFetcher
|
|
162
162
|
specs << [spec, source]
|
163
163
|
end
|
164
164
|
|
165
|
-
|
165
|
+
[specs, errors]
|
166
166
|
end
|
167
167
|
|
168
168
|
##
|
@@ -427,11 +427,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
427
427
|
end
|
428
428
|
|
429
429
|
##
|
430
|
-
# The path in the gem for executable scripts. Usually '
|
430
|
+
# The path in the gem for executable scripts. Usually 'exe'
|
431
431
|
#
|
432
432
|
# Usage:
|
433
433
|
#
|
434
|
-
# spec.bindir = '
|
434
|
+
# spec.bindir = 'exe'
|
435
435
|
|
436
436
|
attr_accessor :bindir
|
437
437
|
|
@@ -533,13 +533,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
533
533
|
|
534
534
|
attr_reader :required_rubygems_version
|
535
535
|
|
536
|
-
##
|
537
|
-
# The version of RubyGems used to create this gem.
|
538
|
-
#
|
539
|
-
# Do not set this, it is set automatically when the gem is packaged.
|
540
|
-
|
541
|
-
attr_accessor :rubygems_version
|
542
|
-
|
543
536
|
##
|
544
537
|
# The key used to sign this gem. See Gem::Security for details.
|
545
538
|
|
@@ -727,6 +720,21 @@ class Gem::Specification < Gem::BasicSpecification
|
|
727
720
|
@test_files = Array files
|
728
721
|
end
|
729
722
|
|
723
|
+
######################################################################
|
724
|
+
# :section: Read-only attributes
|
725
|
+
|
726
|
+
##
|
727
|
+
# The version of RubyGems used to create this gem.
|
728
|
+
|
729
|
+
attr_accessor :rubygems_version
|
730
|
+
|
731
|
+
##
|
732
|
+
# The path where this gem installs its extensions.
|
733
|
+
|
734
|
+
def extensions_dir
|
735
|
+
@extensions_dir ||= super
|
736
|
+
end
|
737
|
+
|
730
738
|
######################################################################
|
731
739
|
# :section: Specification internals
|
732
740
|
|
@@ -1449,7 +1457,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1449
1457
|
@activated = true
|
1450
1458
|
@loaded = true
|
1451
1459
|
|
1452
|
-
|
1460
|
+
true
|
1453
1461
|
end
|
1454
1462
|
|
1455
1463
|
##
|
@@ -1520,7 +1528,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1520
1528
|
def sanitize_string(string)
|
1521
1529
|
return string unless string
|
1522
1530
|
|
1523
|
-
# HACK the #to_s is in here because RSpec has an Array of Arrays of
|
1531
|
+
# HACK: the #to_s is in here because RSpec has an Array of Arrays of
|
1524
1532
|
# Strings for authors. Need a way to disallow bad values on gemspec
|
1525
1533
|
# generation. (Probably won't happen.)
|
1526
1534
|
string.to_s
|
@@ -1538,8 +1546,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1538
1546
|
else
|
1539
1547
|
executables
|
1540
1548
|
end
|
1541
|
-
rescue
|
1542
|
-
|
1549
|
+
rescue StandardError
|
1550
|
+
nil
|
1543
1551
|
end
|
1544
1552
|
|
1545
1553
|
##
|
@@ -2362,13 +2370,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2362
2370
|
when Array then "[" + obj.map {|x| ruby_code x }.join(", ") + "]"
|
2363
2371
|
when Hash then
|
2364
2372
|
seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
|
2365
|
-
"{ #{seg.join(
|
2366
|
-
when Gem::Version then obj.to_s
|
2373
|
+
"{ #{seg.join(", ")} }"
|
2374
|
+
when Gem::Version then ruby_code(obj.to_s)
|
2367
2375
|
when DateLike then obj.strftime("%Y-%m-%d").dump
|
2368
2376
|
when Time then obj.strftime("%Y-%m-%d").dump
|
2369
2377
|
when Numeric then obj.inspect
|
2370
2378
|
when true, false, nil then obj.inspect
|
2371
|
-
when Gem::Platform then "Gem::Platform.new(#{obj.to_a
|
2379
|
+
when Gem::Platform then "Gem::Platform.new(#{ruby_code obj.to_a})"
|
2372
2380
|
when Gem::Requirement then
|
2373
2381
|
list = obj.as_list
|
2374
2382
|
"Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})"
|
@@ -2398,8 +2406,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2398
2406
|
# Checks if this specification meets the requirement of +dependency+.
|
2399
2407
|
|
2400
2408
|
def satisfies_requirement?(dependency)
|
2401
|
-
|
2402
|
-
|
2409
|
+
@name == dependency.name &&
|
2410
|
+
dependency.requirement.satisfied_by?(@version)
|
2403
2411
|
end
|
2404
2412
|
|
2405
2413
|
##
|
@@ -2533,12 +2541,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2533
2541
|
end
|
2534
2542
|
|
2535
2543
|
if String === signing_key
|
2536
|
-
result << " s.signing_key = #{signing_key
|
2544
|
+
result << " s.signing_key = #{ruby_code signing_key}"
|
2537
2545
|
end
|
2538
2546
|
|
2539
2547
|
if @installed_by_version
|
2540
2548
|
result << nil
|
2541
|
-
result << " s.installed_by_version =
|
2549
|
+
result << " s.installed_by_version = #{ruby_code Gem::VERSION} if s.respond_to? :installed_by_version"
|
2542
2550
|
end
|
2543
2551
|
|
2544
2552
|
unless dependencies.empty?
|
@@ -2547,9 +2555,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2547
2555
|
result << nil
|
2548
2556
|
|
2549
2557
|
dependencies.each do |dep|
|
2550
|
-
req = dep.requirements_list.inspect
|
2551
2558
|
dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
|
2552
|
-
result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{
|
2559
|
+
result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{ruby_code dep.requirements_list})"
|
2553
2560
|
end
|
2554
2561
|
end
|
2555
2562
|
|
@@ -2686,7 +2693,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2686
2693
|
end
|
2687
2694
|
invalidate_memoized_attributes
|
2688
2695
|
|
2689
|
-
|
2696
|
+
@version
|
2690
2697
|
end
|
2691
2698
|
|
2692
2699
|
def stubbed?
|
@@ -144,7 +144,7 @@ class Gem::SpecificationPolicy
|
|
144
144
|
end
|
145
145
|
|
146
146
|
next unless METADATA_LINK_KEYS.include? key
|
147
|
-
|
147
|
+
unless VALID_URI_PATTERN.match?(value)
|
148
148
|
error "#{entry} has invalid link: #{value.inspect}"
|
149
149
|
end
|
150
150
|
end
|
@@ -214,7 +214,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
214
214
|
end
|
215
215
|
|
216
216
|
" if #{dep.name} is semantically versioned, use:\n" \
|
217
|
-
" add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join
|
217
|
+
" add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join "."}'#{bugfix}"
|
218
218
|
end
|
219
219
|
|
220
220
|
warning_messages << ["open-ended dependency on #{dep} is not recommended", recommendation].join("\n") + "\n"
|
@@ -234,7 +234,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
234
234
|
|
235
235
|
@specification.files.each do |file|
|
236
236
|
next unless File.file?(file)
|
237
|
-
next if File.stat(file).mode &
|
237
|
+
next if File.stat(file).mode & 0o444 == 0o444
|
238
238
|
warning "#{file} is not world-readable"
|
239
239
|
end
|
240
240
|
|
@@ -253,7 +253,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
253
253
|
@specification.instance_variable_get("@#{attrname}").nil?
|
254
254
|
end
|
255
255
|
return if nil_attributes.empty?
|
256
|
-
error "#{nil_attributes.join
|
256
|
+
error "#{nil_attributes.join ", "} must not be nil"
|
257
257
|
end
|
258
258
|
|
259
259
|
def validate_rubygems_version
|
@@ -279,11 +279,11 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
279
279
|
|
280
280
|
if !name.is_a?(String)
|
281
281
|
error "invalid value for attribute name: \"#{name.inspect}\" must be a string"
|
282
|
-
elsif
|
282
|
+
elsif !/[a-zA-Z]/.match?(name)
|
283
283
|
error "invalid value for attribute name: #{name.dump} must include at least one letter"
|
284
|
-
elsif name
|
284
|
+
elsif !VALID_NAME_PATTERN.match?(name)
|
285
285
|
error "invalid value for attribute name: #{name.dump} can only include letters, numbers, dashes, and underscores"
|
286
|
-
elsif name
|
286
|
+
elsif SPECIAL_CHARACTERS.match?(name)
|
287
287
|
error "invalid value for attribute name: #{name.dump} can not begin with a period, dash, or underscore"
|
288
288
|
end
|
289
289
|
end
|
@@ -300,7 +300,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
300
300
|
non_files = @specification.files.reject {|x| File.file?(x) || File.symlink?(x) }
|
301
301
|
|
302
302
|
unless non_files.empty?
|
303
|
-
error "[\"#{non_files.join "
|
303
|
+
error "[\"#{non_files.join '", "'}\"] are not files"
|
304
304
|
end
|
305
305
|
end
|
306
306
|
|
@@ -377,7 +377,7 @@ license value '#{license}' is invalid. Use a license identifier from
|
|
377
377
|
http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license,
|
378
378
|
or set it to nil if you don't want to specify a license.
|
379
379
|
WARNING
|
380
|
-
message += "Did you mean #{suggestions.map {|s| "'#{s}'" }.join(
|
380
|
+
message += "Did you mean #{suggestions.map {|s| "'#{s}'" }.join(", ")}?\n" unless suggestions.nil?
|
381
381
|
warning(message)
|
382
382
|
end
|
383
383
|
|
@@ -401,11 +401,11 @@ or set it to nil if you don't want to specify a license.
|
|
401
401
|
error "#{LAZY} is not an email"
|
402
402
|
end
|
403
403
|
|
404
|
-
if @specification.description
|
404
|
+
if LAZY_PATTERN.match?(@specification.description)
|
405
405
|
error "#{LAZY} is not a description"
|
406
406
|
end
|
407
407
|
|
408
|
-
if @specification.summary
|
408
|
+
if LAZY_PATTERN.match?(@specification.summary)
|
409
409
|
error "#{LAZY} is not a summary"
|
410
410
|
end
|
411
411
|
|