rubygems-update 3.2.26 → 3.2.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -0
  3. data/Manifest.txt +12 -3
  4. data/bundler/CHANGELOG.md +50 -1
  5. data/bundler/README.md +1 -1
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/cli/check.rb +1 -1
  8. data/bundler/lib/bundler/cli/gem.rb +19 -2
  9. data/bundler/lib/bundler/cli/info.rb +11 -4
  10. data/bundler/lib/bundler/cli/issue.rb +4 -3
  11. data/bundler/lib/bundler/cli/remove.rb +1 -2
  12. data/bundler/lib/bundler/cli.rb +1 -0
  13. data/bundler/lib/bundler/compact_index_client.rb +2 -2
  14. data/bundler/lib/bundler/definition.rb +16 -6
  15. data/bundler/lib/bundler/digest.rb +71 -0
  16. data/bundler/lib/bundler/errors.rb +18 -2
  17. data/bundler/lib/bundler/fetcher.rb +2 -1
  18. data/bundler/lib/bundler/friendly_errors.rb +5 -30
  19. data/bundler/lib/bundler/gem_helper.rb +6 -17
  20. data/bundler/lib/bundler/installer.rb +0 -1
  21. data/bundler/lib/bundler/plugin/installer.rb +2 -0
  22. data/bundler/lib/bundler/plugin.rb +23 -6
  23. data/bundler/lib/bundler/rubygems_ext.rb +4 -0
  24. data/bundler/lib/bundler/rubygems_gem_installer.rb +20 -4
  25. data/bundler/lib/bundler/rubygems_integration.rb +28 -9
  26. data/bundler/lib/bundler/runtime.rb +1 -1
  27. data/bundler/lib/bundler/settings.rb +9 -1
  28. data/bundler/lib/bundler/source/git.rb +22 -4
  29. data/bundler/lib/bundler/source/rubygems.rb +43 -72
  30. data/bundler/lib/bundler/source.rb +2 -0
  31. data/bundler/lib/bundler/source_list.rb +4 -0
  32. data/bundler/lib/bundler/spec_set.rb +1 -1
  33. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -1
  34. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  35. data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  36. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  37. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  38. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  39. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  40. data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  41. data/bundler/lib/bundler/vendor/molinillo/LICENSE +9 -0
  42. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  43. data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
  44. data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  45. data/bundler/lib/bundler/version.rb +1 -1
  46. data/bundler/lib/bundler/worker.rb +2 -2
  47. data/bundler/lib/bundler.rb +13 -18
  48. data/lib/rubygems/command_manager.rb +3 -3
  49. data/lib/rubygems/commands/build_command.rb +3 -3
  50. data/lib/rubygems/commands/cert_command.rb +15 -8
  51. data/lib/rubygems/commands/check_command.rb +4 -4
  52. data/lib/rubygems/commands/cleanup_command.rb +3 -3
  53. data/lib/rubygems/commands/contents_command.rb +2 -2
  54. data/lib/rubygems/commands/dependency_command.rb +3 -3
  55. data/lib/rubygems/commands/environment_command.rb +1 -1
  56. data/lib/rubygems/commands/fetch_command.rb +3 -3
  57. data/lib/rubygems/commands/generate_index_command.rb +2 -2
  58. data/lib/rubygems/commands/help_command.rb +1 -1
  59. data/lib/rubygems/commands/info_command.rb +2 -2
  60. data/lib/rubygems/commands/install_command.rb +12 -11
  61. data/lib/rubygems/commands/list_command.rb +2 -2
  62. data/lib/rubygems/commands/lock_command.rb +1 -1
  63. data/lib/rubygems/commands/mirror_command.rb +1 -1
  64. data/lib/rubygems/commands/open_command.rb +2 -2
  65. data/lib/rubygems/commands/outdated_command.rb +4 -4
  66. data/lib/rubygems/commands/owner_command.rb +4 -4
  67. data/lib/rubygems/commands/pristine_command.rb +5 -5
  68. data/lib/rubygems/commands/push_command.rb +4 -4
  69. data/lib/rubygems/commands/query_command.rb +3 -3
  70. data/lib/rubygems/commands/rdoc_command.rb +3 -3
  71. data/lib/rubygems/commands/search_command.rb +2 -2
  72. data/lib/rubygems/commands/server_command.rb +3 -3
  73. data/lib/rubygems/commands/setup_command.rb +6 -6
  74. data/lib/rubygems/commands/signin_command.rb +2 -2
  75. data/lib/rubygems/commands/signout_command.rb +1 -1
  76. data/lib/rubygems/commands/sources_command.rb +4 -4
  77. data/lib/rubygems/commands/specification_command.rb +4 -4
  78. data/lib/rubygems/commands/stale_command.rb +1 -1
  79. data/lib/rubygems/commands/uninstall_command.rb +3 -3
  80. data/lib/rubygems/commands/unpack_command.rb +5 -5
  81. data/lib/rubygems/commands/update_command.rb +9 -9
  82. data/lib/rubygems/commands/which_command.rb +1 -1
  83. data/lib/rubygems/commands/yank_command.rb +4 -4
  84. data/lib/rubygems/config_file.rb +1 -1
  85. data/lib/rubygems/core_ext/tcpsocket_init.rb +2 -2
  86. data/lib/rubygems/defaults.rb +1 -1
  87. data/lib/rubygems/dependency_installer.rb +8 -8
  88. data/lib/rubygems/dependency_list.rb +1 -1
  89. data/lib/rubygems/doctor.rb +2 -2
  90. data/lib/rubygems/errors.rb +1 -2
  91. data/lib/rubygems/exceptions.rb +1 -1
  92. data/lib/rubygems/gem_runner.rb +3 -3
  93. data/lib/rubygems/gemcutter_utilities.rb +2 -2
  94. data/lib/rubygems/indexer.rb +2 -2
  95. data/lib/rubygems/install_default_message.rb +2 -2
  96. data/lib/rubygems/install_message.rb +2 -2
  97. data/lib/rubygems/install_update_options.rb +2 -2
  98. data/lib/rubygems/installer.rb +8 -8
  99. data/lib/rubygems/local_remote_options.rb +1 -1
  100. data/lib/rubygems/mock_gem_ui.rb +1 -1
  101. data/lib/rubygems/package/tar_reader.rb +1 -1
  102. data/lib/rubygems/package.rb +36 -46
  103. data/lib/rubygems/package_task.rb +2 -2
  104. data/lib/rubygems/platform.rb +2 -1
  105. data/lib/rubygems/query_utils.rb +4 -4
  106. data/lib/rubygems/rdoc.rb +1 -1
  107. data/lib/rubygems/remote_fetcher.rb +16 -22
  108. data/lib/rubygems/request/connection_pools.rb +1 -1
  109. data/lib/rubygems/request/http_pool.rb +1 -1
  110. data/lib/rubygems/request.rb +7 -5
  111. data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
  112. data/lib/rubygems/request_set/lockfile.rb +1 -1
  113. data/lib/rubygems/request_set.rb +5 -5
  114. data/lib/rubygems/requirement.rb +1 -1
  115. data/lib/rubygems/resolver/git_specification.rb +1 -1
  116. data/lib/rubygems/resolver/installer_set.rb +3 -3
  117. data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
  118. data/lib/rubygems/resolver/molinillo.rb +1 -1
  119. data/lib/rubygems/resolver/set.rb +0 -1
  120. data/lib/rubygems/resolver/specification.rb +1 -1
  121. data/lib/rubygems/resolver.rb +31 -31
  122. data/lib/rubygems/s3_uri_signer.rb +4 -5
  123. data/lib/rubygems/security/policy.rb +6 -4
  124. data/lib/rubygems/security/signer.rb +4 -5
  125. data/lib/rubygems/security.rb +54 -20
  126. data/lib/rubygems/security_option.rb +2 -2
  127. data/lib/rubygems/server.rb +2 -2
  128. data/lib/rubygems/source/git.rb +2 -2
  129. data/lib/rubygems/source.rb +7 -7
  130. data/lib/rubygems/spec_fetcher.rb +5 -5
  131. data/lib/rubygems/specification.rb +12 -12
  132. data/lib/rubygems/specification_policy.rb +2 -2
  133. data/lib/rubygems/uninstaller.rb +6 -6
  134. data/lib/rubygems/uri.rb +111 -0
  135. data/lib/rubygems/user_interaction.rb +3 -3
  136. data/lib/rubygems/util/licenses.rb +1 -1
  137. data/lib/rubygems/util.rb +1 -1
  138. data/lib/rubygems/validator.rb +2 -2
  139. data/lib/rubygems/version_option.rb +1 -1
  140. data/lib/rubygems.rb +16 -16
  141. data/rubygems-update.gemspec +1 -1
  142. data/test/rubygems/helper.rb +4 -12
  143. data/test/rubygems/private_ec_key.pem +9 -0
  144. data/test/rubygems/test_gem.rb +59 -71
  145. data/test/rubygems/test_gem_commands_cert_command.rb +63 -4
  146. data/test/rubygems/test_gem_commands_install_command.rb +25 -0
  147. data/test/rubygems/test_gem_package.rb +27 -26
  148. data/test/rubygems/test_gem_platform.rb +1 -0
  149. data/test/rubygems/test_gem_remote_fetcher.rb +30 -0
  150. data/test/rubygems/test_gem_request.rb +35 -9
  151. data/test/rubygems/test_gem_resolver_installer_set.rb +18 -0
  152. data/test/rubygems/test_gem_security.rb +32 -4
  153. data/test/rubygems/test_gem_source_fetch_problem.rb +10 -0
  154. data/test/rubygems/test_gem_specification.rb +228 -232
  155. data/test/rubygems/test_gem_uri.rb +39 -0
  156. metadata +18 -9
  157. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
  158. data/lib/rubygems/uri_parser.rb +0 -34
  159. data/lib/rubygems/uri_parsing.rb +0 -23
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rubygems/deprecate'
3
+ require_relative 'deprecate'
4
4
 
5
5
  ##
6
6
  # Base exception class for RubyGems. All exception raised by RubyGems are a
@@ -5,9 +5,9 @@
5
5
  # See LICENSE.txt for permissions.
6
6
  #++
7
7
 
8
- require 'rubygems'
9
- require 'rubygems/command_manager'
10
- require 'rubygems/deprecate'
8
+ require_relative '../rubygems'
9
+ require_relative 'command_manager'
10
+ require_relative 'deprecate'
11
11
 
12
12
  ##
13
13
  # Load additional plugins from $LOAD_PATH
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/remote_fetcher'
3
- require 'rubygems/text'
2
+ require_relative 'remote_fetcher'
3
+ require_relative 'text'
4
4
 
5
5
  ##
6
6
  # Utility methods for using the RubyGems API.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems'
3
- require 'rubygems/package'
2
+ require_relative '../rubygems'
3
+ require_relative 'package'
4
4
  require 'tmpdir'
5
5
 
6
6
  ##
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems'
3
- require 'rubygems/user_interaction'
2
+ require_relative '../rubygems'
3
+ require_relative 'user_interaction'
4
4
 
5
5
  ##
6
6
  # A post-install hook that displays "Successfully installed
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems'
3
- require 'rubygems/user_interaction'
2
+ require_relative '../rubygems'
3
+ require_relative 'user_interaction'
4
4
 
5
5
  ##
6
6
  # A default post-install hook that displays "Successfully installed
@@ -5,8 +5,8 @@
5
5
  # See LICENSE.txt for permissions.
6
6
  #++
7
7
 
8
- require 'rubygems'
9
- require 'rubygems/security_option'
8
+ require_relative '../rubygems'
9
+ require_relative 'security_option'
10
10
 
11
11
  ##
12
12
  # Mixin methods for install and update options for Gem::Commands
@@ -5,13 +5,13 @@
5
5
  # See LICENSE.txt for permissions.
6
6
  #++
7
7
 
8
- require 'rubygems/command'
9
- require 'rubygems/installer_uninstaller_utils'
10
- require 'rubygems/exceptions'
11
- require 'rubygems/deprecate'
12
- require 'rubygems/package'
13
- require 'rubygems/ext'
14
- require 'rubygems/user_interaction'
8
+ require_relative 'command'
9
+ require_relative 'installer_uninstaller_utils'
10
+ require_relative 'exceptions'
11
+ require_relative 'deprecate'
12
+ require_relative 'package'
13
+ require_relative 'ext'
14
+ require_relative 'user_interaction'
15
15
 
16
16
  ##
17
17
  # The installer installs the files contained in the .gem into the Gem.home.
@@ -68,7 +68,7 @@ class Gem::Installer
68
68
 
69
69
  @path_warning = false
70
70
 
71
- @install_lock = Mutex.new
71
+ @install_lock = Thread::Mutex.new
72
72
 
73
73
  class << self
74
74
  ##
@@ -6,7 +6,7 @@
6
6
  #++
7
7
 
8
8
  require 'uri'
9
- require 'rubygems'
9
+ require_relative '../rubygems'
10
10
 
11
11
  ##
12
12
  # Mixin methods for local and remote Gem::Command options.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/user_interaction'
2
+ require_relative 'user_interaction'
3
3
 
4
4
  ##
5
5
  # This Gem::StreamUI subclass records input and output to StringIO for
@@ -121,4 +121,4 @@ class Gem::Package::TarReader
121
121
  end
122
122
  end
123
123
 
124
- require 'rubygems/package/tar_reader/entry'
124
+ require_relative 'tar_reader/entry'
@@ -41,9 +41,9 @@
41
41
  # #files are the files in the .gem tar file, not the Ruby files in the gem
42
42
  # #extract_files and #contents automatically call #verify
43
43
 
44
- require "rubygems"
45
- require 'rubygems/security'
46
- require 'rubygems/user_interaction'
44
+ require_relative "../rubygems"
45
+ require_relative 'security'
46
+ require_relative 'user_interaction'
47
47
 
48
48
  class Gem::Package
49
49
  include Gem::UserInteraction
@@ -71,6 +71,13 @@ class Gem::Package
71
71
  end
72
72
  end
73
73
 
74
+ class SymlinkError < Error
75
+ def initialize(name, destination, destination_dir)
76
+ super "installing symlink '%s' pointing to parent path %s of %s is not allowed" %
77
+ [name, destination, destination_dir]
78
+ end
79
+ end
80
+
74
81
  class NonSeekableIO < Error; end
75
82
 
76
83
  class TooLongFileName < Error; end
@@ -400,13 +407,21 @@ EOM
400
407
  # extracted.
401
408
 
402
409
  def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc:
403
- directories = [] if dir_mode
410
+ directories = []
404
411
  open_tar_gz io do |tar|
405
412
  tar.each do |entry|
406
413
  next unless File.fnmatch pattern, entry.full_name, File::FNM_DOTMATCH
407
414
 
408
415
  destination = install_location entry.full_name, destination_dir
409
416
 
417
+ if entry.symlink?
418
+ link_target = entry.header.linkname
419
+ real_destination = link_target.start_with?("/") ? link_target : File.expand_path(link_target, File.dirname(destination))
420
+
421
+ raise Gem::Package::SymlinkError.new(entry.full_name, real_destination, destination_dir) unless
422
+ normalize_path(real_destination).start_with? normalize_path(destination_dir + '/')
423
+ end
424
+
410
425
  FileUtils.rm_rf destination
411
426
 
412
427
  mkdir_options = {}
@@ -417,9 +432,11 @@ EOM
417
432
  else
418
433
  File.dirname destination
419
434
  end
420
- directories << mkdir if directories
421
435
 
422
- mkdir_p_safe mkdir, mkdir_options, destination_dir, entry.full_name
436
+ unless directories.include?(mkdir)
437
+ FileUtils.mkdir_p mkdir, **mkdir_options
438
+ directories << mkdir
439
+ end
423
440
 
424
441
  File.open destination, 'wb' do |out|
425
442
  out.write entry.read
@@ -432,8 +449,7 @@ EOM
432
449
  end
433
450
  end
434
451
 
435
- if directories
436
- directories.uniq!
452
+ if dir_mode
437
453
  File.chmod(dir_mode, *directories)
438
454
  end
439
455
  end
@@ -466,21 +482,11 @@ EOM
466
482
  raise Gem::Package::PathError.new(filename, destination_dir) if
467
483
  filename.start_with? '/'
468
484
 
469
- destination_dir = File.expand_path(File.realpath(destination_dir))
470
- destination = File.expand_path(File.join(destination_dir, filename))
485
+ destination_dir = File.realpath(destination_dir)
486
+ destination = File.expand_path(filename, destination_dir)
471
487
 
472
488
  raise Gem::Package::PathError.new(destination, destination_dir) unless
473
- destination.start_with? destination_dir + '/'
474
-
475
- begin
476
- real_destination = File.expand_path(File.realpath(destination))
477
- rescue
478
- # it's fine if the destination doesn't exist, because rm -rf'ing it can't cause any damage
479
- nil
480
- else
481
- raise Gem::Package::PathError.new(real_destination, destination_dir) unless
482
- real_destination.start_with? destination_dir + '/'
483
- end
489
+ normalize_path(destination).start_with? normalize_path(destination_dir + '/')
484
490
 
485
491
  destination.tap(&Gem::UNTAINT)
486
492
  destination
@@ -494,22 +500,6 @@ EOM
494
500
  end
495
501
  end
496
502
 
497
- def mkdir_p_safe(mkdir, mkdir_options, destination_dir, file_name)
498
- destination_dir = File.realpath(File.expand_path(destination_dir))
499
- parts = mkdir.split(File::SEPARATOR)
500
- parts.reduce do |path, basename|
501
- path = File.realpath(path) unless path == ""
502
- path = File.expand_path(path + File::SEPARATOR + basename)
503
- lstat = File.lstat path rescue nil
504
- if !lstat || !lstat.directory?
505
- unless normalize_path(path).start_with? normalize_path(destination_dir) and (FileUtils.mkdir path, **mkdir_options rescue false)
506
- raise Gem::Package::PathError.new(file_name, destination_dir)
507
- end
508
- end
509
- path
510
- end
511
- end
512
-
513
503
  ##
514
504
  # Loads a Gem::Specification from the TarEntry +entry+
515
505
 
@@ -702,12 +692,12 @@ EOM
702
692
  end
703
693
  end
704
694
 
705
- require 'rubygems/package/digest_io'
706
- require 'rubygems/package/source'
707
- require 'rubygems/package/file_source'
708
- require 'rubygems/package/io_source'
709
- require 'rubygems/package/old'
710
- require 'rubygems/package/tar_header'
711
- require 'rubygems/package/tar_reader'
712
- require 'rubygems/package/tar_reader/entry'
713
- require 'rubygems/package/tar_writer'
695
+ require_relative 'package/digest_io'
696
+ require_relative 'package/source'
697
+ require_relative 'package/file_source'
698
+ require_relative 'package/io_source'
699
+ require_relative 'package/old'
700
+ require_relative 'package/tar_header'
701
+ require_relative 'package/tar_reader'
702
+ require_relative 'package/tar_reader/entry'
703
+ require_relative 'package/tar_writer'
@@ -20,8 +20,8 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
 
23
- require 'rubygems'
24
- require 'rubygems/package'
23
+ require_relative '../rubygems'
24
+ require_relative 'package'
25
25
  require 'rake/packagetask'
26
26
 
27
27
  ##
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require "rubygems/deprecate"
2
+ require_relative "deprecate"
3
3
 
4
4
  ##
5
5
  # Available list of platforms for targeting Gem installations.
@@ -100,6 +100,7 @@ class Gem::Platform
100
100
  when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
101
101
  when /linux-?((?!gnu)\w+)?/ then [ 'linux', $1 ]
102
102
  when /mingw32/ then [ 'mingw32', nil ]
103
+ when /mingw-?(\w+)?/ then [ 'mingw', $1 ]
103
104
  when /(mswin\d+)(\_(\d+))?/ then
104
105
  os, version = $1, $3
105
106
  @cpu = 'x86' if @cpu.nil? and os =~ /32$/
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rubygems/local_remote_options'
4
- require 'rubygems/spec_fetcher'
5
- require 'rubygems/version_option'
6
- require 'rubygems/text'
3
+ require_relative 'local_remote_options'
4
+ require_relative 'spec_fetcher'
5
+ require_relative 'version_option'
6
+ require_relative 'text'
7
7
 
8
8
  module Gem::QueryUtils
9
9
 
data/lib/rubygems/rdoc.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems'
2
+ require_relative '../rubygems'
3
3
 
4
4
  begin
5
5
  require 'rdoc/rubygems_hook'
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems'
3
- require 'rubygems/request'
4
- require 'rubygems/request/connection_pools'
5
- require 'rubygems/s3_uri_signer'
6
- require 'rubygems/uri_formatter'
7
- require 'rubygems/uri_parsing'
8
- require 'rubygems/user_interaction'
2
+ require_relative '../rubygems'
3
+ require_relative 'request'
4
+ require_relative 'request/connection_pools'
5
+ require_relative 's3_uri_signer'
6
+ require_relative 'uri_formatter'
7
+ require_relative 'uri'
8
+ require_relative 'user_interaction'
9
9
 
10
10
  ##
11
11
  # RemoteFetcher handles the details of fetching gems and gem information from
@@ -13,30 +13,24 @@ require 'rubygems/user_interaction'
13
13
 
14
14
  class Gem::RemoteFetcher
15
15
  include Gem::UserInteraction
16
- include Gem::UriParsing
17
16
 
18
17
  ##
19
18
  # A FetchError exception wraps up the various possible IO and HTTP failures
20
19
  # that could happen while downloading from the internet.
21
20
 
22
21
  class FetchError < Gem::Exception
23
- include Gem::UriParsing
24
-
25
22
  ##
26
23
  # The URI which was being accessed when the exception happened.
27
24
 
28
25
  attr_accessor :uri, :original_uri
29
26
 
30
27
  def initialize(message, uri)
31
- super message
32
-
33
- uri = parse_uri(uri)
34
-
35
- @original_uri = uri.dup
28
+ uri = Gem::Uri.new(uri)
36
29
 
37
- uri.password = 'REDACTED' if uri.respond_to?(:password) && uri.password
30
+ super uri.redact_credentials_from(message)
38
31
 
39
- @uri = uri.to_s
32
+ @original_uri = uri.to_s
33
+ @uri = uri.redacted.to_s
40
34
  end
41
35
 
42
36
  def to_s # :nodoc:
@@ -78,7 +72,7 @@ class Gem::RemoteFetcher
78
72
  # fetching the gem.
79
73
 
80
74
  def initialize(proxy=nil, dns=nil, headers={})
81
- require 'rubygems/core_ext/tcpsocket_init' if Gem.configuration.ipv4_fallback_enabled
75
+ require_relative 'core_ext/tcpsocket_init' if Gem.configuration.ipv4_fallback_enabled
82
76
  require 'net/http'
83
77
  require 'stringio'
84
78
  require 'uri'
@@ -87,7 +81,7 @@ class Gem::RemoteFetcher
87
81
 
88
82
  @proxy = proxy
89
83
  @pools = {}
90
- @pool_lock = Mutex.new
84
+ @pool_lock = Thread::Mutex.new
91
85
  @cert_files = Gem::Request.get_cert_files
92
86
 
93
87
  @headers = headers
@@ -132,7 +126,7 @@ class Gem::RemoteFetcher
132
126
  require "fileutils"
133
127
  FileUtils.mkdir_p cache_dir rescue nil unless File.exist? cache_dir
134
128
 
135
- source_uri = parse_uri(source_uri)
129
+ source_uri = Gem::Uri.new(source_uri)
136
130
 
137
131
  scheme = source_uri.scheme
138
132
 
@@ -227,7 +221,7 @@ class Gem::RemoteFetcher
227
221
  unless location = response['Location']
228
222
  raise FetchError.new("redirecting but no redirect location was given", uri)
229
223
  end
230
- location = parse_uri location
224
+ location = Gem::Uri.new location
231
225
 
232
226
  if https?(uri) && !https?(location)
233
227
  raise FetchError.new("redirecting to non-https resource: #{location}", uri)
@@ -245,7 +239,7 @@ class Gem::RemoteFetcher
245
239
  # Downloads +uri+ and returns it as a String.
246
240
 
247
241
  def fetch_path(uri, mtime = nil, head = false)
248
- uri = parse_uri uri
242
+ uri = Gem::Uri.new uri
249
243
 
250
244
  unless uri.scheme
251
245
  raise ArgumentError, "uri scheme is invalid: #{uri.scheme.inspect}"
@@ -11,7 +11,7 @@ class Gem::Request::ConnectionPools # :nodoc:
11
11
  @proxy_uri = proxy_uri
12
12
  @cert_files = cert_files
13
13
  @pools = {}
14
- @pool_mutex = Mutex.new
14
+ @pool_mutex = Thread::Mutex.new
15
15
  end
16
16
 
17
17
  def pool_for(uri)
@@ -12,7 +12,7 @@ class Gem::Request::HTTPPool # :nodoc:
12
12
  @http_args = http_args
13
13
  @cert_files = cert_files
14
14
  @proxy_uri = proxy_uri
15
- @queue = SizedQueue.new 1
15
+ @queue = Thread::SizedQueue.new 1
16
16
  @queue << nil
17
17
  end
18
18
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'net/http'
3
- require 'rubygems/user_interaction'
3
+ require_relative 'user_interaction'
4
4
 
5
5
  class Gem::Request
6
6
  extend Gem::UserInteraction
@@ -96,8 +96,10 @@ class Gem::Request
96
96
  return unless cert
97
97
  case error_number
98
98
  when OpenSSL::X509::V_ERR_CERT_HAS_EXPIRED then
99
+ require 'time'
99
100
  "Certificate #{cert.subject} expired at #{cert.not_after.iso8601}"
100
101
  when OpenSSL::X509::V_ERR_CERT_NOT_YET_VALID then
102
+ require 'time'
101
103
  "Certificate #{cert.subject} not valid until #{cert.not_before.iso8601}"
102
104
  when OpenSSL::X509::V_ERR_CERT_REJECTED then
103
105
  "Certificate #{cert.subject} is rejected"
@@ -191,7 +193,7 @@ class Gem::Request
191
193
  begin
192
194
  @requests[connection.object_id] += 1
193
195
 
194
- verbose "#{request.method} #{@uri}"
196
+ verbose "#{request.method} #{Gem::Uri.new(@uri).redacted}"
195
197
 
196
198
  file_name = File.basename(@uri.path)
197
199
  # perform download progress reporter only for gems
@@ -287,6 +289,6 @@ class Gem::Request
287
289
  end
288
290
  end
289
291
 
290
- require 'rubygems/request/http_pool'
291
- require 'rubygems/request/https_pool'
292
- require 'rubygems/request/connection_pools'
292
+ require_relative 'request/http_pool'
293
+ require_relative 'request/https_pool'
294
+ require_relative 'request/connection_pools'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/request_set/lockfile/parser'
2
+ require_relative 'parser'
3
3
 
4
4
  class Gem::RequestSet::Lockfile::Tokenizer
5
5
  Token = Struct.new :type, :value, :column, :line
@@ -236,4 +236,4 @@ class Gem::RequestSet::Lockfile
236
236
  end
237
237
  end
238
238
 
239
- require 'rubygems/request_set/lockfile/tokenizer'
239
+ require_relative 'lockfile/tokenizer'
@@ -151,7 +151,7 @@ class Gem::RequestSet
151
151
  @prerelease = options[:prerelease]
152
152
 
153
153
  requests = []
154
- download_queue = Queue.new
154
+ download_queue = Thread::Queue.new
155
155
 
156
156
  # Create a thread-safe list of gems to download
157
157
  sorted_requests.each do |req|
@@ -303,7 +303,7 @@ class Gem::RequestSet
303
303
  end
304
304
  end
305
305
 
306
- require "rubygems/dependency_installer"
306
+ require_relative "dependency_installer"
307
307
  inst = Gem::DependencyInstaller.new options
308
308
  inst.installed_gems.replace specs
309
309
 
@@ -461,6 +461,6 @@ class Gem::RequestSet
461
461
  end
462
462
  end
463
463
 
464
- require 'rubygems/request_set/gem_dependency_api'
465
- require 'rubygems/request_set/lockfile'
466
- require 'rubygems/request_set/lockfile/tokenizer'
464
+ require_relative 'request_set/gem_dependency_api'
465
+ require_relative 'request_set/lockfile'
466
+ require_relative 'request_set/lockfile/tokenizer'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require "rubygems/deprecate"
2
+ require_relative "deprecate"
3
3
 
4
4
  ##
5
5
  # A Requirement is a set of one or more version restrictions. It supports a
@@ -21,7 +21,7 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
21
21
  # the executables.
22
22
 
23
23
  def install(options = {})
24
- require 'rubygems/installer'
24
+ require_relative '../installer'
25
25
 
26
26
  installer = Gem::Installer.for_spec spec, options
27
27
 
@@ -77,11 +77,11 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
77
77
  newest = found.last
78
78
 
79
79
  unless @force
80
- found_matching_metadata = found.select do |spec|
80
+ found_matching_metadata = found.reverse.find do |spec|
81
81
  metadata_satisfied?(spec)
82
82
  end
83
83
 
84
- if found_matching_metadata.empty?
84
+ if found_matching_metadata.nil?
85
85
  if newest
86
86
  ensure_required_ruby_version_met(newest.spec)
87
87
  ensure_required_rubygems_version_met(newest.spec)
@@ -92,7 +92,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
92
92
  raise exc
93
93
  end
94
94
  else
95
- newest = found_matching_metadata.last
95
+ newest = found_matching_metadata
96
96
  end
97
97
  end
98
98
 
@@ -0,0 +1,9 @@
1
+ This project is licensed under the MIT license.
2
+
3
+ Copyright (c) 2014 Samuel E. Giddins segiddins@segiddins.me
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,2 +1,2 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/resolver/molinillo/lib/molinillo'
2
+ require_relative 'molinillo/lib/molinillo'
@@ -20,7 +20,6 @@ class Gem::Resolver::Set
20
20
  attr_accessor :prerelease
21
21
 
22
22
  def initialize # :nodoc:
23
- require 'uri'
24
23
  @prerelease = false
25
24
  @remote = true
26
25
  @errors = []
@@ -93,7 +93,7 @@ class Gem::Resolver::Specification
93
93
  # specification.
94
94
 
95
95
  def install(options = {})
96
- require 'rubygems/installer'
96
+ require_relative '../installer'
97
97
 
98
98
  gem = download options
99
99