rubygems-update 3.2.33 → 3.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +77 -4
  3. data/CONTRIBUTING.md +40 -10
  4. data/Manifest.txt +7 -5
  5. data/POLICIES.md +22 -8
  6. data/README.md +9 -7
  7. data/UPGRADING.md +5 -81
  8. data/bin/gem +1 -6
  9. data/bundler/CHANGELOG.md +47 -0
  10. data/bundler/exe/bundle +7 -8
  11. data/bundler/lib/bundler/.document +1 -0
  12. data/bundler/lib/bundler/build_metadata.rb +2 -2
  13. data/bundler/lib/bundler/cli/gem.rb +1 -1
  14. data/bundler/lib/bundler/cli/install.rb +2 -3
  15. data/bundler/lib/bundler/cli.rb +5 -0
  16. data/bundler/lib/bundler/definition.rb +14 -5
  17. data/bundler/lib/bundler/dependency.rb +5 -7
  18. data/bundler/lib/bundler/dsl.rb +0 -27
  19. data/bundler/lib/bundler/endpoint_specification.rb +0 -8
  20. data/bundler/lib/bundler/fetcher/compact_index.rb +9 -4
  21. data/bundler/lib/bundler/fetcher.rb +2 -5
  22. data/bundler/lib/bundler/injector.rb +10 -1
  23. data/bundler/lib/bundler/installer/gem_installer.rb +1 -6
  24. data/bundler/lib/bundler/installer.rb +1 -4
  25. data/bundler/lib/bundler/lockfile_parser.rb +10 -13
  26. data/bundler/lib/bundler/man/bundle-add.1 +9 -1
  27. data/bundler/lib/bundler/man/bundle-add.1.ronn +7 -1
  28. data/bundler/lib/bundler/man/bundle-config.1 +2 -2
  29. data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
  30. data/bundler/lib/bundler/man/bundle-install.1 +1 -1
  31. data/bundler/lib/bundler/man/bundle-install.1.ronn +2 -2
  32. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  33. data/bundler/lib/bundler/man/bundle-update.1.ronn +2 -1
  34. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  35. data/bundler/lib/bundler/man/gemfile.5.ronn +1 -1
  36. data/bundler/lib/bundler/plugin/installer.rb +1 -1
  37. data/bundler/lib/bundler/process_lock.rb +1 -1
  38. data/bundler/lib/bundler/psyched_yaml.rb +1 -13
  39. data/bundler/lib/bundler/resolver.rb +34 -29
  40. data/bundler/lib/bundler/rubygems_ext.rb +2 -0
  41. data/bundler/lib/bundler/rubygems_gem_installer.rb +1 -1
  42. data/bundler/lib/bundler/rubygems_integration.rb +11 -48
  43. data/bundler/lib/bundler/self_manager.rb +76 -0
  44. data/bundler/lib/bundler/settings.rb +1 -0
  45. data/bundler/lib/bundler/shared_helpers.rb +2 -9
  46. data/bundler/lib/bundler/source/metadata.rb +1 -1
  47. data/bundler/lib/bundler/templates/Executable.bundler +1 -1
  48. data/bundler/lib/bundler/templates/Gemfile +0 -2
  49. data/bundler/lib/bundler/templates/gems.rb +0 -3
  50. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +10 -1
  51. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  52. data/bundler/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  53. data/bundler/lib/bundler/ui/shell.rb +1 -1
  54. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  55. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +5 -3
  56. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  57. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  58. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  59. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  60. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
  61. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  62. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  63. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  64. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  65. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  66. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  67. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  68. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  69. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  70. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  71. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  72. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  73. data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  74. data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  75. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  76. data/bundler/lib/bundler/version.rb +1 -1
  77. data/bundler/lib/bundler.rb +9 -3
  78. data/hide_lib_for_update/note.txt +0 -4
  79. data/lib/rubygems/bundler_version_finder.rb +10 -42
  80. data/lib/rubygems/command_manager.rb +1 -1
  81. data/lib/rubygems/commands/install_command.rb +5 -2
  82. data/lib/rubygems/commands/server_command.rb +14 -77
  83. data/lib/rubygems/commands/setup_command.rb +4 -16
  84. data/lib/rubygems/commands/update_command.rb +9 -4
  85. data/lib/rubygems/defaults.rb +2 -20
  86. data/lib/rubygems/dependency.rb +7 -7
  87. data/lib/rubygems/deprecate.rb +53 -6
  88. data/lib/rubygems/errors.rb +0 -3
  89. data/lib/rubygems/exceptions.rb +30 -1
  90. data/lib/rubygems/ext/builder.rb +5 -3
  91. data/lib/rubygems/install_update_options.rb +11 -2
  92. data/lib/rubygems/installer.rb +11 -1
  93. data/lib/rubygems/name_tuple.rb +2 -3
  94. data/lib/rubygems/path_support.rb +1 -6
  95. data/lib/rubygems/platform.rb +4 -0
  96. data/lib/rubygems/remote_fetcher.rb +1 -1
  97. data/lib/rubygems/requirement.rb +1 -1
  98. data/lib/rubygems/resolver/installer_set.rb +1 -1
  99. data/lib/rubygems/security/policy.rb +1 -3
  100. data/lib/rubygems/security.rb +14 -7
  101. data/lib/rubygems/source.rb +3 -1
  102. data/lib/rubygems/spec_fetcher.rb +1 -1
  103. data/lib/rubygems/specification.rb +12 -16
  104. data/lib/rubygems/stub_specification.rb +1 -1
  105. data/lib/rubygems/text.rb +21 -20
  106. data/lib/rubygems/uninstaller.rb +4 -1
  107. data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
  108. data/lib/rubygems/version.rb +2 -0
  109. data/lib/rubygems.rb +54 -55
  110. data/rubygems-update.gemspec +1 -1
  111. data/setup.rb +1 -6
  112. data/test/rubygems/helper.rb +20 -6
  113. data/test/rubygems/test_config.rb +2 -2
  114. data/test/rubygems/test_exit.rb +11 -0
  115. data/test/rubygems/test_gem.rb +46 -76
  116. data/test/rubygems/test_gem_bundler_version_finder.rb +22 -43
  117. data/test/rubygems/test_gem_command_manager.rb +16 -2
  118. data/test/rubygems/test_gem_commands_install_command.rb +33 -0
  119. data/test/rubygems/test_gem_commands_open_command.rb +1 -1
  120. data/test/rubygems/test_gem_commands_server_command.rb +4 -46
  121. data/test/rubygems/test_gem_commands_update_command.rb +2 -2
  122. data/test/rubygems/test_gem_dependency.rb +4 -8
  123. data/test/rubygems/test_gem_installer.rb +0 -27
  124. data/test/rubygems/test_gem_path_support.rb +2 -6
  125. data/test/rubygems/test_gem_remote_fetcher.rb +15 -0
  126. data/test/rubygems/test_gem_requirement.rb +0 -1
  127. data/test/rubygems/test_gem_security.rb +1 -1
  128. data/test/rubygems/test_gem_specification.rb +16 -25
  129. data/test/rubygems/test_gem_stream_ui.rb +1 -1
  130. data/test/rubygems/test_gem_text.rb +6 -0
  131. data/test/rubygems/test_kernel.rb +1 -13
  132. data/test/rubygems/test_project_sanity.rb +1 -1
  133. data/test/rubygems/test_require.rb +0 -32
  134. data/test/rubygems/test_rubygems.rb +23 -0
  135. metadata +10 -8
  136. data/bundler/lib/bundler/gemdeps.rb +0 -29
  137. data/lib/rubygems/server.rb +0 -882
  138. data/test/rubygems/bogussources.rb +0 -9
  139. data/test/rubygems/test_gem_server.rb +0 -608
@@ -782,6 +782,39 @@ ERROR: Possible alternatives: non_existent_with_hint
782
782
  assert_match "1 gem installed", @ui.output
783
783
  end
784
784
 
785
+ def test_execute_remote_truncates_existing_gemspecs
786
+ spec_fetcher do |fetcher|
787
+ fetcher.gem 'a', 1
788
+ end
789
+
790
+ @cmd.options[:domain] = :remote
791
+
792
+ @cmd.options[:args] = %w[a]
793
+
794
+ use_ui @ui do
795
+ assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
796
+ @cmd.execute
797
+ end
798
+ end
799
+
800
+ assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
801
+ assert_match "1 gem installed", @ui.output
802
+
803
+ a1_gemspec = File.join(@gemhome, 'specifications', "a-1.gemspec")
804
+
805
+ initial_a1_gemspec_content = File.read(a1_gemspec)
806
+ modified_a1_gemspec_content = initial_a1_gemspec_content + "\n # AAAAAAA\n"
807
+ File.write(a1_gemspec, modified_a1_gemspec_content)
808
+
809
+ use_ui @ui do
810
+ assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
811
+ @cmd.execute
812
+ end
813
+ end
814
+
815
+ assert_equal initial_a1_gemspec_content, File.read(a1_gemspec)
816
+ end
817
+
785
818
  def test_execute_remote_ignores_files
786
819
  specs = spec_fetcher do |fetcher|
787
820
  fetcher.gem 'a', 1
@@ -21,7 +21,7 @@ class TestGemCommandsOpenCommand < Gem::TestCase
21
21
 
22
22
  def test_execute
23
23
  @cmd.options[:args] = %w[foo]
24
- @cmd.options[:editor] = "#{Gem.ruby} -e0 --"
24
+ @cmd.options[:editor] = "#{ruby_with_rubygems_in_load_path} -eexit --"
25
25
 
26
26
  gem 'foo', '1.0.0'
27
27
  spec = gem 'foo', '1.0.1'
@@ -9,53 +9,11 @@ class TestGemCommandsServerCommand < Gem::TestCase
9
9
  @cmd = Gem::Commands::ServerCommand.new
10
10
  end
11
11
 
12
- def test_handle_options
13
- @cmd.send :handle_options, %w[-p 8808 --no-daemon]
14
-
15
- assert_equal false, @cmd.options[:daemon]
16
- assert_equal [], @cmd.options[:gemdir]
17
- assert_equal 8808, @cmd.options[:port]
18
-
19
- @cmd.send :handle_options, %w[-p 9999 -d /nonexistent --daemon]
20
-
21
- assert_equal true, @cmd.options[:daemon]
22
- assert_equal [File.expand_path('/nonexistent')], @cmd.options[:gemdir]
23
- assert_equal 9999, @cmd.options[:port]
24
- end
25
-
26
- def test_handle_options_gemdir
27
- @cmd.send :handle_options, %w[--dir a --dir b]
28
-
29
- assert_equal [File.expand_path('a'), File.expand_path('b')],
30
- @cmd.options[:gemdir]
31
- end
32
-
33
- def test_handle_options_port
34
- @cmd.send :handle_options, %w[-p 0]
35
- assert_equal 0, @cmd.options[:port]
36
-
37
- @cmd.send :handle_options, %w[-p 65535]
38
- assert_equal 65535, @cmd.options[:port]
39
-
40
- begin
41
- @cmd.send :handle_options, %w[-p discard]
42
- assert_equal 9, @cmd.options[:port]
43
- rescue Gem::OptionParser::InvalidArgument
44
- # for container environment on GitHub Actions
45
- end
46
-
47
- e = assert_raise Gem::OptionParser::InvalidArgument do
48
- @cmd.send :handle_options, %w[-p nonexistent]
49
- end
50
-
51
- assert_equal 'invalid argument: -p nonexistent: no such named service',
52
- e.message
53
-
54
- e = assert_raise Gem::OptionParser::InvalidArgument do
55
- @cmd.send :handle_options, %w[-p 65536]
12
+ def test_execute
13
+ use_ui @ui do
14
+ @cmd.execute
56
15
  end
57
16
 
58
- assert_equal 'invalid argument: -p 65536: not a port number',
59
- e.message
17
+ assert_match %r{Install the rubygems-server}i, @ui.error
60
18
  end
61
19
  end
@@ -579,7 +579,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
579
579
 
580
580
  expected = {
581
581
  :args => [],
582
- :document => %w[rdoc ri],
582
+ :document => %w[ri],
583
583
  :force => false,
584
584
  :system => true,
585
585
  }
@@ -598,7 +598,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
598
598
 
599
599
  expected = {
600
600
  :args => [],
601
- :document => %w[rdoc ri],
601
+ :document => %w[ri],
602
602
  :force => false,
603
603
  :system => "1.3.7",
604
604
  }
@@ -358,16 +358,12 @@ class TestGemDependency < Gem::TestCase
358
358
 
359
359
  assert_equal [b, b_1], dep.to_specs
360
360
 
361
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["3.5", "reason"]) do
362
- e = assert_raise Gem::MissingSpecVersionError do
363
- dep.to_specs
364
- end
365
-
366
- assert_match "Could not find 'bundler' (3.5) required by reason.\nTo update to the latest version installed on your system, run `bundle update --bundler`.\nTo install the missing version, run `gem install bundler:3.5`\n", e.message
361
+ Gem::BundlerVersionFinder.stub(:bundler_version, Gem::Version.new("1")) do
362
+ assert_equal [b_1, b], dep.to_specs
367
363
  end
368
364
 
369
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["2.0.0.pre.1", "reason"]) do
370
- assert_equal [b], dep.to_specs
365
+ Gem::BundlerVersionFinder.stub(:bundler_version, Gem::Version.new("2.0.0.pre.1")) do
366
+ assert_equal [b, b_1], dep.to_specs
371
367
  end
372
368
  end
373
369
 
@@ -288,33 +288,6 @@ gem 'other', version
288
288
  "(SyntaxError)", e.message
289
289
  end
290
290
 
291
- def test_ensure_no_race_conditions_between_installing_and_loading_gemspecs
292
- a, a_gem = util_gem 'a', 2
293
-
294
- Gem::Installer.at(a_gem).install
295
-
296
- t1 = Thread.new do
297
- 5.times do
298
- Gem::Installer.at(a_gem).install
299
- sleep 0.1
300
- end
301
- end
302
-
303
- t2 = Thread.new do
304
- _, err = capture_output do
305
- 20.times do
306
- Gem::Specification.load(a.spec_file)
307
- Gem::Specification.send(:clear_load_cache)
308
- end
309
- end
310
-
311
- assert_empty err
312
- end
313
-
314
- t1.join
315
- t2.join
316
- end
317
-
318
291
  def test_ensure_loadable_spec_security_policy
319
292
  pend 'openssl is missing' unless Gem::HAVE_OPENSSL
320
293
 
@@ -16,7 +16,7 @@ class TestGemPathSupport < Gem::TestCase
16
16
 
17
17
  assert_equal ENV["GEM_HOME"], ps.home
18
18
 
19
- expected = util_path
19
+ expected = ENV["GEM_PATH"].split(File::PATH_SEPARATOR)
20
20
  assert_equal expected, ps.path, "defaults to GEM_PATH"
21
21
  end
22
22
 
@@ -25,7 +25,7 @@ class TestGemPathSupport < Gem::TestCase
25
25
 
26
26
  assert_equal File.join(@tempdir, "foo"), ps.home
27
27
 
28
- expected = util_path + [File.join(@tempdir, 'foo')]
28
+ expected = ENV["GEM_PATH"].split(File::PATH_SEPARATOR) + [File.join(@tempdir, 'foo')]
29
29
  assert_equal expected, ps.path
30
30
  end
31
31
 
@@ -102,10 +102,6 @@ class TestGemPathSupport < Gem::TestCase
102
102
  end
103
103
  end
104
104
 
105
- def util_path
106
- ENV["GEM_PATH"].split(File::PATH_SEPARATOR)
107
- end
108
-
109
105
  def test_initialize_spec
110
106
  ENV["GEM_SPEC_CACHE"] = nil
111
107
 
@@ -173,6 +173,21 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
173
173
  assert_equal 'hello', File.read(path)
174
174
  end
175
175
 
176
+ def test_cache_update_path_with_utf8_internal_encoding
177
+ with_internal_encoding('UTF-8') do
178
+ uri = URI 'http://example/file'
179
+ path = File.join @tempdir, 'file'
180
+ data = String.new("\xC8").force_encoding(Encoding::BINARY)
181
+
182
+ fetcher = util_fuck_with_fetcher data
183
+
184
+ written_data = fetcher.cache_update_path uri, path
185
+
186
+ assert_equal data, written_data
187
+ assert_equal data, File.binread(path)
188
+ end
189
+ end
190
+
176
191
  def test_cache_update_path_no_update
177
192
  uri = URI 'http://example/file'
178
193
  path = File.join @tempdir, 'file'
@@ -253,7 +253,6 @@ class TestGemRequirement < Gem::TestCase
253
253
  assert_satisfied_by "1.0.0.0", "= 1.0"
254
254
  assert_satisfied_by "10.3.2", "!= 9.3.4"
255
255
  assert_satisfied_by "10.3.2", "> 9.3.2"
256
- assert_satisfied_by "10.3.2", "> 9.3.2"
257
256
  assert_satisfied_by " 9.3.2", ">= 9.3.2"
258
257
  assert_satisfied_by "9.3.2 ", ">= 9.3.2"
259
258
  assert_satisfied_by "", "= 0"
@@ -196,7 +196,7 @@ class TestGemSecurity < Gem::TestCase
196
196
 
197
197
  def test_class_sign
198
198
  issuer = PUBLIC_CERT.subject
199
- signee = OpenSSL::X509::Name.parse "/CN=signee/DC=example"
199
+ signee = OpenSSL::X509::Name.new([["CN", "signee"], ["DC", "example"]])
200
200
 
201
201
  key = PRIVATE_KEY
202
202
  cert = OpenSSL::X509::Certificate.new
@@ -147,6 +147,7 @@ end
147
147
  end
148
148
 
149
149
  def test_find_in_unresolved_tree_is_not_exponentiental
150
+ pend "currently slower in CI on TruffleRuby" if RUBY_ENGINE == 'truffleruby'
150
151
  num_of_pkg = 7
151
152
  num_of_version_per_pkg = 3
152
153
  packages = (0..num_of_pkg).map do |pkgi|
@@ -873,24 +874,21 @@ dependencies: []
873
874
  end
874
875
 
875
876
  def test_self_load_utf8_with_ascii_encoding
876
- int_enc = Encoding.default_internal
877
- silence_warnings { Encoding.default_internal = 'US-ASCII' }
878
-
879
- spec2 = @a2.dup
880
- bin = "\u5678".dup
881
- spec2.authors = [bin]
882
- full_path = spec2.spec_file
883
- write_file full_path do |io|
884
- io.write spec2.to_ruby_for_cache.force_encoding('BINARY').sub("\\u{5678}", bin.force_encoding('BINARY'))
885
- end
877
+ with_internal_encoding('US-ASCII') do
878
+ spec2 = @a2.dup
879
+ bin = "\u5678".dup
880
+ spec2.authors = [bin]
881
+ full_path = spec2.spec_file
882
+ write_file full_path do |io|
883
+ io.write spec2.to_ruby_for_cache.force_encoding('BINARY').sub("\\u{5678}", bin.force_encoding('BINARY'))
884
+ end
886
885
 
887
- spec = Gem::Specification.load full_path
886
+ spec = Gem::Specification.load full_path
888
887
 
889
- spec2.files.clear
888
+ spec2.files.clear
890
889
 
891
- assert_equal spec2, spec
892
- ensure
893
- silence_warnings { Encoding.default_internal = int_enc }
890
+ assert_equal spec2, spec
891
+ end
894
892
  end
895
893
 
896
894
  def test_self_load_legacy_ruby
@@ -944,7 +942,7 @@ dependencies: []
944
942
  end
945
943
 
946
944
  def test_self_outdated_and_latest_remotes
947
- specs = spec_fetcher do |fetcher|
945
+ spec_fetcher do |fetcher|
948
946
  fetcher.download 'a', 4
949
947
  fetcher.download 'b', 3
950
948
 
@@ -953,8 +951,8 @@ dependencies: []
953
951
  end
954
952
 
955
953
  expected = [
956
- [specs['a-3.a'], v(4)],
957
- [specs['b-2'], v(3)],
954
+ [Gem::Specification.stubs.find {|s| s.full_name == 'a-3.a' }, v(4)],
955
+ [Gem::Specification.stubs.find {|s| s.full_name == 'b-2' }, v(3)],
958
956
  ]
959
957
 
960
958
  assert_equal expected, Gem::Specification.outdated_and_latest_version.to_a
@@ -3745,11 +3743,4 @@ end
3745
3743
  end
3746
3744
  end
3747
3745
  end
3748
-
3749
- def silence_warnings
3750
- old_verbose, $VERBOSE = $VERBOSE, false
3751
- yield
3752
- ensure
3753
- $VERBOSE = old_verbose
3754
- end
3755
3746
  end
@@ -5,7 +5,7 @@ require 'timeout'
5
5
 
6
6
  class TestGemStreamUI < Gem::TestCase
7
7
  # increase timeout with MJIT for --jit-wait testing
8
- mjit_enabled = defined?(RubyVM::JIT) ? RubyVM::JIT.enabled? : defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
8
+ mjit_enabled = defined?(RubyVM::MJIT) ? RubyVM::MJIT.enabled? : defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
9
9
  SHORT_TIMEOUT = (RUBY_ENGINE == "ruby" && !mjit_enabled) ? 0.1 : 1.0
10
10
 
11
11
  module IsTty
@@ -83,6 +83,12 @@ Without the wrapping, the text might not look good in the RSS feed.
83
83
  assert_equal 7, levenshtein_distance("zentest", "xxxxxxx")
84
84
  end
85
85
 
86
+ def test_levenshtein_distance_all
87
+ assert_equal 6, levenshtein_distance("algorithm", "altruistic")
88
+ assert_equal 3, levenshtein_distance("saturday", "sunday")
89
+ assert_equal 3, levenshtein_distance("kitten", "sitting")
90
+ end
91
+
86
92
  def test_truncate_text
87
93
  assert_equal "abc", truncate_text("abc", "desc")
88
94
  assert_equal "Truncating desc to 2 characters:\nab", truncate_text("abc", "desc", 2)
@@ -117,20 +117,8 @@ class TestKernel < Gem::TestCase
117
117
  assert $:.any? {|p| %r{bundler-1/lib} =~ p }
118
118
  end
119
119
 
120
- def test_gem_bundler_missing_bundler_version
121
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["55", "reason"]) do
122
- quick_gem 'bundler', '1'
123
- quick_gem 'bundler', '2.a'
124
-
125
- e = assert_raise Gem::MissingSpecVersionError do
126
- gem('bundler')
127
- end
128
- assert_match "Could not find 'bundler' (55) required by reason.", e.message
129
- end
130
- end
131
-
132
120
  def test_gem_bundler_inferred_bundler_version
133
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["1", "reason"]) do
121
+ Gem::BundlerVersionFinder.stub(:bundler_version, Gem::Version.new("1")) do
134
122
  quick_gem 'bundler', '1'
135
123
  quick_gem 'bundler', '2.a'
136
124
 
@@ -13,7 +13,7 @@ class TestProjectSanity < Gem::TestCase
13
13
  end
14
14
 
15
15
  def test_require_rubygems_package
16
- err, status = Open3.capture2e(*ruby_with_rubygems_in_load_path, "--disable-gems", "-e", "'require \"rubygems/package\"'")
16
+ err, status = Open3.capture2e(*ruby_with_rubygems_in_load_path, "--disable-gems", "-e", "require \"rubygems/package\"")
17
17
 
18
18
  assert status.success?, err
19
19
  end
@@ -596,31 +596,6 @@ class TestGemRequire < Gem::TestCase
596
596
  assert_empty unresolved_names
597
597
  end
598
598
 
599
- def test_require_bundler_missing_bundler_version
600
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["55", "reason"]) do
601
- b1 = util_spec('bundler', '1.999999999', nil, "lib/bundler/setup.rb")
602
- b2a = util_spec('bundler', '2.a', nil, "lib/bundler/setup.rb")
603
- install_specs b1, b2a
604
-
605
- e = assert_raise Gem::MissingSpecVersionError do
606
- gem('bundler')
607
- end
608
- assert_match "Could not find 'bundler' (55) required by reason.", e.message
609
- end
610
- end
611
-
612
- def test_require_bundler_with_bundler_version
613
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["1", "reason"]) do
614
- b1 = util_spec('bundler', '1.999999999', nil, "lib/bundler/setup.rb")
615
- b2 = util_spec('bundler', '2', nil, "lib/bundler/setup.rb")
616
- install_specs b1, b2
617
-
618
- $:.clear
619
- assert_require 'bundler/setup'
620
- assert_equal %w[bundler-1.999999999], loaded_spec_names
621
- end
622
- end
623
-
624
599
  # uplevel is 2.5+ only
625
600
  if RUBY_VERSION >= "2.5"
626
601
  ["", "Kernel."].each do |prefix|
@@ -700,13 +675,6 @@ class TestGemRequire < Gem::TestCase
700
675
  !ENV["GEM_COMMAND"].nil?
701
676
  end
702
677
 
703
- def silence_warnings
704
- old_verbose, $VERBOSE = $VERBOSE, false
705
- yield
706
- ensure
707
- $VERBOSE = old_verbose
708
- end
709
-
710
678
  def util_install_extension_file(name)
711
679
  spec = quick_gem name
712
680
  util_build_gem spec
@@ -22,6 +22,29 @@ class GemTest < Gem::TestCase
22
22
  "the problem and ask for help."
23
23
  end
24
24
 
25
+ def test_operating_system_customizing_default_dir
26
+ pend "does not apply to truffleruby" if RUBY_ENGINE == 'truffleruby'
27
+ pend "loads a custom defaults/jruby file that gets in the middle" if RUBY_ENGINE == 'jruby'
28
+
29
+ # On a non existing default dir, there should be no gems
30
+
31
+ path = util_install_operating_system_rb <<-RUBY
32
+ module Gem
33
+ def self.default_dir
34
+ File.expand_path("foo")
35
+ end
36
+ end
37
+ RUBY
38
+
39
+ output = Gem::Util.popen(
40
+ *ruby_with_rubygems_and_fake_operating_system_in_load_path(path),
41
+ '-e',
42
+ "require \"rubygems\"; puts Gem::Specification.stubs.map(&:full_name)",
43
+ {:err => [:child, :out]}
44
+ ).strip
45
+ assert_empty output
46
+ end
47
+
25
48
  private
26
49
 
27
50
  def util_install_operating_system_rb(content)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.33
4
+ version: 3.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2021-12-07 00:00:00.000000000 Z
19
+ date: 2021-12-24 00:00:00.000000000 Z
20
20
  dependencies: []
21
21
  description: |-
22
22
  A package (also known as a library) contains a set of functionality
@@ -74,6 +74,7 @@ files:
74
74
  - bundler/exe/bundle
75
75
  - bundler/exe/bundler
76
76
  - bundler/lib/bundler.rb
77
+ - bundler/lib/bundler/.document
77
78
  - bundler/lib/bundler/build_metadata.rb
78
79
  - bundler/lib/bundler/capistrano.rb
79
80
  - bundler/lib/bundler/cli.rb
@@ -134,7 +135,6 @@ files:
134
135
  - bundler/lib/bundler/gem_helpers.rb
135
136
  - bundler/lib/bundler/gem_tasks.rb
136
137
  - bundler/lib/bundler/gem_version_promoter.rb
137
- - bundler/lib/bundler/gemdeps.rb
138
138
  - bundler/lib/bundler/graph.rb
139
139
  - bundler/lib/bundler/index.rb
140
140
  - bundler/lib/bundler/injector.rb
@@ -222,6 +222,7 @@ files:
222
222
  - bundler/lib/bundler/rubygems_gem_installer.rb
223
223
  - bundler/lib/bundler/rubygems_integration.rb
224
224
  - bundler/lib/bundler/runtime.rb
225
+ - bundler/lib/bundler/self_manager.rb
225
226
  - bundler/lib/bundler/settings.rb
226
227
  - bundler/lib/bundler/settings/validator.rb
227
228
  - bundler/lib/bundler/setup.rb
@@ -272,8 +273,8 @@ files:
272
273
  - bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt
273
274
  - bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt
274
275
  - bundler/lib/bundler/templates/newgem/standard.yml.tt
275
- - bundler/lib/bundler/templates/newgem/test/minitest/newgem_test.rb.tt
276
276
  - bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt
277
+ - bundler/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt
277
278
  - bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt
278
279
  - bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt
279
280
  - bundler/lib/bundler/templates/newgem/travis.yml.tt
@@ -365,6 +366,8 @@ files:
365
366
  - bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb
366
367
  - bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb
367
368
  - bundler/lib/bundler/vendor/uri/lib/uri/version.rb
369
+ - bundler/lib/bundler/vendor/uri/lib/uri/ws.rb
370
+ - bundler/lib/bundler/vendor/uri/lib/uri/wss.rb
368
371
  - bundler/lib/bundler/vendored_fileutils.rb
369
372
  - bundler/lib/bundler/vendored_molinillo.rb
370
373
  - bundler/lib/bundler/vendored_persistent.rb
@@ -549,7 +552,6 @@ files:
549
552
  - lib/rubygems/security/signer.rb
550
553
  - lib/rubygems/security/trust_dir.rb
551
554
  - lib/rubygems/security_option.rb
552
- - lib/rubygems/server.rb
553
555
  - lib/rubygems/source.rb
554
556
  - lib/rubygems/source/git.rb
555
557
  - lib/rubygems/source/installed.rb
@@ -571,6 +573,7 @@ files:
571
573
  - lib/rubygems/tsort/LICENSE.txt
572
574
  - lib/rubygems/tsort/lib/tsort.rb
573
575
  - lib/rubygems/uninstaller.rb
576
+ - lib/rubygems/unknown_command_spell_checker.rb
574
577
  - lib/rubygems/uri.rb
575
578
  - lib/rubygems/uri_formatter.rb
576
579
  - lib/rubygems/user_interaction.rb
@@ -586,7 +589,6 @@ files:
586
589
  - test/rubygems/alternate_cert_32.pem
587
590
  - test/rubygems/alternate_key.pem
588
591
  - test/rubygems/bad_rake.rb
589
- - test/rubygems/bogussources.rb
590
592
  - test/rubygems/ca_cert.pem
591
593
  - test/rubygems/child_cert.pem
592
594
  - test/rubygems/child_cert_32.pem
@@ -643,6 +645,7 @@ files:
643
645
  - test/rubygems/test_bundled_ca.rb
644
646
  - test/rubygems/test_config.rb
645
647
  - test/rubygems/test_deprecate.rb
648
+ - test/rubygems/test_exit.rb
646
649
  - test/rubygems/test_gem.rb
647
650
  - test/rubygems/test_gem_available_set.rb
648
651
  - test/rubygems/test_gem_bundler_version_finder.rb
@@ -745,7 +748,6 @@ files:
745
748
  - test/rubygems/test_gem_security_policy.rb
746
749
  - test/rubygems/test_gem_security_signer.rb
747
750
  - test/rubygems/test_gem_security_trust_dir.rb
748
- - test/rubygems/test_gem_server.rb
749
751
  - test/rubygems/test_gem_silent_ui.rb
750
752
  - test/rubygems/test_gem_source.rb
751
753
  - test/rubygems/test_gem_source_fetch_problem.rb
@@ -802,7 +804,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
802
804
  - !ruby/object:Gem::Version
803
805
  version: '0'
804
806
  requirements: []
805
- rubygems_version: 3.2.33
807
+ rubygems_version: 3.3.3
806
808
  signing_key:
807
809
  specification_version: 4
808
810
  summary: RubyGems is a package management framework for Ruby.
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bundler
4
- class Gemdeps
5
- def initialize(runtime)
6
- @runtime = runtime
7
- end
8
-
9
- def requested_specs
10
- @runtime.requested_specs
11
- end
12
-
13
- def specs
14
- @runtime.specs
15
- end
16
-
17
- def dependencies
18
- @runtime.dependencies
19
- end
20
-
21
- def current_dependencies
22
- @runtime.current_dependencies
23
- end
24
-
25
- def requires
26
- @runtime.requires
27
- end
28
- end
29
- end