rubygems-update 3.4.7 → 3.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/Manifest.txt +2 -0
- data/POLICIES.md +5 -5
- data/README.md +1 -4
- data/bundler/CHANGELOG.md +23 -0
- data/bundler/README.md +1 -4
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/environment_preserver.rb +2 -2
- data/bundler/lib/bundler/fetcher.rb +2 -2
- data/bundler/lib/bundler/index.rb +2 -2
- data/bundler/lib/bundler/injector.rb +1 -1
- data/bundler/lib/bundler/installer/parallel_installer.rb +1 -14
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/lockfile_parser.rb +9 -9
- data/bundler/lib/bundler/plugin.rb +1 -1
- data/bundler/lib/bundler/rubygems_integration.rb +1 -1
- data/bundler/lib/bundler/setup.rb +4 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +16 -4
- data/bundler/lib/bundler/source/git.rb +1 -0
- data/bundler/lib/bundler/source/path.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +8 -2
- data/bundler/lib/bundler/templates/Executable.bundler +1 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +9 -9
- data/lib/rubygems/bundler_version_finder.rb +1 -1
- data/lib/rubygems/command.rb +10 -6
- data/lib/rubygems/command_manager.rb +1 -0
- data/lib/rubygems/commands/exec_command.rb +248 -0
- data/lib/rubygems/commands/help_command.rb +3 -3
- data/lib/rubygems/defaults.rb +2 -2
- data/lib/rubygems/dependency.rb +1 -1
- data/lib/rubygems/package/tar_reader/entry.rb +82 -3
- data/lib/rubygems/package/tar_reader.rb +0 -28
- data/lib/rubygems/platform.rb +2 -2
- data/lib/rubygems/request_set/gem_dependency_api.rb +0 -1
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver/stats.rb +1 -1
- data/lib/rubygems/source/git.rb +1 -1
- data/lib/rubygems/specification.rb +9 -1
- data/lib/rubygems/stub_specification.rb +7 -7
- data/lib/rubygems/text.rb +1 -1
- data/lib/rubygems/util/licenses.rb +2 -2
- data/lib/rubygems/version.rb +2 -2
- data/lib/rubygems.rb +3 -3
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/helper.rb +2 -3
- data/test/rubygems/package/tar_test_case.rb +49 -14
- data/test/rubygems/simple_gem.rb +1 -1
- data/test/rubygems/test_gem.rb +24 -0
- data/test/rubygems/test_gem_bundler_version_finder.rb +2 -2
- data/test/rubygems/test_gem_commands_exec_command.rb +851 -0
- data/test/rubygems/test_gem_commands_install_command.rb +1 -1
- data/test/rubygems/test_gem_commands_setup_command.rb +1 -1
- data/test/rubygems/test_gem_ext_builder.rb +3 -5
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +20 -6
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
- data/test/rubygems/test_gem_gem_runner.rb +2 -2
- data/test/rubygems/test_gem_package.rb +0 -25
- data/test/rubygems/test_gem_package_tar_reader.rb +48 -1
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +102 -15
- data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +10 -10
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +2 -2
- data/test/rubygems/test_gem_resolver_git_set.rb +9 -9
- data/test/rubygems/test_gem_resolver_git_specification.rb +1 -1
- data/test/rubygems/test_gem_source.rb +1 -1
- data/test/rubygems/test_gem_source_git.rb +13 -12
- data/test/rubygems/test_gem_source_installed.rb +1 -1
- data/test/rubygems/test_gem_source_lock.rb +3 -3
- data/test/rubygems/test_gem_source_vendor.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +19 -2
- data/test/rubygems/test_gem_version.rb +2 -2
- data/test/rubygems/test_kernel.rb +0 -8
- metadata +5 -3
@@ -0,0 +1,248 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "../command"
|
3
|
+
require_relative "../dependency_installer"
|
4
|
+
require_relative "../gem_runner"
|
5
|
+
require_relative "../package"
|
6
|
+
require_relative "../version_option"
|
7
|
+
|
8
|
+
class Gem::Commands::ExecCommand < Gem::Command
|
9
|
+
include Gem::VersionOption
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
super "exec", "Run a command from a gem", {
|
13
|
+
version: Gem::Requirement.default,
|
14
|
+
}
|
15
|
+
|
16
|
+
add_version_option
|
17
|
+
add_prerelease_option "to be installed"
|
18
|
+
|
19
|
+
add_option "-g", "--gem GEM", "run the executable from the given gem" do |value, options|
|
20
|
+
options[:gem_name] = value
|
21
|
+
end
|
22
|
+
|
23
|
+
add_option(:"Install/Update", "--conservative",
|
24
|
+
"Prefer the most recent installed version, ",
|
25
|
+
"rather than the latest version overall") do |value, options|
|
26
|
+
options[:conservative] = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def arguments # :nodoc:
|
31
|
+
"COMMAND the executable command to run"
|
32
|
+
end
|
33
|
+
|
34
|
+
def defaults_str # :nodoc:
|
35
|
+
"--version '#{Gem::Requirement.default}'"
|
36
|
+
end
|
37
|
+
|
38
|
+
def description # :nodoc:
|
39
|
+
<<-EOF
|
40
|
+
The exec command handles installing (if necessary) and running an executable
|
41
|
+
from a gem, regardless of whether that gem is currently installed.
|
42
|
+
|
43
|
+
The exec command can be thought of as a shortcut to running `gem install` and
|
44
|
+
then the executable from the installed gem.
|
45
|
+
|
46
|
+
For example, `gem exec rails new .` will run `rails new .` in the current
|
47
|
+
directory, without having to manually run `gem install rails`.
|
48
|
+
Additionally, the exec command ensures the most recent version of the gem
|
49
|
+
is used (unless run with `--conservative`), and that the gem is not installed
|
50
|
+
to the same gem path as user-installed gems.
|
51
|
+
EOF
|
52
|
+
end
|
53
|
+
|
54
|
+
def usage # :nodoc:
|
55
|
+
"#{program_name} [options --] COMMAND [args]"
|
56
|
+
end
|
57
|
+
|
58
|
+
def execute
|
59
|
+
gem_paths = { "GEM_HOME" => Gem.paths.home, "GEM_PATH" => Gem.paths.path.join(File::PATH_SEPARATOR), "GEM_SPEC_CACHE" => Gem.paths.spec_cache_dir }.compact
|
60
|
+
|
61
|
+
check_executable
|
62
|
+
|
63
|
+
print_command
|
64
|
+
if options[:gem_name] == "gem" && options[:executable] == "gem"
|
65
|
+
set_gem_exec_install_paths
|
66
|
+
Gem::GemRunner.new.run options[:args]
|
67
|
+
return
|
68
|
+
elsif options[:conservative]
|
69
|
+
install_if_needed
|
70
|
+
else
|
71
|
+
install
|
72
|
+
activate!
|
73
|
+
end
|
74
|
+
|
75
|
+
load!
|
76
|
+
ensure
|
77
|
+
ENV.update(gem_paths) if gem_paths
|
78
|
+
Gem.clear_paths
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def handle_options(args)
|
84
|
+
args = add_extra_args(args)
|
85
|
+
check_deprecated_options(args)
|
86
|
+
@options = Marshal.load Marshal.dump @defaults # deep copy
|
87
|
+
parser.order!(args) do |v|
|
88
|
+
# put the non-option back at the front of the list of arguments
|
89
|
+
args.unshift(v)
|
90
|
+
|
91
|
+
# stop parsing once we hit the first non-option,
|
92
|
+
# so you can call `gem exec rails --version` and it prints the rails
|
93
|
+
# version rather than rubygem's
|
94
|
+
break
|
95
|
+
end
|
96
|
+
@options[:args] = args
|
97
|
+
|
98
|
+
options[:executable], gem_version = extract_gem_name_and_version(options[:args].shift)
|
99
|
+
options[:gem_name] ||= options[:executable]
|
100
|
+
|
101
|
+
if gem_version
|
102
|
+
if options[:version].none?
|
103
|
+
options[:version] = Gem::Requirement.new(gem_version)
|
104
|
+
else
|
105
|
+
options[:version].concat [gem_version]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
if options[:prerelease] && !options[:version].prerelease?
|
110
|
+
if options[:version].none?
|
111
|
+
options[:version] = Gem::Requirement.default_prerelease
|
112
|
+
else
|
113
|
+
options[:version].concat [Gem::Requirement.default_prerelease]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def check_executable
|
119
|
+
if options[:executable].nil?
|
120
|
+
raise Gem::CommandLineError,
|
121
|
+
"Please specify an executable to run (e.g. #{program_name} COMMAND)"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def print_command
|
126
|
+
verbose "running #{program_name} with:\n"
|
127
|
+
opts = options.reject {|_, v| v.nil? || Array(v).empty? }
|
128
|
+
max_length = opts.map {|k, _| k.size }.max
|
129
|
+
opts.each do |k, v|
|
130
|
+
next if v.nil?
|
131
|
+
verbose "\t#{k.to_s.rjust(max_length)}: #{v}"
|
132
|
+
end
|
133
|
+
verbose ""
|
134
|
+
end
|
135
|
+
|
136
|
+
def install_if_needed
|
137
|
+
activate!
|
138
|
+
rescue Gem::MissingSpecError
|
139
|
+
verbose "#{Gem::Dependency.new(options[:gem_name], options[:version])} not available locally, installing from remote"
|
140
|
+
install
|
141
|
+
activate!
|
142
|
+
end
|
143
|
+
|
144
|
+
def set_gem_exec_install_paths
|
145
|
+
home = File.join(Gem.dir, "gem_exec")
|
146
|
+
|
147
|
+
ENV["GEM_PATH"] = ([home] + Gem.path).join(File::PATH_SEPARATOR)
|
148
|
+
ENV["GEM_HOME"] = home
|
149
|
+
Gem.clear_paths
|
150
|
+
end
|
151
|
+
|
152
|
+
def install
|
153
|
+
set_gem_exec_install_paths
|
154
|
+
|
155
|
+
gem_name = options[:gem_name]
|
156
|
+
gem_version = options[:version]
|
157
|
+
|
158
|
+
install_options = options.merge(
|
159
|
+
minimal_deps: false,
|
160
|
+
wrappers: true
|
161
|
+
)
|
162
|
+
|
163
|
+
suppress_always_install do
|
164
|
+
dep_installer = Gem::DependencyInstaller.new install_options
|
165
|
+
|
166
|
+
request_set = dep_installer.resolve_dependencies gem_name, gem_version
|
167
|
+
|
168
|
+
verbose "Gems to install:"
|
169
|
+
request_set.sorted_requests.each do |activation_request|
|
170
|
+
verbose "\t#{activation_request.full_name}"
|
171
|
+
end
|
172
|
+
|
173
|
+
request_set.install install_options
|
174
|
+
end
|
175
|
+
|
176
|
+
Gem::Specification.reset
|
177
|
+
rescue Gem::InstallError => e
|
178
|
+
alert_error "Error installing #{gem_name}:\n\t#{e.message}"
|
179
|
+
terminate_interaction 1
|
180
|
+
rescue Gem::GemNotFoundException => e
|
181
|
+
show_lookup_failure e.name, e.version, e.errors, false
|
182
|
+
|
183
|
+
terminate_interaction 2
|
184
|
+
rescue Gem::UnsatisfiableDependencyError => e
|
185
|
+
show_lookup_failure e.name, e.version, e.errors, false,
|
186
|
+
"'#{gem_name}' (#{gem_version})"
|
187
|
+
|
188
|
+
terminate_interaction 2
|
189
|
+
end
|
190
|
+
|
191
|
+
def activate!
|
192
|
+
gem(options[:gem_name], options[:version])
|
193
|
+
Gem.finish_resolve
|
194
|
+
|
195
|
+
verbose "activated #{options[:gem_name]} (#{Gem.loaded_specs[options[:gem_name]].version})"
|
196
|
+
end
|
197
|
+
|
198
|
+
def load!
|
199
|
+
argv = ARGV.clone
|
200
|
+
ARGV.replace options[:args]
|
201
|
+
|
202
|
+
exe = executable = options[:executable]
|
203
|
+
|
204
|
+
contains_executable = Gem.loaded_specs.values.select do |spec|
|
205
|
+
spec.executables.include?(executable)
|
206
|
+
end
|
207
|
+
|
208
|
+
if contains_executable.any? {|s| s.name == executable }
|
209
|
+
contains_executable.select! {|s| s.name == executable }
|
210
|
+
end
|
211
|
+
|
212
|
+
if contains_executable.empty?
|
213
|
+
if (spec = Gem.loaded_specs[executable]) && (exe = spec.executable)
|
214
|
+
contains_executable << spec
|
215
|
+
else
|
216
|
+
alert_error "Failed to load executable `#{executable}`," \
|
217
|
+
" are you sure the gem `#{options[:gem_name]}` contains it?"
|
218
|
+
terminate_interaction 1
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
if contains_executable.size > 1
|
223
|
+
alert_error "Ambiguous which gem `#{executable}` should come from: " \
|
224
|
+
"the options are #{contains_executable.map(&:name)}, " \
|
225
|
+
"specify one via `-g`"
|
226
|
+
terminate_interaction 1
|
227
|
+
end
|
228
|
+
|
229
|
+
load Gem.activate_bin_path(contains_executable.first.name, exe, ">= 0.a")
|
230
|
+
ensure
|
231
|
+
ARGV.replace argv
|
232
|
+
end
|
233
|
+
|
234
|
+
def suppress_always_install
|
235
|
+
name = :always_install
|
236
|
+
cls = ::Gem::Resolver::InstallerSet
|
237
|
+
method = cls.instance_method(name)
|
238
|
+
cls.remove_method(name)
|
239
|
+
cls.define_method(name) { [] }
|
240
|
+
|
241
|
+
begin
|
242
|
+
yield
|
243
|
+
ensure
|
244
|
+
cls.remove_method(name)
|
245
|
+
cls.define_method(name, method)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
@@ -3,7 +3,7 @@ require_relative "../command"
|
|
3
3
|
|
4
4
|
class Gem::Commands::HelpCommand < Gem::Command
|
5
5
|
# :stopdoc:
|
6
|
-
EXAMPLES = <<-EOF
|
6
|
+
EXAMPLES = <<-EOF
|
7
7
|
Some examples of 'gem' usage.
|
8
8
|
|
9
9
|
* Install 'rake', either from local directory or remote server:
|
@@ -52,7 +52,7 @@ Some examples of 'gem' usage.
|
|
52
52
|
gem update --system
|
53
53
|
EOF
|
54
54
|
|
55
|
-
GEM_DEPENDENCIES = <<-EOF
|
55
|
+
GEM_DEPENDENCIES = <<-EOF
|
56
56
|
A gem dependencies file allows installation of a consistent set of gems across
|
57
57
|
multiple environments. The RubyGems implementation is designed to be
|
58
58
|
compatible with Bundler's Gemfile format. You can see additional
|
@@ -229,7 +229,7 @@ default. This may be overridden with the :development_group option:
|
|
229
229
|
|
230
230
|
EOF
|
231
231
|
|
232
|
-
PLATFORMS = <<-'EOF'
|
232
|
+
PLATFORMS = <<-'EOF'
|
233
233
|
RubyGems platforms are composed of three parts, a CPU, an OS, and a
|
234
234
|
version. These values are taken from values in rbconfig.rb. You can view
|
235
235
|
your current platform by running `gem environment`.
|
data/lib/rubygems/defaults.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Gem
|
3
|
-
DEFAULT_HOST = "https://rubygems.org"
|
3
|
+
DEFAULT_HOST = "https://rubygems.org"
|
4
4
|
|
5
5
|
@post_install_hooks ||= []
|
6
6
|
@done_installing_hooks ||= []
|
@@ -158,7 +158,7 @@ module Gem
|
|
158
158
|
# The path to standard location of the user's state directory.
|
159
159
|
|
160
160
|
def self.state_home
|
161
|
-
@
|
161
|
+
@state_home ||= (ENV["XDG_STATE_HOME"] || File.join(Gem.user_home, ".local", "state"))
|
162
162
|
end
|
163
163
|
|
164
164
|
##
|
data/lib/rubygems/dependency.rb
CHANGED
@@ -8,6 +8,20 @@
|
|
8
8
|
# Class for reading entries out of a tar file
|
9
9
|
|
10
10
|
class Gem::Package::TarReader::Entry
|
11
|
+
##
|
12
|
+
# Creates a new tar entry for +header+ that will be read from +io+
|
13
|
+
# If a block is given, the entry is yielded and then closed.
|
14
|
+
|
15
|
+
def self.open(header, io, &block)
|
16
|
+
entry = new header, io
|
17
|
+
return entry unless block_given?
|
18
|
+
begin
|
19
|
+
yield entry
|
20
|
+
ensure
|
21
|
+
entry.close
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
11
25
|
##
|
12
26
|
# Header for this tar entry
|
13
27
|
|
@@ -21,6 +35,7 @@ class Gem::Package::TarReader::Entry
|
|
21
35
|
@header = header
|
22
36
|
@io = io
|
23
37
|
@orig_pos = @io.pos
|
38
|
+
@end_pos = @orig_pos + @header.size
|
24
39
|
@read = 0
|
25
40
|
end
|
26
41
|
|
@@ -39,7 +54,14 @@ class Gem::Package::TarReader::Entry
|
|
39
54
|
# Closes the tar entry
|
40
55
|
|
41
56
|
def close
|
57
|
+
return if closed?
|
58
|
+
# Seek to the end of the entry if it wasn't fully read
|
59
|
+
seek(0, IO::SEEK_END)
|
60
|
+
# discard trailing zeros
|
61
|
+
skip = (512 - (@header.size % 512)) % 512
|
62
|
+
@io.read(skip)
|
42
63
|
@closed = true
|
64
|
+
nil
|
43
65
|
end
|
44
66
|
|
45
67
|
##
|
@@ -117,6 +139,14 @@ class Gem::Package::TarReader::Entry
|
|
117
139
|
bytes_read
|
118
140
|
end
|
119
141
|
|
142
|
+
##
|
143
|
+
# Seek to the position in the tar entry
|
144
|
+
|
145
|
+
def pos=(new_pos)
|
146
|
+
seek(new_pos, IO::SEEK_SET)
|
147
|
+
new_pos
|
148
|
+
end
|
149
|
+
|
120
150
|
def size
|
121
151
|
@header.size
|
122
152
|
end
|
@@ -157,13 +187,62 @@ class Gem::Package::TarReader::Entry
|
|
157
187
|
outbuf
|
158
188
|
end
|
159
189
|
|
190
|
+
##
|
191
|
+
# Seeks to +offset+ bytes into the tar file entry
|
192
|
+
# +whence+ can be IO::SEEK_SET, IO::SEEK_CUR, or IO::SEEK_END
|
193
|
+
|
194
|
+
def seek(offset, whence = IO::SEEK_SET)
|
195
|
+
check_closed
|
196
|
+
|
197
|
+
new_pos =
|
198
|
+
case whence
|
199
|
+
when IO::SEEK_SET then @orig_pos + offset
|
200
|
+
when IO::SEEK_CUR then @io.pos + offset
|
201
|
+
when IO::SEEK_END then @end_pos + offset
|
202
|
+
else
|
203
|
+
raise ArgumentError, "invalid whence"
|
204
|
+
end
|
205
|
+
|
206
|
+
if new_pos < @orig_pos
|
207
|
+
new_pos = @orig_pos
|
208
|
+
elsif new_pos > @end_pos
|
209
|
+
new_pos = @end_pos
|
210
|
+
end
|
211
|
+
|
212
|
+
pending = new_pos - @io.pos
|
213
|
+
|
214
|
+
if @io.respond_to?(:seek)
|
215
|
+
begin
|
216
|
+
# avoid reading if the @io supports seeking
|
217
|
+
@io.seek new_pos, IO::SEEK_SET
|
218
|
+
pending = 0
|
219
|
+
rescue Errno::EINVAL
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
# if seeking isn't supported or failed
|
224
|
+
# negative seek requires that we rewind and read
|
225
|
+
if pending < 0
|
226
|
+
@io.rewind
|
227
|
+
pending = new_pos
|
228
|
+
end
|
229
|
+
|
230
|
+
while pending > 0 do
|
231
|
+
size_read = @io.read([pending, 4096].min).size
|
232
|
+
raise UnexpectedEOF if @io.eof?
|
233
|
+
pending -= size_read
|
234
|
+
end
|
235
|
+
|
236
|
+
@read = @io.pos - @orig_pos
|
237
|
+
|
238
|
+
0
|
239
|
+
end
|
240
|
+
|
160
241
|
##
|
161
242
|
# Rewinds to the beginning of the tar file entry
|
162
243
|
|
163
244
|
def rewind
|
164
245
|
check_closed
|
165
|
-
|
166
|
-
@io.pos = @orig_pos
|
167
|
-
@read = 0
|
246
|
+
seek(0, IO::SEEK_SET)
|
168
247
|
end
|
169
248
|
end
|
@@ -53,39 +53,11 @@ class Gem::Package::TarReader
|
|
53
53
|
def each
|
54
54
|
return enum_for __method__ unless block_given?
|
55
55
|
|
56
|
-
use_seek = @io.respond_to?(:seek)
|
57
|
-
|
58
56
|
until @io.eof? do
|
59
57
|
header = Gem::Package::TarHeader.from @io
|
60
58
|
return if header.empty?
|
61
|
-
|
62
59
|
entry = Gem::Package::TarReader::Entry.new header, @io
|
63
|
-
size = entry.header.size
|
64
|
-
|
65
60
|
yield entry
|
66
|
-
|
67
|
-
skip = (512 - (size % 512)) % 512
|
68
|
-
pending = size - entry.bytes_read
|
69
|
-
|
70
|
-
if use_seek
|
71
|
-
begin
|
72
|
-
# avoid reading if the @io supports seeking
|
73
|
-
@io.seek pending, IO::SEEK_CUR
|
74
|
-
pending = 0
|
75
|
-
rescue Errno::EINVAL
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
# if seeking isn't supported or failed
|
80
|
-
while pending > 0 do
|
81
|
-
bytes_read = @io.read([pending, 4096].min).size
|
82
|
-
raise UnexpectedEOF if @io.eof?
|
83
|
-
pending -= bytes_read
|
84
|
-
end
|
85
|
-
|
86
|
-
@io.read skip # discard trailing zeros
|
87
|
-
|
88
|
-
# make sure nobody can use #read, #getc or #rewind anymore
|
89
61
|
entry.close
|
90
62
|
end
|
91
63
|
end
|
data/lib/rubygems/platform.rb
CHANGED
@@ -235,11 +235,11 @@ class Gem::Platform
|
|
235
235
|
# A pure-Ruby gem that may use Gem::Specification#extensions to build
|
236
236
|
# binary files.
|
237
237
|
|
238
|
-
RUBY = "ruby"
|
238
|
+
RUBY = "ruby"
|
239
239
|
|
240
240
|
##
|
241
241
|
# A platform-specific gem that is built for the packaging Ruby's platform.
|
242
242
|
# This will be replaced with Gem::Platform::local.
|
243
243
|
|
244
|
-
CURRENT = "current"
|
244
|
+
CURRENT = "current"
|
245
245
|
end
|
data/lib/rubygems/requirement.rb
CHANGED
@@ -22,7 +22,7 @@ class Gem::Requirement
|
|
22
22
|
SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
|
23
23
|
|
24
24
|
quoted = OPS.keys.map {|k| Regexp.quote k }.join "|"
|
25
|
-
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*"
|
25
|
+
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*" # :nodoc:
|
26
26
|
|
27
27
|
##
|
28
28
|
# A regular expression that matches a requirement
|
data/lib/rubygems/source/git.rb
CHANGED
@@ -338,7 +338,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
338
338
|
# The simplest way is to specify the standard SPDX ID
|
339
339
|
# https://spdx.org/licenses/ for the license.
|
340
340
|
# Ideally, you should pick one that is OSI (Open Source Initiative)
|
341
|
-
#
|
341
|
+
# https://opensource.org/licenses/ approved.
|
342
342
|
#
|
343
343
|
# The most commonly used OSI-approved licenses are MIT and Apache-2.0.
|
344
344
|
# GitHub also provides a license picker at http://choosealicense.com/.
|
@@ -1021,6 +1021,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1021
1021
|
Gem::Dependency.new(name, *requirements).to_spec
|
1022
1022
|
end
|
1023
1023
|
|
1024
|
+
##
|
1025
|
+
# Find the best specification matching a +full_name+.
|
1026
|
+
def self.find_by_full_name(full_name)
|
1027
|
+
stubs.find {|s| s.full_name == full_name }&.to_spec
|
1028
|
+
end
|
1029
|
+
|
1024
1030
|
##
|
1025
1031
|
# Return the best specification that contains the file matching +path+.
|
1026
1032
|
|
@@ -1606,6 +1612,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1606
1612
|
def build_extensions # :nodoc:
|
1607
1613
|
return if extensions.empty?
|
1608
1614
|
return if default_gem?
|
1615
|
+
# we need to fresh build when same name and version of default gems
|
1616
|
+
return if self.class.find_by_full_name(full_name)&.default_gem?
|
1609
1617
|
return if File.exist? gem_build_complete_path
|
1610
1618
|
return if !File.writable?(base_dir)
|
1611
1619
|
return if !File.exist?(File.join(base_dir, "extensions"))
|
@@ -6,10 +6,10 @@
|
|
6
6
|
|
7
7
|
class Gem::StubSpecification < Gem::BasicSpecification
|
8
8
|
# :nodoc:
|
9
|
-
PREFIX = "# stub: "
|
9
|
+
PREFIX = "# stub: "
|
10
10
|
|
11
11
|
# :nodoc:
|
12
|
-
OPEN_MODE = "r:UTF-8:-"
|
12
|
+
OPEN_MODE = "r:UTF-8:-"
|
13
13
|
|
14
14
|
class StubLine # :nodoc: all
|
15
15
|
attr_reader :name, :version, :platform, :require_paths, :extensions,
|
@@ -19,9 +19,9 @@ class Gem::StubSpecification < Gem::BasicSpecification
|
|
19
19
|
|
20
20
|
# These are common require paths.
|
21
21
|
REQUIRE_PATHS = { # :nodoc:
|
22
|
-
"lib" => "lib"
|
23
|
-
"test" => "test"
|
24
|
-
"ext" => "ext"
|
22
|
+
"lib" => "lib",
|
23
|
+
"test" => "test",
|
24
|
+
"ext" => "ext",
|
25
25
|
}.freeze
|
26
26
|
|
27
27
|
# These are common require path lists. This hash is used to optimize
|
@@ -33,7 +33,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
|
|
33
33
|
}.freeze
|
34
34
|
|
35
35
|
def initialize(data, extensions)
|
36
|
-
parts = data[PREFIX.length..-1].split(" "
|
36
|
+
parts = data[PREFIX.length..-1].split(" ", 4)
|
37
37
|
@name = parts[0].freeze
|
38
38
|
@version = if Gem::Version.correct?(parts[1])
|
39
39
|
Gem::Version.new(parts[1])
|
@@ -50,7 +50,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
|
|
50
50
|
end
|
51
51
|
|
52
52
|
path_list = parts.last
|
53
|
-
@require_paths = REQUIRE_PATH_LIST[path_list] || path_list.split("\0"
|
53
|
+
@require_paths = REQUIRE_PATH_LIST[path_list] || path_list.split("\0").map! do |x|
|
54
54
|
REQUIRE_PATHS[x] || x
|
55
55
|
end
|
56
56
|
end
|
data/lib/rubygems/text.rb
CHANGED
@@ -9,7 +9,7 @@ module Gem::Text
|
|
9
9
|
# Remove any non-printable characters and make the text suitable for
|
10
10
|
# printing.
|
11
11
|
def clean_text(text)
|
12
|
-
text.gsub(/[\000-\b\v-\f\016-\037\177]/, "."
|
12
|
+
text.gsub(/[\000-\b\v-\f\016-\037\177]/, ".")
|
13
13
|
end
|
14
14
|
|
15
15
|
def truncate_text(text, description, max_length = 100_000)
|
@@ -4,8 +4,8 @@ require_relative "../text"
|
|
4
4
|
class Gem::Licenses
|
5
5
|
extend Gem::Text
|
6
6
|
|
7
|
-
NONSTANDARD = "Nonstandard"
|
8
|
-
LICENSE_REF = "LicenseRef-.+"
|
7
|
+
NONSTANDARD = "Nonstandard"
|
8
|
+
LICENSE_REF = "LicenseRef-.+"
|
9
9
|
|
10
10
|
# Software Package Data Exchange (SPDX) standard open-source software
|
11
11
|
# license identifiers
|
data/lib/rubygems/version.rb
CHANGED
@@ -155,7 +155,7 @@ require_relative "deprecate"
|
|
155
155
|
class Gem::Version
|
156
156
|
include Comparable
|
157
157
|
|
158
|
-
VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?'
|
158
|
+
VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:
|
159
159
|
ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/.freeze # :nodoc:
|
160
160
|
|
161
161
|
##
|
@@ -272,7 +272,7 @@ class Gem::Version
|
|
272
272
|
# string for backwards (RubyGems 1.3.5 and earlier) compatibility.
|
273
273
|
|
274
274
|
def marshal_dump
|
275
|
-
[version]
|
275
|
+
[@version]
|
276
276
|
end
|
277
277
|
|
278
278
|
##
|
data/lib/rubygems.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
require "rbconfig"
|
9
9
|
|
10
10
|
module Gem
|
11
|
-
VERSION = "3.4.
|
11
|
+
VERSION = "3.4.8"
|
12
12
|
end
|
13
13
|
|
14
14
|
# Must be first since it unloads the prelude from 1.9.2
|
@@ -824,7 +824,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|
824
824
|
def self.env_requirement(gem_name)
|
825
825
|
@env_requirements_by_name ||= {}
|
826
826
|
@env_requirements_by_name[gem_name] ||= begin
|
827
|
-
req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || ">= 0"
|
827
|
+
req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || ">= 0"
|
828
828
|
Gem::Requirement.create(req)
|
829
829
|
end
|
830
830
|
end
|
@@ -1301,7 +1301,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|
1301
1301
|
##
|
1302
1302
|
# Location of Marshal quick gemspecs on remote repositories
|
1303
1303
|
|
1304
|
-
MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/"
|
1304
|
+
MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/"
|
1305
1305
|
|
1306
1306
|
autoload :ConfigFile, File.expand_path("rubygems/config_file", __dir__)
|
1307
1307
|
autoload :Dependency, File.expand_path("rubygems/dependency", __dir__)
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.4.
|
5
|
+
s.version = "3.4.8"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|