rubygems-update 3.3.19 → 3.3.20

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.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/bin/update_rubygems +1 -1
  4. data/bundler/CHANGELOG.md +26 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/install.rb +5 -2
  7. data/bundler/lib/bundler/cli/outdated.rb +12 -3
  8. data/bundler/lib/bundler/cli/platform.rb +1 -1
  9. data/bundler/lib/bundler/cli.rb +5 -3
  10. data/bundler/lib/bundler/definition.rb +61 -11
  11. data/bundler/lib/bundler/fetcher.rb +6 -6
  12. data/bundler/lib/bundler/gem_helpers.rb +7 -1
  13. data/bundler/lib/bundler/installer/standalone.rb +1 -1
  14. data/bundler/lib/bundler/installer.rb +8 -1
  15. data/bundler/lib/bundler/lazy_specification.rb +21 -21
  16. data/bundler/lib/bundler/man/bundle-cache.1 +6 -0
  17. data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
  18. data/bundler/lib/bundler/man/bundle-config.1 +2 -2
  19. data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
  20. data/bundler/lib/bundler/man/bundle-install.1 +4 -0
  21. data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -0
  22. data/bundler/lib/bundler/man/bundle-platform.1 +15 -5
  23. data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
  24. data/bundler/lib/bundler/man/bundle.1 +3 -6
  25. data/bundler/lib/bundler/man/bundle.1.ronn +3 -4
  26. data/bundler/lib/bundler/resolver.rb +2 -1
  27. data/bundler/lib/bundler/ruby_dsl.rb +1 -1
  28. data/bundler/lib/bundler/ruby_version.rb +5 -5
  29. data/bundler/lib/bundler/rubygems_ext.rb +13 -0
  30. data/bundler/lib/bundler/source/metadata.rb +1 -1
  31. data/bundler/lib/bundler/source_list.rb +4 -0
  32. data/bundler/lib/bundler/spec_set.rb +15 -28
  33. data/bundler/lib/bundler/version.rb +1 -1
  34. data/lib/rubygems/available_set.rb +3 -3
  35. data/lib/rubygems/basic_specification.rb +2 -2
  36. data/lib/rubygems/command.rb +6 -6
  37. data/lib/rubygems/commands/cert_command.rb +1 -1
  38. data/lib/rubygems/commands/cleanup_command.rb +1 -1
  39. data/lib/rubygems/commands/contents_command.rb +1 -1
  40. data/lib/rubygems/commands/dependency_command.rb +4 -4
  41. data/lib/rubygems/commands/fetch_command.rb +2 -2
  42. data/lib/rubygems/commands/generate_index_command.rb +2 -2
  43. data/lib/rubygems/commands/install_command.rb +7 -7
  44. data/lib/rubygems/commands/pristine_command.rb +5 -5
  45. data/lib/rubygems/commands/setup_command.rb +4 -4
  46. data/lib/rubygems/commands/sources_command.rb +3 -3
  47. data/lib/rubygems/commands/specification_command.rb +2 -2
  48. data/lib/rubygems/commands/uninstall_command.rb +4 -4
  49. data/lib/rubygems/commands/update_command.rb +5 -5
  50. data/lib/rubygems/commands/which_command.rb +1 -1
  51. data/lib/rubygems/config_file.rb +7 -7
  52. data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
  53. data/lib/rubygems/defaults.rb +1 -1
  54. data/lib/rubygems/dependency.rb +5 -5
  55. data/lib/rubygems/dependency_installer.rb +5 -5
  56. data/lib/rubygems/dependency_list.rb +4 -4
  57. data/lib/rubygems/doctor.rb +4 -4
  58. data/lib/rubygems/exceptions.rb +1 -1
  59. data/lib/rubygems/ext/ext_conf_builder.rb +2 -2
  60. data/lib/rubygems/gemcutter_utilities.rb +1 -1
  61. data/lib/rubygems/indexer.rb +3 -3
  62. data/lib/rubygems/installer.rb +5 -13
  63. data/lib/rubygems/name_tuple.rb +3 -3
  64. data/lib/rubygems/package/tar_header.rb +17 -17
  65. data/lib/rubygems/package/tar_writer.rb +1 -1
  66. data/lib/rubygems/package.rb +19 -8
  67. data/lib/rubygems/platform.rb +15 -15
  68. data/lib/rubygems/query_utils.rb +6 -6
  69. data/lib/rubygems/remote_fetcher.rb +3 -3
  70. data/lib/rubygems/request/connection_pools.rb +2 -2
  71. data/lib/rubygems/request/http_pool.rb +1 -1
  72. data/lib/rubygems/request.rb +1 -1
  73. data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
  74. data/lib/rubygems/request_set/lockfile/parser.rb +12 -12
  75. data/lib/rubygems/request_set/lockfile/tokenizer.rb +2 -2
  76. data/lib/rubygems/request_set.rb +3 -3
  77. data/lib/rubygems/requirement.rb +1 -1
  78. data/lib/rubygems/resolver/api_specification.rb +4 -4
  79. data/lib/rubygems/resolver/best_set.rb +3 -3
  80. data/lib/rubygems/resolver/conflict.rb +3 -3
  81. data/lib/rubygems/resolver/git_specification.rb +3 -3
  82. data/lib/rubygems/resolver/index_specification.rb +3 -2
  83. data/lib/rubygems/resolver/installed_specification.rb +2 -2
  84. data/lib/rubygems/resolver/installer_set.rb +7 -12
  85. data/lib/rubygems/resolver/lock_set.rb +1 -1
  86. data/lib/rubygems/resolver/lock_specification.rb +1 -1
  87. data/lib/rubygems/resolver/vendor_specification.rb +3 -3
  88. data/lib/rubygems/resolver.rb +4 -4
  89. data/lib/rubygems/security/policy.rb +6 -6
  90. data/lib/rubygems/security/signer.rb +1 -1
  91. data/lib/rubygems/security.rb +1 -1
  92. data/lib/rubygems/source/git.rb +4 -4
  93. data/lib/rubygems/source.rb +1 -1
  94. data/lib/rubygems/spec_fetcher.rb +1 -1
  95. data/lib/rubygems/specification.rb +26 -24
  96. data/lib/rubygems/specification_policy.rb +4 -4
  97. data/lib/rubygems/uninstaller.rb +4 -4
  98. data/lib/rubygems/user_interaction.rb +2 -2
  99. data/lib/rubygems/version.rb +12 -4
  100. data/lib/rubygems.rb +8 -8
  101. data/rubygems-update.gemspec +1 -1
  102. data/setup.rb +1 -1
  103. data/test/rubygems/helper.rb +5 -5
  104. data/test/rubygems/test_gem_config_file.rb +17 -5
  105. data/test/rubygems/test_gem_dependency_installer.rb +2 -2
  106. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +4 -4
  107. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
  108. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +1 -1
  109. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +4 -4
  110. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
  111. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +1 -1
  112. data/test/rubygems/test_gem_installer.rb +6 -3
  113. data/test/rubygems/test_gem_package.rb +22 -0
  114. data/test/rubygems/test_gem_package_tar_reader.rb +1 -1
  115. data/test/rubygems/test_gem_requirement.rb +9 -3
  116. data/test/rubygems/test_gem_resolver_index_specification.rb +1 -1
  117. data/test/rubygems/test_gem_resolver_installer_set.rb +44 -0
  118. data/test/rubygems/test_gem_specification.rb +11 -2
  119. data/test/rubygems/test_gem_version.rb +9 -2
  120. data/test/rubygems/test_require.rb +1 -1
  121. data/test/rubygems/utilities.rb +4 -4
  122. metadata +3 -3
@@ -473,7 +473,7 @@ class Gem::Specification < Gem::BasicSpecification
473
473
  # spec.platform = Gem::Platform.local
474
474
 
475
475
  def platform=(platform)
476
- if @original_platform.nil? or
476
+ if @original_platform.nil? ||
477
477
  @original_platform == Gem::Platform::RUBY
478
478
  @original_platform = platform
479
479
  end
@@ -1046,7 +1046,7 @@ class Gem::Specification < Gem::BasicSpecification
1046
1046
 
1047
1047
  def self.find_active_stub_by_path(path)
1048
1048
  stub = @@active_stub_with_requirable_file[path] ||= (stubs.find do |s|
1049
- s.activated? and s.contains_requirable_file? path
1049
+ s.activated? && s.contains_requirable_file?(path)
1050
1050
  end || NOT_FOUND)
1051
1051
  stub.this
1052
1052
  end
@@ -1234,7 +1234,7 @@ class Gem::Specification < Gem::BasicSpecification
1234
1234
  latest_remote = remotes.sort.last
1235
1235
 
1236
1236
  yield [local_spec, latest_remote] if
1237
- latest_remote and local_spec.version < latest_remote
1237
+ latest_remote && local_spec.version < latest_remote
1238
1238
  end
1239
1239
 
1240
1240
  nil
@@ -1557,7 +1557,7 @@ class Gem::Specification < Gem::BasicSpecification
1557
1557
  # Singular reader for #authors. Returns the first author in the list
1558
1558
 
1559
1559
  def author
1560
- val = authors and val.first
1560
+ (val = authors) && val.first
1561
1561
  end
1562
1562
 
1563
1563
  ##
@@ -1669,7 +1669,7 @@ class Gem::Specification < Gem::BasicSpecification
1669
1669
  conflicts = {}
1670
1670
  self.runtime_dependencies.each do |dep|
1671
1671
  spec = Gem.loaded_specs[dep.name]
1672
- if spec and not spec.satisfies_requirement? dep
1672
+ if spec && !spec.satisfies_requirement?(dep)
1673
1673
  (conflicts[spec] ||= []) << dep
1674
1674
  end
1675
1675
  end
@@ -1696,7 +1696,7 @@ class Gem::Specification < Gem::BasicSpecification
1696
1696
  self.dependencies.any? do |dep|
1697
1697
  if dep.runtime?
1698
1698
  spec = Gem.loaded_specs[dep.name]
1699
- spec and not spec.satisfies_requirement? dep
1699
+ spec && !spec.satisfies_requirement?(dep)
1700
1700
  else
1701
1701
  false
1702
1702
  end
@@ -1717,7 +1717,7 @@ class Gem::Specification < Gem::BasicSpecification
1717
1717
 
1718
1718
  DateLike = Object.new # :nodoc:
1719
1719
  def DateLike.===(obj) # :nodoc:
1720
- defined?(::Date) and Date === obj
1720
+ defined?(::Date) && Date === obj
1721
1721
  end
1722
1722
 
1723
1723
  DateTimeFormat = # :nodoc:
@@ -1757,9 +1757,9 @@ class Gem::Specification < Gem::BasicSpecification
1757
1757
  # executable now. See Gem.bin_path.
1758
1758
 
1759
1759
  def default_executable # :nodoc:
1760
- if defined?(@default_executable) and @default_executable
1760
+ if defined?(@default_executable) && @default_executable
1761
1761
  result = @default_executable
1762
- elsif @executables and @executables.size == 1
1762
+ elsif @executables && @executables.size == 1
1763
1763
  result = Array(@executables).first
1764
1764
  else
1765
1765
  result = nil
@@ -1876,7 +1876,7 @@ class Gem::Specification < Gem::BasicSpecification
1876
1876
  # Singular accessor for #executables
1877
1877
 
1878
1878
  def executable
1879
- val = executables and val.first
1879
+ (val = executables) && val.first
1880
1880
  end
1881
1881
 
1882
1882
  ##
@@ -1988,7 +1988,7 @@ class Gem::Specification < Gem::BasicSpecification
1988
1988
  # True if this gem has files in test_files
1989
1989
 
1990
1990
  def has_unit_tests? # :nodoc:
1991
- not test_files.empty?
1991
+ !test_files.empty?
1992
1992
  end
1993
1993
 
1994
1994
  # :stopdoc:
@@ -2041,7 +2041,7 @@ class Gem::Specification < Gem::BasicSpecification
2041
2041
  self.name = name if name
2042
2042
  self.version = version if version
2043
2043
 
2044
- if platform = Gem.platforms.last and platform != Gem::Platform::RUBY and platform != Gem::Platform.local
2044
+ if (platform = Gem.platforms.last) && platform != Gem::Platform::RUBY && platform != Gem::Platform.local
2045
2045
  self.platform = platform
2046
2046
  end
2047
2047
 
@@ -2156,8 +2156,8 @@ class Gem::Specification < Gem::BasicSpecification
2156
2156
  return
2157
2157
  end
2158
2158
 
2159
- if @specification_version > CURRENT_SPECIFICATION_VERSION and
2160
- sym.to_s.end_with?("=")
2159
+ if @specification_version > CURRENT_SPECIFICATION_VERSION &&
2160
+ sym.to_s.end_with?("=")
2161
2161
  warn "ignoring #{sym} loading #{full_name}" if $DEBUG
2162
2162
  else
2163
2163
  super
@@ -2183,7 +2183,7 @@ class Gem::Specification < Gem::BasicSpecification
2183
2183
  # file list.
2184
2184
 
2185
2185
  def normalize
2186
- if defined?(@extra_rdoc_files) and @extra_rdoc_files
2186
+ if defined?(@extra_rdoc_files) && @extra_rdoc_files
2187
2187
  @extra_rdoc_files.uniq!
2188
2188
  @files ||= []
2189
2189
  @files.concat(@extra_rdoc_files)
@@ -2208,7 +2208,7 @@ class Gem::Specification < Gem::BasicSpecification
2208
2208
  # platform. For use with legacy gems.
2209
2209
 
2210
2210
  def original_name # :nodoc:
2211
- if platform == Gem::Platform::RUBY or platform.nil?
2211
+ if platform == Gem::Platform::RUBY || platform.nil?
2212
2212
  "#{@name}-#{@version}"
2213
2213
  else
2214
2214
  "#{@name}-#{@version}-#{@original_platform}"
@@ -2241,8 +2241,8 @@ class Gem::Specification < Gem::BasicSpecification
2241
2241
  attributes.each do |attr_name|
2242
2242
  current_value = self.send attr_name
2243
2243
  current_value = current_value.sort if %i[files test_files].include? attr_name
2244
- if current_value != default_value(attr_name) or
2245
- self.class.required_attribute? attr_name
2244
+ if current_value != default_value(attr_name) ||
2245
+ self.class.required_attribute?(attr_name)
2246
2246
 
2247
2247
  q.text "s.#{attr_name} = "
2248
2248
 
@@ -2300,7 +2300,7 @@ class Gem::Specification < Gem::BasicSpecification
2300
2300
  # Singular accessor for #require_paths
2301
2301
 
2302
2302
  def require_path
2303
- val = require_paths and val.first
2303
+ (val = require_paths) && val.first
2304
2304
  end
2305
2305
 
2306
2306
  ##
@@ -2375,7 +2375,7 @@ class Gem::Specification < Gem::BasicSpecification
2375
2375
 
2376
2376
  def satisfies_requirement?(dependency)
2377
2377
  return @name == dependency.name &&
2378
- dependency.requirement.satisfied_by?(@version)
2378
+ dependency.requirement.satisfied_by?(@version)
2379
2379
  end
2380
2380
 
2381
2381
  ##
@@ -2429,7 +2429,7 @@ class Gem::Specification < Gem::BasicSpecification
2429
2429
  # Singular accessor for #test_files
2430
2430
 
2431
2431
  def test_file # :nodoc:
2432
- val = test_files and val.first
2432
+ (val = test_files) && val.first
2433
2433
  end
2434
2434
 
2435
2435
  ##
@@ -2451,7 +2451,7 @@ class Gem::Specification < Gem::BasicSpecification
2451
2451
  @test_files = [@test_suite_file].flatten
2452
2452
  @test_suite_file = nil
2453
2453
  end
2454
- if defined?(@test_files) and @test_files
2454
+ if defined?(@test_files) && @test_files
2455
2455
  @test_files
2456
2456
  else
2457
2457
  @test_files = []
@@ -2475,13 +2475,13 @@ class Gem::Specification < Gem::BasicSpecification
2475
2475
 
2476
2476
  result << " s.name = #{ruby_code name}"
2477
2477
  result << " s.version = #{ruby_code version}"
2478
- unless platform.nil? or platform == Gem::Platform::RUBY
2478
+ unless platform.nil? || platform == Gem::Platform::RUBY
2479
2479
  result << " s.platform = #{ruby_code original_platform}"
2480
2480
  end
2481
2481
  result << ""
2482
2482
  result << " s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version="
2483
2483
 
2484
- if metadata and !metadata.empty?
2484
+ if metadata && !metadata.empty?
2485
2485
  result << " s.metadata = #{ruby_code metadata} if s.respond_to? :metadata="
2486
2486
  end
2487
2487
  result << " s.require_paths = #{ruby_code raw_require_paths}"
@@ -2665,6 +2665,8 @@ class Gem::Specification < Gem::BasicSpecification
2665
2665
 
2666
2666
  def version=(version)
2667
2667
  @version = Gem::Version.create(version)
2668
+ return if @version.nil?
2669
+
2668
2670
  # skip to set required_ruby_version when pre-released rubygems.
2669
2671
  # It caused to raise CircularDependencyError
2670
2672
  if @version.prerelease? && (@name.nil? || @name.strip != "rubygems")
@@ -188,7 +188,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
188
188
  prerelease_dep && !@specification.version.prerelease?
189
189
 
190
190
  open_ended = dep.requirement.requirements.all? do |op, version|
191
- not version.prerelease? and (op == ">" or op == ">=")
191
+ !version.prerelease? && (op == ">" || op == ">=")
192
192
  end
193
193
 
194
194
  if open_ended
@@ -203,7 +203,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
203
203
  else
204
204
  bugfix = if op == ">"
205
205
  ", '> #{dep_version}'"
206
- elsif op == ">=" and base != segments
206
+ elsif op == ">=" && base != segments
207
207
  ", '>= #{dep_version}'"
208
208
  end
209
209
 
@@ -338,7 +338,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
338
338
  String
339
339
  end
340
340
 
341
- unless Array === val and val.all? {|x| x.kind_of?(klass) }
341
+ unless Array === val && val.all? {|x| x.kind_of?(klass) }
342
342
  error "#{field} must be an Array of #{klass}"
343
343
  end
344
344
  end
@@ -404,7 +404,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
404
404
  homepage = @specification.homepage
405
405
 
406
406
  # Make sure a homepage is valid HTTP/HTTPS URI
407
- if homepage and not homepage.empty?
407
+ if homepage && !homepage.empty?
408
408
  require "uri"
409
409
  begin
410
410
  homepage_uri = URI.parse(homepage)
@@ -105,8 +105,8 @@ class Gem::Uninstaller
105
105
  @default_specs_matching_uninstall_params = default_specs
106
106
 
107
107
  list, other_repo_specs = list.partition do |spec|
108
- @gem_home == spec.base_dir or
109
- (@user_install and spec.base_dir == Gem.user_dir)
108
+ @gem_home == spec.base_dir ||
109
+ (@user_install && spec.base_dir == Gem.user_dir)
110
110
  end
111
111
 
112
112
  list.sort!
@@ -239,8 +239,8 @@ class Gem::Uninstaller
239
239
  # spec:: the spec of the gem to be uninstalled
240
240
 
241
241
  def remove(spec)
242
- unless path_ok?(@gem_home, spec) or
243
- (@user_install and path_ok?(Gem.user_dir, spec))
242
+ unless path_ok?(@gem_home, spec) ||
243
+ (@user_install && path_ok?(Gem.user_dir, spec))
244
244
  e = Gem::GemNotInHomeException.new \
245
245
  "Gem '#{spec.full_name}' is not installed in directory #{@gem_home}"
246
246
  e.spec = spec
@@ -284,7 +284,7 @@ class Gem::StreamUI
284
284
  # Ask a question. Returns an answer if connected to a tty, nil otherwise.
285
285
 
286
286
  def ask(question)
287
- return nil if not tty?
287
+ return nil if !tty?
288
288
 
289
289
  @outs.print(question + " ")
290
290
  @outs.flush
@@ -298,7 +298,7 @@ class Gem::StreamUI
298
298
  # Ask for a password. Does not echo response to terminal.
299
299
 
300
300
  def ask_for_password(question)
301
- return nil if not tty?
301
+ return nil if !tty?
302
302
 
303
303
  @outs.print(question, " ")
304
304
  @outs.flush
@@ -171,9 +171,7 @@ class Gem::Version
171
171
  # True if the +version+ string matches RubyGems' requirements.
172
172
 
173
173
  def self.correct?(version)
174
- unless Gem::Deprecate.skip
175
- warn "nil versions are discouraged and will be deprecated in Rubygems 4" if version.nil?
176
- end
174
+ nil_versions_are_discouraged! if version.nil?
177
175
 
178
176
  !!(version.to_s =~ ANCHORED_VERSION_PATTERN)
179
177
  end
@@ -190,6 +188,8 @@ class Gem::Version
190
188
  if self === input # check yourself before you wreck yourself
191
189
  input
192
190
  elsif input.nil?
191
+ nil_versions_are_discouraged!
192
+
193
193
  nil
194
194
  else
195
195
  new input
@@ -206,6 +206,14 @@ class Gem::Version
206
206
  @@all[version] ||= super
207
207
  end
208
208
 
209
+ def self.nil_versions_are_discouraged!
210
+ unless Gem::Deprecate.skip
211
+ warn "nil versions are discouraged and will be deprecated in Rubygems 4"
212
+ end
213
+ end
214
+
215
+ private_class_method :nil_versions_are_discouraged!
216
+
209
217
  ##
210
218
  # Constructs a Version from the +version+ string. A version string is a
211
219
  # series of digits or ASCII letters separated by dots.
@@ -244,7 +252,7 @@ class Gem::Version
244
252
  # same precision. Version "1.0" is not the same as version "1".
245
253
 
246
254
  def eql?(other)
247
- self.class === other and @version == other._version
255
+ self.class === other && @version == other._version
248
256
  end
249
257
 
250
258
  def hash # :nodoc:
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require "rbconfig"
9
9
 
10
10
  module Gem
11
- VERSION = "3.3.19".freeze
11
+ VERSION = "3.3.20".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -121,7 +121,7 @@ module Gem
121
121
 
122
122
  # When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn
123
123
  KERNEL_WARN_IGNORES_INTERNAL_ENTRIES = RUBY_ENGINE == "truffleruby" ||
124
- (RUBY_ENGINE == "ruby" && RUBY_VERSION >= "3.0")
124
+ (RUBY_ENGINE == "ruby" && RUBY_VERSION >= "3.0")
125
125
 
126
126
  ##
127
127
  # An Array of Regexps that match windows Ruby platforms.
@@ -741,8 +741,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
741
741
  def self.prefix
742
742
  prefix = File.dirname RUBYGEMS_DIR
743
743
 
744
- if prefix != File.expand_path(RbConfig::CONFIG["sitelibdir"]) and
745
- prefix != File.expand_path(RbConfig::CONFIG["libdir"]) and
744
+ if prefix != File.expand_path(RbConfig::CONFIG["sitelibdir"]) &&
745
+ prefix != File.expand_path(RbConfig::CONFIG["libdir"]) &&
746
746
  "lib" == File.basename(RUBYGEMS_DIR)
747
747
  prefix
748
748
  end
@@ -845,8 +845,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
845
845
  # Returns the latest release version of RubyGems.
846
846
 
847
847
  def self.latest_rubygems_version
848
- latest_version_for("rubygems-update") or
849
- raise "Can't find 'rubygems-update' in any repo. Check `gem source list`."
848
+ latest_version_for("rubygems-update") ||
849
+ raise("Can't find 'rubygems-update' in any repo. Check `gem source list`.")
850
850
  end
851
851
 
852
852
  ##
@@ -854,7 +854,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
854
854
 
855
855
  def self.latest_version_for(name)
856
856
  spec = latest_spec_for name
857
- spec and spec.version
857
+ spec && spec.version
858
858
  end
859
859
 
860
860
  ##
@@ -944,7 +944,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
944
944
  ".rb",
945
945
  *%w[DLEXT DLEXT2].map do |key|
946
946
  val = RbConfig::CONFIG[key]
947
- next unless val and not val.empty?
947
+ next unless val && !val.empty?
948
948
  ".#{val}"
949
949
  end,
950
950
  ].compact.uniq
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.3.19"
5
+ s.version = "3.3.20"
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
 
data/setup.rb CHANGED
@@ -7,7 +7,7 @@
7
7
  #++
8
8
 
9
9
  # Make sure rubygems isn't already loaded.
10
- if ENV["RUBYOPT"] or defined? Gem
10
+ if ENV["RUBYOPT"] || defined? Gem
11
11
  ENV.delete "RUBYOPT"
12
12
 
13
13
  require "rbconfig"
@@ -599,7 +599,7 @@ class Gem::TestCase < Test::Unit::TestCase
599
599
  end
600
600
 
601
601
  def in_path?(executable) # :nodoc:
602
- return true if %r{\A([A-Z]:|/)} =~ executable and File.exist? executable
602
+ return true if %r{\A([A-Z]:|/)} =~ executable && File.exist?(executable)
603
603
 
604
604
  ENV["PATH"].split(File::PATH_SEPARATOR).any? do |directory|
605
605
  File.exist? File.join directory, executable
@@ -849,7 +849,7 @@ class Gem::TestCase < Test::Unit::TestCase
849
849
  # or a +block+ can be given for full customization of the specification.
850
850
 
851
851
  def util_spec(name, version = 2, deps = nil, *files) # :yields: specification
852
- raise "deps or block, not both" if deps and block_given?
852
+ raise "deps or block, not both" if deps && block_given?
853
853
 
854
854
  spec = Gem::Specification.new do |s|
855
855
  s.platform = Gem::Platform::RUBY
@@ -1279,10 +1279,10 @@ Also, a list:
1279
1279
  rubyexe = "#{ruby}.exe"
1280
1280
 
1281
1281
  3.times do
1282
- if File.exist? ruby and File.executable? ruby and !File.directory? ruby
1282
+ if File.exist?(ruby) && File.executable?(ruby) && !File.directory?(ruby)
1283
1283
  return File.expand_path(ruby)
1284
1284
  end
1285
- if File.exist? rubyexe and File.executable? rubyexe
1285
+ if File.exist?(rubyexe) && File.executable?(rubyexe)
1286
1286
  return File.expand_path(rubyexe)
1287
1287
  end
1288
1288
  ruby = File.join("..", ruby)
@@ -1592,7 +1592,7 @@ class Object
1592
1592
 
1593
1593
  metaclass = class << self; self; end
1594
1594
 
1595
- if respond_to? name and not methods.map(&:to_s).include? name.to_s
1595
+ if respond_to?(name) && !methods.map(&:to_s).include?(name.to_s)
1596
1596
  metaclass.send :define_method, name do |*args|
1597
1597
  super(*args)
1598
1598
  end
@@ -35,7 +35,7 @@ class TestGemConfigFile < Gem::TestCase
35
35
  def test_initialize
36
36
  assert_equal @temp_conf, @cfg.config_file_name
37
37
 
38
- assert_equal false, @cfg.backtrace
38
+ assert_equal true, @cfg.backtrace
39
39
  assert_equal true, @cfg.update_sources
40
40
  assert_equal Gem::ConfigFile::DEFAULT_BULK_THRESHOLD, @cfg.bulk_threshold
41
41
  assert_equal true, @cfg.verbose
@@ -239,6 +239,12 @@ if you believe they were disclosed to a third party.
239
239
  end
240
240
 
241
241
  def test_handle_arguments_backtrace
242
+ File.open @temp_conf, "w" do |fp|
243
+ fp.puts ":backtrace: false"
244
+ end
245
+
246
+ util_config_file %W[--config-file=#{@temp_conf}]
247
+
242
248
  assert_equal false, @cfg.backtrace
243
249
 
244
250
  args = %w[--backtrace]
@@ -275,6 +281,12 @@ if you believe they were disclosed to a third party.
275
281
  end
276
282
 
277
283
  def test_handle_arguments_traceback
284
+ File.open @temp_conf, "w" do |fp|
285
+ fp.puts ":backtrace: false"
286
+ end
287
+
288
+ util_config_file %W[--config-file=#{@temp_conf}]
289
+
278
290
  assert_equal false, @cfg.backtrace
279
291
 
280
292
  args = %w[--traceback]
@@ -288,7 +300,7 @@ if you believe they were disclosed to a third party.
288
300
  assert_equal @temp_conf, @cfg.config_file_name
289
301
 
290
302
  File.open @temp_conf, "w" do |fp|
291
- fp.puts ":backtrace: true"
303
+ fp.puts ":backtrace: false"
292
304
  fp.puts ":update_sources: false"
293
305
  fp.puts ":bulk_threshold: 10"
294
306
  fp.puts ":verbose: false"
@@ -300,7 +312,7 @@ if you believe they were disclosed to a third party.
300
312
 
301
313
  util_config_file args
302
314
 
303
- assert_equal false, @cfg.backtrace
315
+ assert_equal true, @cfg.backtrace
304
316
  assert_equal true, @cfg.update_sources
305
317
  assert_equal Gem::ConfigFile::DEFAULT_BULK_THRESHOLD, @cfg.bulk_threshold
306
318
  assert_equal true, @cfg.verbose
@@ -386,7 +398,7 @@ if you believe they were disclosed to a third party.
386
398
  end
387
399
 
388
400
  def test_write
389
- @cfg.backtrace = true
401
+ @cfg.backtrace = false
390
402
  @cfg.update_sources = false
391
403
  @cfg.bulk_threshold = 10
392
404
  @cfg.verbose = false
@@ -398,7 +410,7 @@ if you believe they were disclosed to a third party.
398
410
  util_config_file
399
411
 
400
412
  # These should not be written out to the config file.
401
- assert_equal false, @cfg.backtrace, "backtrace"
413
+ assert_equal true, @cfg.backtrace, "backtrace"
402
414
  assert_equal Gem::ConfigFile::DEFAULT_BULK_THRESHOLD, @cfg.bulk_threshold,
403
415
  "bulk_threshold"
404
416
  assert_equal true, @cfg.update_sources, "update_sources"
@@ -1051,8 +1051,8 @@ class TestGemDependencyInstaller < Gem::TestCase
1051
1051
 
1052
1052
  releases = set.all_specs
1053
1053
 
1054
- assert releases.any? {|s| s.name == "a" and s.version.to_s == "1" }
1055
- refute releases.any? {|s| s.name == "a" and s.version.to_s == "1.a" }
1054
+ assert releases.any? {|s| s.name == "a" && s.version.to_s == "1" }
1055
+ refute releases.any? {|s| s.name == "a" && s.version.to_s == "1.a" }
1056
1056
 
1057
1057
  dependency.prerelease = true
1058
1058
 
@@ -160,9 +160,9 @@ dependencies = [
160
160
 
161
161
  [[package]]
162
162
  name = "rb-sys"
163
- version = "0.9.26"
163
+ version = "0.9.29"
164
164
  source = "registry+https://github.com/rust-lang/crates.io-index"
165
- checksum = "723f7560e878bec9d1d49538a17fb6a4e3a04688c1dc6f14eef17918634a54e4"
165
+ checksum = "0317cb843cdeef14c5622917c55c0a170cee31348eb600c4a1683fb8c9e87e7a"
166
166
  dependencies = [
167
167
  "bindgen",
168
168
  "linkify",
@@ -171,9 +171,9 @@ dependencies = [
171
171
 
172
172
  [[package]]
173
173
  name = "rb-sys-build"
174
- version = "0.9.26"
174
+ version = "0.9.29"
175
175
  source = "registry+https://github.com/rust-lang/crates.io-index"
176
- checksum = "2ccd93f0d9767385cd7a23076c47e3dca4c86144e510ea4c61d04dbce0cbac7e"
176
+ checksum = "c4b8274327aecb7edcff86e290d9cbe7b572b7889c1cfc7476358f4831f78ce5"
177
177
  dependencies = [
178
178
  "regex",
179
179
  "shell-words",
@@ -7,4 +7,4 @@ edition = "2021"
7
7
  crate-type = ["cdylib"]
8
8
 
9
9
  [dependencies]
10
- rb-sys = { version = "0.9.26", features = ["gem"] }
10
+ rb-sys = { version = "0.9.29", features = ["gem"] }
@@ -1,4 +1,4 @@
1
- if ENV["RUBYOPT"] or defined? Gem
1
+ if ENV["RUBYOPT"] || defined? Gem
2
2
  ENV.delete "RUBYOPT"
3
3
 
4
4
  require "rbconfig"
@@ -153,9 +153,9 @@ dependencies = [
153
153
 
154
154
  [[package]]
155
155
  name = "rb-sys"
156
- version = "0.9.26"
156
+ version = "0.9.29"
157
157
  source = "registry+https://github.com/rust-lang/crates.io-index"
158
- checksum = "723f7560e878bec9d1d49538a17fb6a4e3a04688c1dc6f14eef17918634a54e4"
158
+ checksum = "0317cb843cdeef14c5622917c55c0a170cee31348eb600c4a1683fb8c9e87e7a"
159
159
  dependencies = [
160
160
  "bindgen",
161
161
  "linkify",
@@ -164,9 +164,9 @@ dependencies = [
164
164
 
165
165
  [[package]]
166
166
  name = "rb-sys-build"
167
- version = "0.9.26"
167
+ version = "0.9.29"
168
168
  source = "registry+https://github.com/rust-lang/crates.io-index"
169
- checksum = "2ccd93f0d9767385cd7a23076c47e3dca4c86144e510ea4c61d04dbce0cbac7e"
169
+ checksum = "c4b8274327aecb7edcff86e290d9cbe7b572b7889c1cfc7476358f4831f78ce5"
170
170
  dependencies = [
171
171
  "regex",
172
172
  "shell-words",
@@ -7,4 +7,4 @@ edition = "2021"
7
7
  crate-type = ["cdylib"]
8
8
 
9
9
  [dependencies]
10
- rb-sys = { version = "0.9.26", features = ["gem"] }
10
+ rb-sys = { version = "0.9.29", features = ["gem"] }
@@ -1,4 +1,4 @@
1
- if ENV["RUBYOPT"] or defined? Gem
1
+ if ENV["RUBYOPT"] || defined? Gem
2
2
  ENV.delete "RUBYOPT"
3
3
 
4
4
  require "rbconfig"
@@ -473,7 +473,7 @@ gem 'other', version
473
473
  end
474
474
  end
475
475
  ensure
476
- FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG or win_platform?)
476
+ FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG || win_platform?)
477
477
  end
478
478
 
479
479
  def test_generate_bin_script_no_shebang
@@ -577,7 +577,7 @@ gem 'other', version
577
577
  end
578
578
  end
579
579
  ensure
580
- FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG or win_platform?)
580
+ FileUtils.chmod 0755, util_inst_bindir unless ($DEBUG || win_platform?)
581
581
  end
582
582
 
583
583
  def test_generate_bin_symlink_update_newer
@@ -756,7 +756,10 @@ gem 'other', version
756
756
  end
757
757
  end
758
758
 
759
- assert_match %r{bin/ascii_binder` is dangling symlink pointing to `bin/asciibinder`}, @ui.error
759
+ errors = @ui.error.split("\n")
760
+ assert_equal "WARNING: ascii_binder-0.1.10.1 ships with a dangling symlink named bin/ascii_binder pointing to missing bin/asciibinder file. Ignoring", errors.shift
761
+ assert_empty errors
762
+
760
763
  assert_empty @ui.output
761
764
  end
762
765
 
@@ -529,6 +529,7 @@ class TestGemPackage < Gem::Package::TarTestCase
529
529
 
530
530
  def test_extract_tar_gz_symlink_relative_path
531
531
  package = Gem::Package.new @gem
532
+ package.verify
532
533
 
533
534
  tgz_io = util_tar_gz do |tar|
534
535
  tar.add_file "relative.rb", 0644 do |io|
@@ -557,6 +558,27 @@ class TestGemPackage < Gem::Package::TarTestCase
557
558
  File.read(extracted)
558
559
  end
559
560
 
561
+ def test_extract_tar_gz_symlink_broken_relative_path
562
+ package = Gem::Package.new @gem
563
+ package.verify
564
+
565
+ tgz_io = util_tar_gz do |tar|
566
+ tar.mkdir "lib", 0755
567
+ tar.add_symlink "lib/foo.rb", "../broken.rb", 0644
568
+ end
569
+
570
+ ui = Gem::MockGemUi.new
571
+
572
+ use_ui ui do
573
+ package.extract_tar_gz tgz_io, @destination
574
+ end
575
+
576
+ assert_equal "WARNING: a-2 ships with a dangling symlink named lib/foo.rb pointing to missing ../broken.rb file. Ignoring\n", ui.error
577
+
578
+ extracted = File.join @destination, "lib/foo.rb"
579
+ assert_path_not_exist extracted
580
+ end
581
+
560
582
  def test_extract_symlink_parent
561
583
  package = Gem::Package.new @gem
562
584
 
@@ -29,7 +29,7 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
29
29
 
30
30
  str =
31
31
  tar_file_header("lib/foo", "", 010644, content.size, Time.now) +
32
- content + "\0" * (512 - content.size)
32
+ content + "\0" * (512 - content.size)
33
33
  str << "\0" * 1024
34
34
 
35
35
  io = TempIO.new(str)