rubygems-update 3.4.19 → 3.4.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -0
- data/bundler/CHANGELOG.md +29 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/info.rb +1 -1
- data/bundler/lib/bundler/cli/update.rb +1 -0
- data/bundler/lib/bundler/fetcher/base.rb +2 -2
- data/bundler/lib/bundler/fetcher/compact_index.rb +1 -5
- data/bundler/lib/bundler/fetcher/dependency.rb +1 -1
- data/bundler/lib/bundler/fetcher.rb +31 -30
- data/bundler/lib/bundler/index.rb +62 -31
- data/bundler/lib/bundler/installer/standalone.rb +8 -1
- data/bundler/lib/bundler/lockfile_parser.rb +3 -15
- data/bundler/lib/bundler/man/gemfile.5 +11 -0
- data/bundler/lib/bundler/man/gemfile.5.ronn +5 -0
- data/bundler/lib/bundler/plugin.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +18 -3
- data/bundler/lib/bundler/retry.rb +1 -1
- data/bundler/lib/bundler/ruby_dsl.rb +23 -2
- data/bundler/lib/bundler/self_manager.rb +2 -0
- data/bundler/lib/bundler/settings.rb +37 -13
- data/bundler/lib/bundler/source/git/git_proxy.rb +14 -2
- data/bundler/lib/bundler/source/rubygems.rb +22 -25
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems/available_set.rb +1 -1
- data/lib/rubygems/basic_specification.rb +2 -2
- data/lib/rubygems/command.rb +16 -19
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/dependency_command.rb +3 -4
- data/lib/rubygems/commands/owner_command.rb +8 -10
- data/lib/rubygems/commands/uninstall_command.rb +6 -7
- data/lib/rubygems/commands/unpack_command.rb +4 -6
- data/lib/rubygems/config_file.rb +1 -1
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -1
- data/lib/rubygems/core_ext/kernel_warn.rb +4 -5
- data/lib/rubygems/dependency_installer.rb +8 -12
- data/lib/rubygems/deprecate.rb +2 -2
- data/lib/rubygems/gemcutter_utilities.rb +2 -2
- data/lib/rubygems/installer.rb +9 -11
- data/lib/rubygems/name_tuple.rb +1 -1
- data/lib/rubygems/package/tar_reader/entry.rb +18 -20
- data/lib/rubygems/package/tar_reader.rb +0 -5
- data/lib/rubygems/package.rb +10 -4
- data/lib/rubygems/query_utils.rb +1 -1
- data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
- data/lib/rubygems/resolver/activation_request.rb +2 -4
- data/lib/rubygems/resolver/installed_specification.rb +1 -1
- data/lib/rubygems/resolver/local_specification.rb +1 -1
- data/lib/rubygems/s3_uri_signer.rb +1 -1
- data/lib/rubygems/security/trust_dir.rb +4 -6
- data/lib/rubygems/security.rb +1 -1
- data/lib/rubygems/source/local.rb +34 -37
- data/lib/rubygems/source.rb +2 -2
- data/lib/rubygems/source_list.rb +2 -2
- data/lib/rubygems/spec_fetcher.rb +29 -33
- data/lib/rubygems/specification.rb +34 -26
- data/lib/rubygems/specification_policy.rb +33 -32
- data/lib/rubygems/stub_specification.rb +13 -10
- data/lib/rubygems/uninstaller.rb +1 -1
- data/lib/rubygems/user_interaction.rb +2 -2
- data/lib/rubygems/util/licenses.rb +115 -0
- data/lib/rubygems/validator.rb +5 -7
- data/lib/rubygems.rb +5 -7
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/helper.rb +17 -19
- data/test/rubygems/test_gem.rb +4 -4
- data/test/rubygems/test_gem_commands_build_command.rb +2 -1
- data/test/rubygems/test_gem_commands_stale_command.rb +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +28 -12
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +16 -14
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
- data/test/rubygems/test_gem_indexer.rb +1 -1
- data/test/rubygems/test_gem_package.rb +117 -2
- data/test/rubygems/test_gem_package_tar_header.rb +7 -7
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +53 -1
- data/test/rubygems/test_gem_package_tar_writer.rb +13 -13
- data/test/rubygems/test_gem_remote_fetcher.rb +21 -25
- data/test/rubygems/test_gem_requirement.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +42 -6
- data/test/rubygems/test_gem_update_suggestion.rb +14 -20
- data/test/rubygems/test_require.rb +4 -6
- data/test/rubygems/utilities.rb +2 -2
- metadata +3 -3
@@ -88,14 +88,24 @@ module Bundler
|
|
88
88
|
def initialize(root = nil)
|
89
89
|
@root = root
|
90
90
|
@local_config = load_config(local_config_file)
|
91
|
-
|
91
|
+
|
92
|
+
@env_config = ENV.to_h
|
93
|
+
@env_config.select! {|key, _value| key.start_with?("BUNDLE_") }
|
94
|
+
@env_config.delete("BUNDLE_")
|
95
|
+
|
92
96
|
@global_config = load_config(global_config_file)
|
93
97
|
@temporary = {}
|
94
98
|
end
|
95
99
|
|
96
100
|
def [](name)
|
97
101
|
key = key_for(name)
|
98
|
-
|
102
|
+
|
103
|
+
value = nil
|
104
|
+
configs.each do |_, config|
|
105
|
+
value = config[key]
|
106
|
+
next if value.nil?
|
107
|
+
break
|
108
|
+
end
|
99
109
|
|
100
110
|
converted_value(value, name)
|
101
111
|
end
|
@@ -138,17 +148,22 @@ module Bundler
|
|
138
148
|
end
|
139
149
|
|
140
150
|
def all
|
141
|
-
keys = @temporary.keys
|
151
|
+
keys = @temporary.keys.union(@global_config.keys, @local_config.keys, @env_config.keys)
|
142
152
|
|
143
|
-
keys.map do |key|
|
144
|
-
key
|
145
|
-
|
153
|
+
keys.map! do |key|
|
154
|
+
key = key.delete_prefix("BUNDLE_")
|
155
|
+
key.gsub!("___", "-")
|
156
|
+
key.gsub!("__", ".")
|
157
|
+
key.downcase!
|
158
|
+
key
|
159
|
+
end.sort!
|
160
|
+
keys
|
146
161
|
end
|
147
162
|
|
148
163
|
def local_overrides
|
149
164
|
repos = {}
|
150
165
|
all.each do |k|
|
151
|
-
repos[
|
166
|
+
repos[k.delete_prefix("local.")] = self[k] if k.start_with?("local.")
|
152
167
|
end
|
153
168
|
repos
|
154
169
|
end
|
@@ -301,7 +316,7 @@ module Bundler
|
|
301
316
|
private
|
302
317
|
|
303
318
|
def configs
|
304
|
-
{
|
319
|
+
@configs ||= {
|
305
320
|
:temporary => @temporary,
|
306
321
|
:local => @local_config,
|
307
322
|
:env => @env_config,
|
@@ -327,16 +342,20 @@ module Bundler
|
|
327
342
|
end
|
328
343
|
|
329
344
|
def is_bool(name)
|
330
|
-
|
345
|
+
name = name.to_s
|
346
|
+
BOOL_KEYS.include?(name) || BOOL_KEYS.include?(parent_setting_for(name))
|
331
347
|
end
|
332
348
|
|
333
349
|
def is_string(name)
|
334
|
-
|
350
|
+
name = name.to_s
|
351
|
+
STRING_KEYS.include?(name) || name.start_with?("local.") || name.start_with?("mirror.") || name.start_with?("build.")
|
335
352
|
end
|
336
353
|
|
337
354
|
def to_bool(value)
|
338
355
|
case value
|
339
|
-
when
|
356
|
+
when String
|
357
|
+
value.match?(/\A(false|f|no|n|0|)\z/i) ? false : true
|
358
|
+
when nil, false
|
340
359
|
false
|
341
360
|
else
|
342
361
|
true
|
@@ -392,6 +411,8 @@ module Bundler
|
|
392
411
|
end
|
393
412
|
|
394
413
|
def converted_value(value, key)
|
414
|
+
key = key.to_s
|
415
|
+
|
395
416
|
if is_array(key)
|
396
417
|
to_array(value)
|
397
418
|
elsif value.nil?
|
@@ -482,8 +503,11 @@ module Bundler
|
|
482
503
|
|
483
504
|
def self.key_for(key)
|
484
505
|
key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
|
485
|
-
key = key.to_s.gsub(".", "__")
|
486
|
-
|
506
|
+
key = key.to_s.gsub(".", "__")
|
507
|
+
key.gsub!("-", "___")
|
508
|
+
key.upcase!
|
509
|
+
|
510
|
+
key.prepend("BUNDLE_")
|
487
511
|
end
|
488
512
|
|
489
513
|
# TODO: duplicates Rubygems#normalize_uri
|
@@ -43,6 +43,13 @@ module Bundler
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
class AmbiguousGitReference < GitError
|
47
|
+
def initialize(options)
|
48
|
+
msg = "Specification of branch or ref with tag is ambiguous. You specified #{options.inspect}"
|
49
|
+
super msg
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
46
53
|
# The GitProxy is responsible to interact with git repositories.
|
47
54
|
# All actions required by the Git source is encapsulated in this
|
48
55
|
# object.
|
@@ -53,10 +60,15 @@ module Bundler
|
|
53
60
|
def initialize(path, uri, options = {}, revision = nil, git = nil)
|
54
61
|
@path = path
|
55
62
|
@uri = uri
|
56
|
-
@branch = options["branch"]
|
57
63
|
@tag = options["tag"]
|
64
|
+
@branch = options["branch"]
|
58
65
|
@ref = options["ref"]
|
59
|
-
@
|
66
|
+
if @tag
|
67
|
+
raise AmbiguousGitReference.new(options) if @branch || @ref
|
68
|
+
@explicit_ref = @tag
|
69
|
+
else
|
70
|
+
@explicit_ref = @ref || @branch
|
71
|
+
end
|
60
72
|
@revision = revision
|
61
73
|
@git = git
|
62
74
|
@commit_ref = nil
|
@@ -88,6 +88,7 @@ module Bundler
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def self.from_lock(options)
|
91
|
+
options["remotes"] = Array(options.delete("remote")).reverse
|
91
92
|
new(options)
|
92
93
|
end
|
93
94
|
|
@@ -128,12 +129,12 @@ module Bundler
|
|
128
129
|
def specs
|
129
130
|
@specs ||= begin
|
130
131
|
# remote_specs usually generates a way larger Index than the other
|
131
|
-
# sources, and large_idx.
|
132
|
-
# small_idx.
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
132
|
+
# sources, and large_idx.merge! small_idx is way faster than
|
133
|
+
# small_idx.merge! large_idx.
|
134
|
+
index = @allow_remote ? remote_specs.dup : Index.new
|
135
|
+
index.merge!(cached_specs) if @allow_cached || @allow_remote
|
136
|
+
index.merge!(installed_specs) if @allow_local
|
137
|
+
index
|
137
138
|
end
|
138
139
|
end
|
139
140
|
|
@@ -237,7 +238,7 @@ module Bundler
|
|
237
238
|
end
|
238
239
|
|
239
240
|
def spec_names
|
240
|
-
if
|
241
|
+
if dependency_api_available?
|
241
242
|
remote_specs.spec_names
|
242
243
|
else
|
243
244
|
[]
|
@@ -245,7 +246,7 @@ module Bundler
|
|
245
246
|
end
|
246
247
|
|
247
248
|
def unmet_deps
|
248
|
-
if
|
249
|
+
if dependency_api_available?
|
249
250
|
remote_specs.unmet_dependency_names
|
250
251
|
else
|
251
252
|
[]
|
@@ -260,7 +261,6 @@ module Bundler
|
|
260
261
|
end
|
261
262
|
|
262
263
|
def double_check_for(unmet_dependency_names)
|
263
|
-
return unless @allow_remote
|
264
264
|
return unless dependency_api_available?
|
265
265
|
|
266
266
|
unmet_dependency_names = unmet_dependency_names.call
|
@@ -275,7 +275,9 @@ module Bundler
|
|
275
275
|
|
276
276
|
Bundler.ui.debug "Double checking for #{unmet_dependency_names || "all specs (due to the size of the request)"} in #{self}"
|
277
277
|
|
278
|
-
fetch_names(api_fetchers, unmet_dependency_names,
|
278
|
+
fetch_names(api_fetchers, unmet_dependency_names, remote_specs)
|
279
|
+
|
280
|
+
specs.use remote_specs
|
279
281
|
end
|
280
282
|
|
281
283
|
def dependency_names_to_double_check
|
@@ -379,7 +381,7 @@ module Bundler
|
|
379
381
|
|
380
382
|
def cached_specs
|
381
383
|
@cached_specs ||= begin
|
382
|
-
idx =
|
384
|
+
idx = Index.new
|
383
385
|
|
384
386
|
Dir["#{cache_path}/*.gem"].each do |gemfile|
|
385
387
|
s ||= Bundler.rubygems.spec_from_gem(gemfile)
|
@@ -392,35 +394,30 @@ module Bundler
|
|
392
394
|
end
|
393
395
|
|
394
396
|
def api_fetchers
|
395
|
-
fetchers.select
|
397
|
+
fetchers.select(&:api_fetcher?)
|
396
398
|
end
|
397
399
|
|
398
400
|
def remote_specs
|
399
401
|
@remote_specs ||= Index.build do |idx|
|
400
402
|
index_fetchers = fetchers - api_fetchers
|
401
403
|
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
# uses the dependency API but others don't. So use full indexes
|
408
|
-
# consistently in that particular case.
|
409
|
-
allow_api = !multiple_remotes?
|
410
|
-
|
411
|
-
fetch_names(api_fetchers, allow_api && dependency_names, idx, false)
|
404
|
+
if index_fetchers.empty?
|
405
|
+
fetch_names(api_fetchers, dependency_names, idx)
|
406
|
+
else
|
407
|
+
fetch_names(fetchers, nil, idx)
|
408
|
+
end
|
412
409
|
end
|
413
410
|
end
|
414
411
|
|
415
|
-
def fetch_names(fetchers, dependency_names, index
|
412
|
+
def fetch_names(fetchers, dependency_names, index)
|
416
413
|
fetchers.each do |f|
|
417
414
|
if dependency_names
|
418
415
|
Bundler.ui.info "Fetching gem metadata from #{URICredentialsFilter.credential_filtered_uri(f.uri)}", Bundler.ui.debug?
|
419
|
-
index.use f.specs_with_retry(dependency_names, self)
|
416
|
+
index.use f.specs_with_retry(dependency_names, self)
|
420
417
|
Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
|
421
418
|
else
|
422
419
|
Bundler.ui.info "Fetching source index from #{URICredentialsFilter.credential_filtered_uri(f.uri)}"
|
423
|
-
index.use f.specs_with_retry(nil, self)
|
420
|
+
index.use f.specs_with_retry(nil, self)
|
424
421
|
end
|
425
422
|
end
|
426
423
|
end
|
@@ -27,7 +27,7 @@ class Gem::AvailableSet
|
|
27
27
|
s = o.set
|
28
28
|
when Array
|
29
29
|
s = o.map do |sp,so|
|
30
|
-
if !sp.
|
30
|
+
if !sp.is_a?(Gem::Specification) || !so.is_a?(Gem::Source)
|
31
31
|
raise TypeError, "Array must be in [[spec, source], ...] form"
|
32
32
|
end
|
33
33
|
|
@@ -133,9 +133,9 @@ class Gem::BasicSpecification
|
|
133
133
|
|
134
134
|
def full_name
|
135
135
|
if platform == Gem::Platform::RUBY || platform.nil?
|
136
|
-
"#{name}-#{version}".
|
136
|
+
(+"#{name}-#{version}").tap(&Gem::UNTAINT)
|
137
137
|
else
|
138
|
-
"#{name}-#{version}-#{platform}".
|
138
|
+
(+"#{name}-#{version}-#{platform}").tap(&Gem::UNTAINT)
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
data/lib/rubygems/command.rb
CHANGED
@@ -94,7 +94,7 @@ class Gem::Command
|
|
94
94
|
# array or a string to be split on white space.
|
95
95
|
|
96
96
|
def self.add_specific_extra_args(cmd,args)
|
97
|
-
args = args.split(/\s+/) if args.
|
97
|
+
args = args.split(/\s+/) if args.is_a? String
|
98
98
|
specific_extra_args_hash[cmd] = args
|
99
99
|
end
|
100
100
|
|
@@ -398,22 +398,21 @@ class Gem::Command
|
|
398
398
|
|
399
399
|
def check_deprecated_options(options)
|
400
400
|
options.each do |option|
|
401
|
-
|
402
|
-
|
403
|
-
|
401
|
+
next unless option_is_deprecated?(option)
|
402
|
+
deprecation = @deprecated_options[command][option]
|
403
|
+
version_to_expire = deprecation["rg_version_to_expire"]
|
404
404
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
405
|
+
deprecate_option_msg = if version_to_expire
|
406
|
+
"The \"#{option}\" option has been deprecated and will be removed in Rubygems #{version_to_expire}."
|
407
|
+
else
|
408
|
+
"The \"#{option}\" option has been deprecated and will be removed in future versions of Rubygems."
|
409
|
+
end
|
410
410
|
|
411
|
-
|
411
|
+
extra_msg = deprecation["extra_msg"]
|
412
412
|
|
413
|
-
|
413
|
+
deprecate_option_msg += " #{extra_msg}" if extra_msg
|
414
414
|
|
415
|
-
|
416
|
-
end
|
415
|
+
alert_warning(deprecate_option_msg)
|
417
416
|
end
|
418
417
|
end
|
419
418
|
|
@@ -430,12 +429,10 @@ class Gem::Command
|
|
430
429
|
# True if the command handles the given argument list.
|
431
430
|
|
432
431
|
def handles?(args)
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
return false
|
438
|
-
end
|
432
|
+
parser.parse!(args.dup)
|
433
|
+
return true
|
434
|
+
rescue
|
435
|
+
return false
|
439
436
|
end
|
440
437
|
|
441
438
|
##
|
@@ -91,10 +91,9 @@ use with other commands.
|
|
91
91
|
|
92
92
|
def display_pipe(specs) # :nodoc:
|
93
93
|
specs.each do |spec|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
end
|
94
|
+
next if spec.dependencies.empty?
|
95
|
+
spec.dependencies.sort_by {|dep| dep.name }.each do |dep|
|
96
|
+
say "#{dep.name} --version '#{dep.requirement}'"
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|
@@ -94,16 +94,14 @@ permission to.
|
|
94
94
|
|
95
95
|
def manage_owners(method, name, owners)
|
96
96
|
owners.each do |owner|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
# ignore early exits to allow for completing the iteration of all owners
|
106
|
-
end
|
97
|
+
response = send_owner_request(method, name, owner)
|
98
|
+
action = method == :delete ? "Removing" : "Adding"
|
99
|
+
|
100
|
+
with_response response, "#{action} #{owner}"
|
101
|
+
rescue Gem::WebauthnVerificationError => e
|
102
|
+
raise e
|
103
|
+
rescue StandardError
|
104
|
+
# ignore early exits to allow for completing the iteration of all owners
|
107
105
|
end
|
108
106
|
end
|
109
107
|
|
@@ -169,15 +169,14 @@ that is a dependency of an existing gem. You can use the
|
|
169
169
|
gems_to_uninstall = {}
|
170
170
|
|
171
171
|
deps.each do |dep|
|
172
|
-
|
173
|
-
|
172
|
+
next if gems_to_uninstall[dep.name]
|
173
|
+
gems_to_uninstall[dep.name] = true
|
174
174
|
|
175
|
-
|
176
|
-
|
177
|
-
end
|
178
|
-
|
179
|
-
uninstall_gem(dep.name)
|
175
|
+
unless original_gem_version[dep.name] == Gem::Requirement.default
|
176
|
+
options[:version] = dep.version
|
180
177
|
end
|
178
|
+
|
179
|
+
uninstall_gem(dep.name)
|
181
180
|
end
|
182
181
|
end
|
183
182
|
|
@@ -96,12 +96,10 @@ command help for an example.
|
|
96
96
|
|
97
97
|
FileUtils.mkdir_p @options[:target] if @options[:target]
|
98
98
|
|
99
|
-
destination =
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
spec_file
|
104
|
-
end
|
99
|
+
destination = if @options[:target]
|
100
|
+
File.join @options[:target], spec_file
|
101
|
+
else
|
102
|
+
spec_file
|
105
103
|
end
|
106
104
|
|
107
105
|
File.open destination, "w" do |io|
|
data/lib/rubygems/config_file.rb
CHANGED
@@ -353,7 +353,7 @@ if you believe they were disclosed to a third party.
|
|
353
353
|
|
354
354
|
begin
|
355
355
|
content = Gem::SafeYAML.load(File.read(filename))
|
356
|
-
unless content.
|
356
|
+
unless content.is_a? Hash
|
357
357
|
warn "Failed to load #{filename} because it doesn't contain valid YAML hash"
|
358
358
|
return {}
|
359
359
|
end
|
@@ -37,7 +37,7 @@ module Kernel
|
|
37
37
|
skip_list = (ENV["GEM_SKIP"] || "").split(/:/)
|
38
38
|
raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
|
39
39
|
|
40
|
-
if gem_name.
|
40
|
+
if gem_name.is_a? Gem::Dependency
|
41
41
|
unless Gem::Deprecate.skip
|
42
42
|
warn "#{Gem.location_of_caller.join ':'}:Warning: Kernel.gem no longer "\
|
43
43
|
"accepts a Gem::Dependency object, please pass the name "\
|
@@ -35,11 +35,10 @@ module Kernel
|
|
35
35
|
|
36
36
|
start += 1
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
38
|
+
next unless path = loc.path
|
39
|
+
unless path.start_with?(rubygems_path) || path.start_with?("<internal:")
|
40
|
+
# Non-rubygems frames
|
41
|
+
uplevel -= 1
|
43
42
|
end
|
44
43
|
end
|
45
44
|
kw[:uplevel] = start
|
@@ -163,13 +163,11 @@ class Gem::DependencyInstaller
|
|
163
163
|
|
164
164
|
specs = []
|
165
165
|
tuples.each do |tup, source|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
specs << [spec, source]
|
172
|
-
end
|
166
|
+
spec = source.fetch_spec(tup)
|
167
|
+
rescue Gem::RemoteFetcher::FetchError => e
|
168
|
+
errors << Gem::SourceFetchProblem.new(source, e)
|
169
|
+
else
|
170
|
+
specs << [spec, source]
|
173
171
|
end
|
174
172
|
|
175
173
|
if @errors
|
@@ -296,11 +294,9 @@ class Gem::DependencyInstaller
|
|
296
294
|
version = src.spec.version if version == Gem::Requirement.default
|
297
295
|
elsif dep_or_name =~ /\.gem$/
|
298
296
|
Dir[dep_or_name].each do |name|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
rescue Gem::Package::FormatError
|
303
|
-
end
|
297
|
+
src = Gem::Source::SpecificFile.new name
|
298
|
+
installer_set.add_local dep_or_name, src.spec, src
|
299
|
+
rescue Gem::Package::FormatError
|
304
300
|
end
|
305
301
|
# else This is a dependency. InstallerSet handles this case
|
306
302
|
end
|
data/lib/rubygems/deprecate.rb
CHANGED
@@ -104,7 +104,7 @@ module Gem::Deprecate
|
|
104
104
|
old = "_deprecated_#{name}"
|
105
105
|
alias_method old, name
|
106
106
|
define_method name do |*args, &block|
|
107
|
-
klass = self.
|
107
|
+
klass = self.is_a? Module
|
108
108
|
target = klass ? "#{self}." : "#{self.class}#"
|
109
109
|
msg = [ "NOTE: #{target}#{name} is deprecated",
|
110
110
|
repl == :none ? " with no replacement" : "; use #{repl} instead",
|
@@ -129,7 +129,7 @@ module Gem::Deprecate
|
|
129
129
|
old = "_deprecated_#{name}"
|
130
130
|
alias_method old, name
|
131
131
|
define_method name do |*args, &block|
|
132
|
-
klass = self.
|
132
|
+
klass = self.is_a? Module
|
133
133
|
target = klass ? "#{self}." : "#{self.class}#"
|
134
134
|
msg = [ "NOTE: #{target}#{name} is deprecated",
|
135
135
|
replacement == :none ? " with no replacement" : "; use #{replacement} instead",
|
@@ -120,7 +120,7 @@ module Gem::GemcutterUtilities
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def mfa_unauthorized?(response)
|
123
|
-
response.
|
123
|
+
response.is_a?(Net::HTTPUnauthorized) && response.body.start_with?("You have enabled multifactor authentication")
|
124
124
|
end
|
125
125
|
|
126
126
|
def update_scope(scope)
|
@@ -367,6 +367,6 @@ module Gem::GemcutterUtilities
|
|
367
367
|
end
|
368
368
|
|
369
369
|
def api_key_forbidden?(response)
|
370
|
-
response.
|
370
|
+
response.is_a?(Net::HTTPForbidden) && response.body.start_with?("The API key doesn't have access")
|
371
371
|
end
|
372
372
|
end
|
data/lib/rubygems/installer.rb
CHANGED
@@ -357,25 +357,23 @@ class Gem::Installer
|
|
357
357
|
|
358
358
|
def run_pre_install_hooks # :nodoc:
|
359
359
|
Gem.pre_install_hooks.each do |hook|
|
360
|
-
|
361
|
-
|
360
|
+
next unless hook.call(self) == false
|
361
|
+
location = " at #{$1}" if hook.inspect =~ /[ @](.*:\d+)/
|
362
362
|
|
363
|
-
|
364
|
-
|
365
|
-
end
|
363
|
+
message = "pre-install hook#{location} failed for #{spec.full_name}"
|
364
|
+
raise Gem::InstallError, message
|
366
365
|
end
|
367
366
|
end
|
368
367
|
|
369
368
|
def run_post_build_hooks # :nodoc:
|
370
369
|
Gem.post_build_hooks.each do |hook|
|
371
|
-
|
372
|
-
|
370
|
+
next unless hook.call(self) == false
|
371
|
+
FileUtils.rm_rf gem_dir
|
373
372
|
|
374
|
-
|
373
|
+
location = " at #{$1}" if hook.inspect =~ /[ @](.*:\d+)/
|
375
374
|
|
376
|
-
|
377
|
-
|
378
|
-
end
|
375
|
+
message = "post-build hook#{location} failed for #{spec.full_name}"
|
376
|
+
raise Gem::InstallError, message
|
379
377
|
end
|
380
378
|
end
|
381
379
|
|