rubygems-update 3.7.2 → 4.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1413 -1323
- data/CODE_OF_CONDUCT.md +7 -129
- data/Manifest.txt +5 -11
- data/README.md +2 -2
- data/bundler/CHANGELOG.md +990 -917
- data/bundler/README.md +4 -4
- data/bundler/bundler.gemspec +3 -3
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/capistrano.rb +1 -19
- data/bundler/lib/bundler/cli/cache.rb +1 -11
- data/bundler/lib/bundler/cli/common.rb +20 -3
- data/bundler/lib/bundler/cli/config.rb +1 -2
- data/bundler/lib/bundler/cli/console.rb +5 -0
- data/bundler/lib/bundler/cli/exec.rb +29 -4
- data/bundler/lib/bundler/cli/gem.rb +19 -33
- data/bundler/lib/bundler/cli/install.rb +7 -82
- data/bundler/lib/bundler/cli/issue.rb +2 -2
- data/bundler/lib/bundler/cli/list.rb +33 -2
- data/bundler/lib/bundler/cli/plugin.rb +5 -1
- data/bundler/lib/bundler/cli/show.rb +1 -1
- data/bundler/lib/bundler/cli/update.rb +3 -3
- data/bundler/lib/bundler/cli.rb +75 -83
- data/bundler/lib/bundler/compact_index_client.rb +0 -1
- data/bundler/lib/bundler/current_ruby.rb +3 -15
- data/bundler/lib/bundler/definition.rb +45 -35
- data/bundler/lib/bundler/deployment.rb +1 -64
- data/bundler/lib/bundler/digest.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +13 -35
- data/bundler/lib/bundler/endpoint_specification.rb +0 -22
- data/bundler/lib/bundler/errors.rb +1 -5
- data/bundler/lib/bundler/feature_flag.rb +0 -33
- data/bundler/lib/bundler/fetcher/compact_index.rb +1 -1
- data/bundler/lib/bundler/friendly_errors.rb +2 -2
- data/bundler/lib/bundler/index.rb +0 -7
- data/bundler/lib/bundler/inline.rb +1 -1
- data/bundler/lib/bundler/installer/gem_installer.rb +0 -11
- data/bundler/lib/bundler/installer.rb +0 -6
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/lockfile_parser.rb +2 -12
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +3 -6
- data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
- data/bundler/lib/bundler/man/bundle-cache.1 +2 -14
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +1 -14
- data/bundler/lib/bundler/man/bundle-check.1 +2 -5
- data/bundler/lib/bundler/man/bundle-check.1.ronn +0 -5
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +6 -33
- data/bundler/lib/bundler/man/bundle-config.1.ronn +20 -55
- 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-env.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +2 -5
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +1 -5
- data/bundler/lib/bundler/man/bundle-fund.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +3 -6
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +2 -5
- 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-install.1 +8 -59
- data/bundler/lib/bundler/man/bundle-install.1.ronn +12 -107
- data/bundler/lib/bundler/man/bundle-issue.1 +1 -1
- data/bundler/lib/bundler/man/bundle-licenses.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1 +6 -1
- data/bundler/lib/bundler/man/bundle-list.1.ronn +5 -0
- 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 +2 -9
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +0 -8
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +2 -8
- data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -8
- data/bundler/lib/bundler/man/bundle-show.1 +2 -5
- data/bundler/lib/bundler/man/bundle-show.1.ronn +0 -4
- 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.1 +1 -10
- data/bundler/lib/bundler/man/bundle.1.ronn +0 -9
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/man/index.txt +0 -2
- data/bundler/lib/bundler/materialization.rb +1 -1
- data/bundler/lib/bundler/plugin/installer.rb +0 -10
- data/bundler/lib/bundler/plugin/source_list.rb +1 -1
- data/bundler/lib/bundler/plugin.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +1 -1
- data/bundler/lib/bundler/ruby_dsl.rb +2 -0
- data/bundler/lib/bundler/ruby_version.rb +1 -3
- data/bundler/lib/bundler/rubygems_ext.rb +1 -1
- data/bundler/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/bundler/lib/bundler/rubygems_integration.rb +1 -5
- data/bundler/lib/bundler/self_manager.rb +1 -1
- data/bundler/lib/bundler/settings.rb +7 -26
- data/bundler/lib/bundler/shared_helpers.rb +8 -20
- data/bundler/lib/bundler/source/git/git_proxy.rb +3 -11
- data/bundler/lib/bundler/source/git.rb +2 -3
- data/bundler/lib/bundler/source/path.rb +3 -7
- data/bundler/lib/bundler/source/rubygems.rb +11 -17
- data/bundler/lib/bundler/source.rb +1 -1
- data/bundler/lib/bundler/source_list.rb +4 -45
- data/bundler/lib/bundler/source_map.rb +2 -5
- data/bundler/lib/bundler/spec_set.rb +6 -15
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler/vlad.rb +1 -14
- data/bundler/lib/bundler.rb +6 -28
- data/doc/MAINTAINERS.txt +0 -7
- data/doc/bundler/UPGRADING.md +11 -5
- data/doc/rubygems/CONTRIBUTING.md +1 -1
- data/lib/rubygems/basic_specification.rb +3 -9
- data/lib/rubygems/bundler_version_finder.rb +1 -0
- data/lib/rubygems/command.rb +1 -1
- data/lib/rubygems/command_manager.rb +3 -4
- data/lib/rubygems/commands/build_command.rb +0 -7
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +1 -5
- data/lib/rubygems/commands/setup_command.rb +5 -3
- data/lib/rubygems/config_file.rb +1 -1
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/dependency_installer.rb +0 -77
- data/lib/rubygems/dependency_list.rb +1 -2
- data/lib/rubygems/deprecate.rb +74 -72
- data/lib/rubygems/doctor.rb +1 -1
- data/lib/rubygems/errors.rb +1 -1
- data/lib/rubygems/exceptions.rb +2 -3
- data/lib/rubygems/ext/builder.rb +6 -2
- data/lib/rubygems/ext/cargo_builder.rb +2 -2
- data/lib/rubygems/ext/cmake_builder.rb +97 -8
- data/lib/rubygems/ext/configure_builder.rb +2 -2
- data/lib/rubygems/ext/ext_conf_builder.rb +6 -2
- data/lib/rubygems/ext/rake_builder.rb +2 -2
- data/lib/rubygems/gem_runner.rb +0 -1
- data/lib/rubygems/install_update_options.rb +1 -2
- data/lib/rubygems/installer.rb +16 -54
- data/lib/rubygems/name_tuple.rb +7 -1
- data/lib/rubygems/package/tar_header.rb +4 -4
- data/lib/rubygems/package/tar_reader.rb +2 -0
- data/lib/rubygems/package/tar_writer.rb +1 -1
- data/lib/rubygems/package.rb +21 -12
- data/lib/rubygems/platform.rb +31 -11
- data/lib/rubygems/remote_fetcher.rb +8 -5
- data/lib/rubygems/resolver/conflict.rb +1 -1
- data/lib/rubygems/resolver.rb +1 -1
- data/lib/rubygems/security/signer.rb +1 -1
- data/lib/rubygems/source.rb +2 -2
- data/lib/rubygems/spec_fetcher.rb +4 -4
- data/lib/rubygems/specification.rb +5 -96
- data/lib/rubygems/specification_policy.rb +0 -36
- data/lib/rubygems/specification_record.rb +1 -1
- data/lib/rubygems/text.rb +1 -1
- data/lib/rubygems/uninstaller.rb +17 -6
- data/lib/rubygems/user_interaction.rb +6 -9
- data/lib/rubygems/util.rb +0 -22
- data/lib/rubygems/validator.rb +1 -1
- data/lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb +25 -9
- data/lib/rubygems/vendor/net-http/lib/net/http/responses.rb +2 -2
- data/lib/rubygems/vendor/net-http/lib/net/http.rb +14 -14
- data/lib/rubygems/vendor/optparse/lib/optparse.rb +82 -41
- data/lib/rubygems/vendor/resolv/lib/resolv.rb +1 -1
- data/lib/rubygems/vendor/timeout/lib/timeout.rb +4 -1
- data/lib/rubygems/vendor/uri/lib/uri/common.rb +57 -15
- data/lib/rubygems/vendor/uri/lib/uri/file.rb +1 -1
- data/lib/rubygems/vendor/uri/lib/uri/generic.rb +34 -21
- data/lib/rubygems/vendor/uri/lib/uri/http.rb +12 -0
- data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
- data/lib/rubygems/vendor/uri/lib/uri/version.rb +2 -2
- data/lib/rubygems/version.rb +2 -17
- data/lib/rubygems/win_platform.rb +31 -0
- data/lib/rubygems.rb +10 -38
- data/rubygems-update.gemspec +4 -4
- metadata +10 -18
- data/bundler/lib/bundler/cli/inject.rb +0 -60
- data/bundler/lib/bundler/cli/viz.rb +0 -31
- data/bundler/lib/bundler/graph.rb +0 -152
- data/bundler/lib/bundler/man/bundle-inject.1 +0 -31
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +0 -32
- data/bundler/lib/bundler/man/bundle-viz.1 +0 -30
- data/bundler/lib/bundler/man/bundle-viz.1.ronn +0 -36
- data/bundler/lib/bundler/similarity_detector.rb +0 -63
- data/lib/rubygems/commands/query_command.rb +0 -43
- data/lib/rubygems/compatibility.rb +0 -41
- data/lib/rubygems/install_default_message.rb +0 -13
|
@@ -1,21 +1,110 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# This builder creates extensions defined using CMake. Its is invoked if a Gem's spec file
|
|
4
|
+
# sets the `extension` property to a string that contains `CMakeLists.txt`.
|
|
5
|
+
#
|
|
6
|
+
# In general, CMake projects are built in two steps:
|
|
7
|
+
#
|
|
8
|
+
# * configure
|
|
9
|
+
# * build
|
|
10
|
+
#
|
|
11
|
+
# The builder follow this convention. First it runs a configuration step and then it runs a build step.
|
|
12
|
+
#
|
|
13
|
+
# CMake projects can be quite configurable - it is likely you will want to specify options when
|
|
14
|
+
# installing a gem. To pass options to CMake specify them after `--` in the gem install command. For example:
|
|
15
|
+
#
|
|
16
|
+
# gem install <gem_name> -- --preset <preset_name>
|
|
17
|
+
#
|
|
18
|
+
# Note that options are ONLY sent to the configure step - it is not currently possible to specify
|
|
19
|
+
# options for the build step. If this becomes and issue then the CMake builder can be updated to
|
|
20
|
+
# support build options.
|
|
21
|
+
#
|
|
22
|
+
# Useful options to know are:
|
|
23
|
+
#
|
|
24
|
+
# -G to specify a generator (-G Ninja is recommended)
|
|
25
|
+
# -D<CMAKE_VARIABLE> to set a CMake variable (for example -DCMAKE_BUILD_TYPE=Release)
|
|
26
|
+
# --preset <preset_name> to use a preset
|
|
27
|
+
#
|
|
28
|
+
# If the Gem author provides presets, via CMakePresets.json file, you will likely want to use one of them.
|
|
29
|
+
# If not, you may wish to specify a generator. Ninja is recommended because it can build projects in parallel
|
|
30
|
+
# and thus much faster than building them serially like Make does.
|
|
31
|
+
|
|
3
32
|
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
|
|
4
|
-
|
|
5
|
-
|
|
33
|
+
attr_accessor :runner, :profile
|
|
34
|
+
def initialize
|
|
35
|
+
@runner = self.class.method(:run)
|
|
36
|
+
@profile = :release
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def build(extension, dest_path, results, args = [], lib_dir = nil, cmake_dir = Dir.pwd,
|
|
40
|
+
target_rbconfig = Gem.target_rbconfig)
|
|
6
41
|
if target_rbconfig.path
|
|
7
42
|
warn "--target-rbconfig is not yet supported for CMake extensions. Ignoring"
|
|
8
43
|
end
|
|
9
44
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args]
|
|
45
|
+
# Figure the build dir
|
|
46
|
+
build_dir = File.join(cmake_dir, "build")
|
|
13
47
|
|
|
14
|
-
|
|
15
|
-
|
|
48
|
+
# Check if the gem defined presets
|
|
49
|
+
check_presets(cmake_dir, args, results)
|
|
50
|
+
|
|
51
|
+
# Configure
|
|
52
|
+
configure(cmake_dir, build_dir, dest_path, args, results)
|
|
16
53
|
|
|
17
|
-
|
|
54
|
+
# Compile
|
|
55
|
+
compile(cmake_dir, build_dir, args, results)
|
|
18
56
|
|
|
19
57
|
results
|
|
20
58
|
end
|
|
59
|
+
|
|
60
|
+
def configure(cmake_dir, build_dir, install_dir, args, results)
|
|
61
|
+
cmd = ["cmake",
|
|
62
|
+
cmake_dir,
|
|
63
|
+
"-B",
|
|
64
|
+
build_dir,
|
|
65
|
+
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=#{install_dir}", # Windows
|
|
66
|
+
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=#{install_dir}", # Not Windows
|
|
67
|
+
*Gem::Command.build_args,
|
|
68
|
+
*args]
|
|
69
|
+
|
|
70
|
+
runner.call(cmd, results, "cmake_configure", cmake_dir)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def compile(cmake_dir, build_dir, args, results)
|
|
74
|
+
cmd = ["cmake",
|
|
75
|
+
"--build",
|
|
76
|
+
build_dir.to_s,
|
|
77
|
+
"--config",
|
|
78
|
+
@profile.to_s]
|
|
79
|
+
|
|
80
|
+
runner.call(cmd, results, "cmake_compile", cmake_dir)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
def check_presets(cmake_dir, args, results)
|
|
86
|
+
# Return if the user specified a preset
|
|
87
|
+
return unless args.grep(/--preset/i).empty?
|
|
88
|
+
|
|
89
|
+
cmd = ["cmake",
|
|
90
|
+
"--list-presets"]
|
|
91
|
+
|
|
92
|
+
presets = Array.new
|
|
93
|
+
begin
|
|
94
|
+
runner.call(cmd, presets, "cmake_presets", cmake_dir)
|
|
95
|
+
|
|
96
|
+
# Remove the first two lines of the array which is the current_directory and the command
|
|
97
|
+
# that was run
|
|
98
|
+
presets = presets[2..].join
|
|
99
|
+
results << <<~EOS
|
|
100
|
+
The gem author provided a list of presets that can be used to build the gem. To use a preset specify it on the command line:
|
|
101
|
+
|
|
102
|
+
gem install <gem_name> -- --preset <preset_name>
|
|
103
|
+
|
|
104
|
+
#{presets}
|
|
105
|
+
EOS
|
|
106
|
+
rescue Gem::InstallError
|
|
107
|
+
# Do nothing, CMakePresets.json was not included in the Gem
|
|
108
|
+
end
|
|
109
|
+
end
|
|
21
110
|
end
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
#++
|
|
8
8
|
|
|
9
9
|
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
|
|
10
|
-
def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd,
|
|
11
|
-
target_rbconfig=Gem.target_rbconfig)
|
|
10
|
+
def self.build(extension, dest_path, results, args = [], lib_dir = nil, configure_dir = Dir.pwd,
|
|
11
|
+
target_rbconfig = Gem.target_rbconfig)
|
|
12
12
|
if target_rbconfig.path
|
|
13
13
|
warn "--target-rbconfig is not yet supported for configure-based extensions. Ignoring"
|
|
14
14
|
end
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
#++
|
|
8
8
|
|
|
9
9
|
class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
10
|
-
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd,
|
|
11
|
-
target_rbconfig=Gem.target_rbconfig)
|
|
10
|
+
def self.build(extension, dest_path, results, args = [], lib_dir = nil, extension_dir = Dir.pwd,
|
|
11
|
+
target_rbconfig = Gem.target_rbconfig)
|
|
12
12
|
require "fileutils"
|
|
13
13
|
require "tempfile"
|
|
14
14
|
|
|
@@ -66,6 +66,10 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
results
|
|
69
|
+
rescue Gem::Ext::Builder::NoMakefileError => error
|
|
70
|
+
results << error.message
|
|
71
|
+
results << "Skipping make for #{extension} as no Makefile was found."
|
|
72
|
+
# We are good, do not re-raise the error.
|
|
69
73
|
ensure
|
|
70
74
|
FileUtils.rm_rf tmp_dest if tmp_dest
|
|
71
75
|
end
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
#++
|
|
8
8
|
|
|
9
9
|
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
|
10
|
-
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd,
|
|
11
|
-
target_rbconfig=Gem.target_rbconfig)
|
|
10
|
+
def self.build(extension, dest_path, results, args = [], lib_dir = nil, extension_dir = Dir.pwd,
|
|
11
|
+
target_rbconfig = Gem.target_rbconfig)
|
|
12
12
|
if target_rbconfig.path
|
|
13
13
|
warn "--target-rbconfig is not yet supported for Rake extensions. Ignoring"
|
|
14
14
|
end
|
data/lib/rubygems/gem_runner.rb
CHANGED
|
@@ -158,10 +158,9 @@ module Gem::InstallUpdateOptions
|
|
|
158
158
|
options[:without_groups].concat v.map(&:intern)
|
|
159
159
|
end
|
|
160
160
|
|
|
161
|
-
add_option(:
|
|
161
|
+
add_option(:Deprecated, "--default",
|
|
162
162
|
"Add the gem's full specification to",
|
|
163
163
|
"specifications/default and extract only its bin") do |v,_o|
|
|
164
|
-
options[:install_as_default] = v
|
|
165
164
|
end
|
|
166
165
|
|
|
167
166
|
add_option(:"Install/Update", "--explain",
|
data/lib/rubygems/installer.rb
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
require_relative "installer_uninstaller_utils"
|
|
10
10
|
require_relative "exceptions"
|
|
11
|
-
require_relative "deprecate"
|
|
12
11
|
require_relative "package"
|
|
13
12
|
require_relative "ext"
|
|
14
13
|
require_relative "user_interaction"
|
|
@@ -27,8 +26,6 @@ require_relative "user_interaction"
|
|
|
27
26
|
# file. See Gem.pre_install and Gem.post_install for details.
|
|
28
27
|
|
|
29
28
|
class Gem::Installer
|
|
30
|
-
extend Gem::Deprecate
|
|
31
|
-
|
|
32
29
|
##
|
|
33
30
|
# Paths where env(1) might live. Some systems are broken and have it in
|
|
34
31
|
# /bin
|
|
@@ -67,23 +64,6 @@ class Gem::Installer
|
|
|
67
64
|
attr_reader :package
|
|
68
65
|
|
|
69
66
|
class << self
|
|
70
|
-
#
|
|
71
|
-
# Changes in rubygems to lazily loading `rubygems/command` (in order to
|
|
72
|
-
# lazily load `optparse` as a side effect) affect bundler's custom installer
|
|
73
|
-
# which uses `Gem::Command` without requiring it (up until bundler 2.2.29).
|
|
74
|
-
# This hook is to compensate for that missing require.
|
|
75
|
-
#
|
|
76
|
-
# TODO: Remove when rubygems no longer supports running on bundler older
|
|
77
|
-
# than 2.2.29.
|
|
78
|
-
|
|
79
|
-
def inherited(klass)
|
|
80
|
-
if klass.name == "Bundler::RubyGemsGemInstaller"
|
|
81
|
-
require "rubygems/command"
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
super(klass)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
67
|
##
|
|
88
68
|
# Overrides the executable format.
|
|
89
69
|
#
|
|
@@ -170,7 +150,7 @@ class Gem::Installer
|
|
|
170
150
|
# process. If not set, then Gem::Command.build_args is used
|
|
171
151
|
# :post_install_message:: Print gem post install message if true
|
|
172
152
|
|
|
173
|
-
def initialize(package, options={})
|
|
153
|
+
def initialize(package, options = {})
|
|
174
154
|
require "fileutils"
|
|
175
155
|
|
|
176
156
|
@options = options
|
|
@@ -291,11 +271,7 @@ class Gem::Installer
|
|
|
291
271
|
run_pre_install_hooks
|
|
292
272
|
|
|
293
273
|
# Set loaded_from to ensure extension_dir is correct
|
|
294
|
-
|
|
295
|
-
spec.loaded_from = default_spec_file
|
|
296
|
-
else
|
|
297
|
-
spec.loaded_from = spec_file
|
|
298
|
-
end
|
|
274
|
+
spec.loaded_from = spec_file
|
|
299
275
|
|
|
300
276
|
# Completely remove any previous gem files
|
|
301
277
|
FileUtils.rm_rf gem_dir
|
|
@@ -304,24 +280,17 @@ class Gem::Installer
|
|
|
304
280
|
dir_mode = options[:dir_mode]
|
|
305
281
|
FileUtils.mkdir_p gem_dir, mode: dir_mode && 0o755
|
|
306
282
|
|
|
307
|
-
|
|
308
|
-
extract_bin
|
|
309
|
-
write_default_spec
|
|
310
|
-
else
|
|
311
|
-
extract_files
|
|
283
|
+
extract_files
|
|
312
284
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
end
|
|
285
|
+
build_extensions
|
|
286
|
+
write_build_info_file
|
|
287
|
+
run_post_build_hooks
|
|
317
288
|
|
|
318
289
|
generate_bin
|
|
319
290
|
generate_plugins
|
|
320
291
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
write_cache_file
|
|
324
|
-
end
|
|
292
|
+
write_spec
|
|
293
|
+
write_cache_file
|
|
325
294
|
|
|
326
295
|
File.chmod(dir_mode, gem_dir) if dir_mode
|
|
327
296
|
|
|
@@ -409,15 +378,6 @@ class Gem::Installer
|
|
|
409
378
|
!dependency.matching_specs.empty?
|
|
410
379
|
end
|
|
411
380
|
|
|
412
|
-
##
|
|
413
|
-
# Unpacks the gem into the given directory.
|
|
414
|
-
|
|
415
|
-
def unpack(directory)
|
|
416
|
-
@gem_dir = directory
|
|
417
|
-
extract_files
|
|
418
|
-
end
|
|
419
|
-
rubygems_deprecate :unpack
|
|
420
|
-
|
|
421
381
|
##
|
|
422
382
|
# The location of the spec file that is installed.
|
|
423
383
|
#
|
|
@@ -426,12 +386,18 @@ class Gem::Installer
|
|
|
426
386
|
File.join gem_home, "specifications", "#{spec.full_name}.gemspec"
|
|
427
387
|
end
|
|
428
388
|
|
|
389
|
+
def default_spec_dir
|
|
390
|
+
dir = File.join(gem_home, "specifications", "default")
|
|
391
|
+
FileUtils.mkdir_p dir
|
|
392
|
+
dir
|
|
393
|
+
end
|
|
394
|
+
|
|
429
395
|
##
|
|
430
396
|
# The location of the default spec file for default gems.
|
|
431
397
|
#
|
|
432
398
|
|
|
433
399
|
def default_spec_file
|
|
434
|
-
File.join
|
|
400
|
+
File.join default_spec_dir, "#{spec.full_name}.gemspec"
|
|
435
401
|
end
|
|
436
402
|
|
|
437
403
|
##
|
|
@@ -906,11 +872,7 @@ class Gem::Installer
|
|
|
906
872
|
|
|
907
873
|
ensure_loadable_spec
|
|
908
874
|
|
|
909
|
-
|
|
910
|
-
Gem.ensure_default_gem_subdirectories gem_home
|
|
911
|
-
else
|
|
912
|
-
Gem.ensure_gem_subdirectories gem_home
|
|
913
|
-
end
|
|
875
|
+
Gem.ensure_gem_subdirectories gem_home
|
|
914
876
|
|
|
915
877
|
return true if @force
|
|
916
878
|
|
data/lib/rubygems/name_tuple.rb
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# wrap the data returned from the indexes.
|
|
7
7
|
|
|
8
8
|
class Gem::NameTuple
|
|
9
|
-
def initialize(name, version, platform=Gem::Platform::RUBY)
|
|
9
|
+
def initialize(name, version, platform = Gem::Platform::RUBY)
|
|
10
10
|
@name = name
|
|
11
11
|
@version = version
|
|
12
12
|
|
|
@@ -81,6 +81,12 @@ class Gem::NameTuple
|
|
|
81
81
|
[@name, @version, @platform]
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
+
alias_method :deconstruct, :to_a
|
|
85
|
+
|
|
86
|
+
def deconstruct_keys(keys)
|
|
87
|
+
{ name: @name, version: @version, platform: @platform }
|
|
88
|
+
end
|
|
89
|
+
|
|
84
90
|
def inspect # :nodoc:
|
|
85
91
|
"#<Gem::NameTuple #{@name}, #{@version}, #{@platform}>"
|
|
86
92
|
end
|
|
@@ -56,7 +56,7 @@ class Gem::Package::TarHeader
|
|
|
56
56
|
##
|
|
57
57
|
# Pack format for a tar header
|
|
58
58
|
|
|
59
|
-
PACK_FORMAT = "a100" + # name
|
|
59
|
+
PACK_FORMAT = ("a100" + # name
|
|
60
60
|
"a8" + # mode
|
|
61
61
|
"a8" + # uid
|
|
62
62
|
"a8" + # gid
|
|
@@ -71,12 +71,12 @@ class Gem::Package::TarHeader
|
|
|
71
71
|
"a32" + # gname
|
|
72
72
|
"a8" + # devmajor
|
|
73
73
|
"a8" + # devminor
|
|
74
|
-
"a155"
|
|
74
|
+
"a155").freeze # prefix
|
|
75
75
|
|
|
76
76
|
##
|
|
77
77
|
# Unpack format for a tar header
|
|
78
78
|
|
|
79
|
-
UNPACK_FORMAT = "A100" + # name
|
|
79
|
+
UNPACK_FORMAT = ("A100" + # name
|
|
80
80
|
"A8" + # mode
|
|
81
81
|
"A8" + # uid
|
|
82
82
|
"A8" + # gid
|
|
@@ -91,7 +91,7 @@ class Gem::Package::TarHeader
|
|
|
91
91
|
"A32" + # gname
|
|
92
92
|
"A8" + # devmajor
|
|
93
93
|
"A8" + # devminor
|
|
94
|
-
"A155"
|
|
94
|
+
"A155").freeze # prefix
|
|
95
95
|
|
|
96
96
|
attr_reader(*FIELDS)
|
|
97
97
|
|
|
@@ -99,7 +99,7 @@ class Gem::Package::TarWriter
|
|
|
99
99
|
# Gem.source_date_epoch if not specified), and yields an IO for
|
|
100
100
|
# writing the file to
|
|
101
101
|
|
|
102
|
-
def add_file(name, mode, mtime=nil) # :yields: io
|
|
102
|
+
def add_file(name, mode, mtime = nil) # :yields: io
|
|
103
103
|
check_closed
|
|
104
104
|
|
|
105
105
|
name, prefix = split_name name
|
data/lib/rubygems/package.rb
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
# rubocop:enable Style/AsciiComments
|
|
9
9
|
|
|
10
|
+
require_relative "win_platform"
|
|
10
11
|
require_relative "security"
|
|
11
12
|
require_relative "user_interaction"
|
|
12
13
|
|
|
@@ -267,7 +268,7 @@ class Gem::Package
|
|
|
267
268
|
|
|
268
269
|
tar.add_file_simple file, stat.mode, stat.size do |dst_io|
|
|
269
270
|
File.open file, "rb" do |src_io|
|
|
270
|
-
copy_stream(src_io, dst_io)
|
|
271
|
+
copy_stream(src_io, dst_io, stat.size)
|
|
271
272
|
end
|
|
272
273
|
end
|
|
273
274
|
end
|
|
@@ -436,8 +437,6 @@ EOM
|
|
|
436
437
|
symlinks << [full_name, link_target, destination, real_destination]
|
|
437
438
|
end
|
|
438
439
|
|
|
439
|
-
FileUtils.rm_rf destination
|
|
440
|
-
|
|
441
440
|
mkdir =
|
|
442
441
|
if entry.directory?
|
|
443
442
|
destination
|
|
@@ -451,8 +450,14 @@ EOM
|
|
|
451
450
|
end
|
|
452
451
|
|
|
453
452
|
if entry.file?
|
|
454
|
-
File.open(destination, "wb")
|
|
455
|
-
|
|
453
|
+
File.open(destination, "wb") do |out|
|
|
454
|
+
copy_stream(tar.io, out, entry.size)
|
|
455
|
+
# Flush needs to happen before chmod because there could be data
|
|
456
|
+
# in the IO buffer that needs to be written, and that could be
|
|
457
|
+
# written after the chmod (on close) which would mess up the perms
|
|
458
|
+
out.flush
|
|
459
|
+
out.chmod file_mode(entry.header.mode) & ~File.umask
|
|
460
|
+
end
|
|
456
461
|
end
|
|
457
462
|
|
|
458
463
|
verbose destination
|
|
@@ -514,10 +519,12 @@ EOM
|
|
|
514
519
|
destination
|
|
515
520
|
end
|
|
516
521
|
|
|
517
|
-
|
|
518
|
-
|
|
522
|
+
if Gem.win_platform?
|
|
523
|
+
def normalize_path(pathname) # :nodoc:
|
|
519
524
|
pathname.downcase
|
|
520
|
-
|
|
525
|
+
end
|
|
526
|
+
else
|
|
527
|
+
def normalize_path(pathname) # :nodoc:
|
|
521
528
|
pathname
|
|
522
529
|
end
|
|
523
530
|
end
|
|
@@ -635,6 +642,8 @@ EOM
|
|
|
635
642
|
raise Gem::Package::FormatError.new e.message, @gem
|
|
636
643
|
end
|
|
637
644
|
|
|
645
|
+
private
|
|
646
|
+
|
|
638
647
|
##
|
|
639
648
|
# Verifies the +checksums+ against the +digests+. This check is not
|
|
640
649
|
# cryptographically secure. Missing checksums are ignored.
|
|
@@ -715,12 +724,12 @@ EOM
|
|
|
715
724
|
end
|
|
716
725
|
|
|
717
726
|
if RUBY_ENGINE == "truffleruby"
|
|
718
|
-
def copy_stream(src, dst) # :nodoc:
|
|
719
|
-
dst.write src.read
|
|
727
|
+
def copy_stream(src, dst, size) # :nodoc:
|
|
728
|
+
dst.write src.read(size)
|
|
720
729
|
end
|
|
721
730
|
else
|
|
722
|
-
def copy_stream(src, dst) # :nodoc:
|
|
723
|
-
IO.copy_stream(src, dst)
|
|
731
|
+
def copy_stream(src, dst, size) # :nodoc:
|
|
732
|
+
IO.copy_stream(src, dst, size)
|
|
724
733
|
end
|
|
725
734
|
end
|
|
726
735
|
|
data/lib/rubygems/platform.rb
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "deprecate"
|
|
4
|
-
|
|
5
3
|
##
|
|
6
4
|
# Available list of platforms for targeting Gem installations.
|
|
7
5
|
#
|
|
@@ -21,15 +19,6 @@ class Gem::Platform
|
|
|
21
19
|
end
|
|
22
20
|
end
|
|
23
21
|
|
|
24
|
-
def self.match(platform)
|
|
25
|
-
match_platforms?(platform, Gem.platforms)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
class << self
|
|
29
|
-
extend Gem::Deprecate
|
|
30
|
-
rubygems_deprecate :match, "Gem::Platform.match_spec? or match_gem?"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
22
|
def self.match_platforms?(platform, platforms)
|
|
34
23
|
platform = Gem::Platform.new(platform) unless platform.is_a?(Gem::Platform)
|
|
35
24
|
platforms.any? do |local_platform|
|
|
@@ -146,6 +135,37 @@ class Gem::Platform
|
|
|
146
135
|
to_a.compact.join(@cpu.nil? ? "" : "-")
|
|
147
136
|
end
|
|
148
137
|
|
|
138
|
+
##
|
|
139
|
+
# Deconstructs the platform into an array for pattern matching.
|
|
140
|
+
# Returns [cpu, os, version].
|
|
141
|
+
#
|
|
142
|
+
# Gem::Platform.new("x86_64-linux").deconstruct #=> ["x86_64", "linux", nil]
|
|
143
|
+
#
|
|
144
|
+
# This enables array pattern matching:
|
|
145
|
+
#
|
|
146
|
+
# case Gem::Platform.new("arm64-darwin-21")
|
|
147
|
+
# in ["arm64", "darwin", version]
|
|
148
|
+
# # version => "21"
|
|
149
|
+
# end
|
|
150
|
+
alias_method :deconstruct, :to_a
|
|
151
|
+
|
|
152
|
+
##
|
|
153
|
+
# Deconstructs the platform into a hash for pattern matching.
|
|
154
|
+
# Returns a hash with keys +:cpu+, +:os+, and +:version+.
|
|
155
|
+
#
|
|
156
|
+
# Gem::Platform.new("x86_64-darwin-20").deconstruct_keys(nil)
|
|
157
|
+
# #=> { cpu: "x86_64", os: "darwin", version: "20" }
|
|
158
|
+
#
|
|
159
|
+
# This enables hash pattern matching:
|
|
160
|
+
#
|
|
161
|
+
# case Gem::Platform.new("x86_64-linux")
|
|
162
|
+
# in cpu: "x86_64", os: "linux"
|
|
163
|
+
# # Matches Linux on x86_64
|
|
164
|
+
# end
|
|
165
|
+
def deconstruct_keys(keys)
|
|
166
|
+
{ cpu: @cpu, os: @os, version: @version }
|
|
167
|
+
end
|
|
168
|
+
|
|
149
169
|
##
|
|
150
170
|
# Is +other+ equal to this platform? Two platforms are equal if they have
|
|
151
171
|
# the same CPU, OS and version.
|
|
@@ -72,7 +72,7 @@ class Gem::RemoteFetcher
|
|
|
72
72
|
# +headers+: A set of additional HTTP headers to be sent to the server when
|
|
73
73
|
# fetching the gem.
|
|
74
74
|
|
|
75
|
-
def initialize(proxy=nil, dns=nil, headers={})
|
|
75
|
+
def initialize(proxy = nil, dns = nil, headers = {})
|
|
76
76
|
require_relative "core_ext/tcpsocket_init" if Gem.configuration.ipv4_fallback_enabled
|
|
77
77
|
require_relative "vendored_net_http"
|
|
78
78
|
require_relative "vendor/uri/lib/uri"
|
|
@@ -245,11 +245,14 @@ class Gem::RemoteFetcher
|
|
|
245
245
|
def fetch_path(uri, mtime = nil, head = false)
|
|
246
246
|
uri = Gem::Uri.new uri
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
method = {
|
|
249
|
+
"http" => "fetch_http",
|
|
250
|
+
"https" => "fetch_http",
|
|
251
|
+
"s3" => "fetch_s3",
|
|
252
|
+
"file" => "fetch_file",
|
|
253
|
+
}.fetch(uri.scheme) { raise ArgumentError, "uri scheme is invalid: #{uri.scheme.inspect}" }
|
|
251
254
|
|
|
252
|
-
data = send
|
|
255
|
+
data = send method, uri, mtime, head
|
|
253
256
|
|
|
254
257
|
if data && !head && uri.to_s.end_with?(".gz")
|
|
255
258
|
begin
|
|
@@ -21,7 +21,7 @@ class Gem::Resolver::Conflict
|
|
|
21
21
|
# Creates a new resolver conflict when +dependency+ is in conflict with an
|
|
22
22
|
# already +activated+ specification.
|
|
23
23
|
|
|
24
|
-
def initialize(dependency, activated, failed_dep=dependency)
|
|
24
|
+
def initialize(dependency, activated, failed_dep = dependency)
|
|
25
25
|
@dependency = dependency
|
|
26
26
|
@activated = activated
|
|
27
27
|
@failed_dep = failed_dep
|
data/lib/rubygems/resolver.rb
CHANGED
|
@@ -52,7 +52,7 @@ class Gem::Security::Signer
|
|
|
52
52
|
re_signed_cert = Gem::Security.re_sign(
|
|
53
53
|
expired_cert,
|
|
54
54
|
private_key,
|
|
55
|
-
|
|
55
|
+
Gem::Security::ONE_DAY * Gem.configuration.cert_expiration_length_days
|
|
56
56
|
)
|
|
57
57
|
|
|
58
58
|
Gem::Security.write(re_signed_cert, expired_cert_path)
|
data/lib/rubygems/source.rb
CHANGED
|
@@ -190,7 +190,7 @@ class Gem::Source
|
|
|
190
190
|
# Downloads +spec+ and writes it to +dir+. See also
|
|
191
191
|
# Gem::RemoteFetcher#download.
|
|
192
192
|
|
|
193
|
-
def download(spec, dir=Dir.pwd)
|
|
193
|
+
def download(spec, dir = Dir.pwd)
|
|
194
194
|
fetcher = Gem::RemoteFetcher.fetcher
|
|
195
195
|
fetcher.download spec, uri.to_s, dir
|
|
196
196
|
end
|
|
@@ -210,7 +210,7 @@ class Gem::Source
|
|
|
210
210
|
end
|
|
211
211
|
end
|
|
212
212
|
|
|
213
|
-
def typo_squatting?(host, distance_threshold=4)
|
|
213
|
+
def typo_squatting?(host, distance_threshold = 4)
|
|
214
214
|
return if @uri.host.nil?
|
|
215
215
|
levenshtein_distance(@uri.host, host).between? 1, distance_threshold
|
|
216
216
|
end
|
|
@@ -83,7 +83,7 @@ class Gem::SpecFetcher
|
|
|
83
83
|
#
|
|
84
84
|
# If +matching_platform+ is false, gems for all platforms are returned.
|
|
85
85
|
|
|
86
|
-
def search_for_dependency(dependency, matching_platform=true)
|
|
86
|
+
def search_for_dependency(dependency, matching_platform = true)
|
|
87
87
|
found = {}
|
|
88
88
|
|
|
89
89
|
rejected_specs = {}
|
|
@@ -130,7 +130,7 @@ class Gem::SpecFetcher
|
|
|
130
130
|
##
|
|
131
131
|
# Return all gem name tuples who's names match +obj+
|
|
132
132
|
|
|
133
|
-
def detect(type
|
|
133
|
+
def detect(type = :complete)
|
|
134
134
|
tuples = []
|
|
135
135
|
|
|
136
136
|
list, _ = available_specs(type)
|
|
@@ -150,7 +150,7 @@ class Gem::SpecFetcher
|
|
|
150
150
|
#
|
|
151
151
|
# If +matching_platform+ is false, gems for all platforms are returned.
|
|
152
152
|
|
|
153
|
-
def spec_for_dependency(dependency, matching_platform=true)
|
|
153
|
+
def spec_for_dependency(dependency, matching_platform = true)
|
|
154
154
|
tuples, errors = search_for_dependency(dependency, matching_platform)
|
|
155
155
|
|
|
156
156
|
specs = []
|
|
@@ -280,7 +280,7 @@ class Gem::SpecFetcher
|
|
|
280
280
|
# Retrieves NameTuples from +source+ of the given +type+ (:prerelease,
|
|
281
281
|
# etc.). If +gracefully_ignore+ is true, errors are ignored.
|
|
282
282
|
|
|
283
|
-
def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
|
|
283
|
+
def tuples_for(source, type, gracefully_ignore = false) # :nodoc:
|
|
284
284
|
@caches[type][source.uri] ||=
|
|
285
285
|
source.load_specs(type).sort_by(&:name)
|
|
286
286
|
rescue Gem::RemoteFetcher::FetchError
|