rubygems-update 3.1.0.pre3 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.bundle/config +2 -0
  3. data/Gemfile +8 -0
  4. data/Gemfile.lock +43 -0
  5. data/History.txt +32 -0
  6. data/Manifest.txt +20 -3
  7. data/Rakefile +2 -6
  8. data/bundler/CHANGELOG.md +3 -3
  9. data/bundler/lib/bundler.rb +0 -1
  10. data/bundler/lib/bundler/build_metadata.rb +2 -0
  11. data/bundler/lib/bundler/cli.rb +4 -3
  12. data/bundler/lib/bundler/cli/config.rb +1 -1
  13. data/bundler/lib/bundler/cli/exec.rb +12 -3
  14. data/bundler/lib/bundler/cli/gem.rb +10 -1
  15. data/bundler/lib/bundler/cli/info.rb +7 -0
  16. data/bundler/lib/bundler/cli/list.rb +11 -9
  17. data/bundler/lib/bundler/cli/outdated.rb +86 -63
  18. data/bundler/lib/bundler/cli/pristine.rb +5 -0
  19. data/bundler/lib/bundler/cli/update.rb +1 -1
  20. data/bundler/lib/bundler/feature_flag.rb +1 -1
  21. data/bundler/lib/bundler/fetcher.rb +2 -2
  22. data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
  23. data/bundler/lib/bundler/fetcher/index.rb +1 -1
  24. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  25. data/bundler/lib/bundler/gem_helper.rb +12 -10
  26. data/bundler/lib/bundler/inline.rb +36 -31
  27. data/bundler/lib/bundler/lazy_specification.rb +0 -1
  28. data/bundler/lib/bundler/mirror.rb +3 -3
  29. data/bundler/lib/bundler/plugin/api/source.rb +2 -4
  30. data/bundler/lib/bundler/remote_specification.rb +0 -2
  31. data/bundler/lib/bundler/rubygems_integration.rb +5 -42
  32. data/bundler/lib/bundler/settings.rb +7 -4
  33. data/bundler/lib/bundler/source/git.rb +9 -9
  34. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -2
  35. data/bundler/lib/bundler/source/rubygems.rb +3 -3
  36. data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
  37. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +3 -0
  38. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +10 -3
  39. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
  40. data/bundler/lib/bundler/uri_credentials_filter.rb +7 -3
  41. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +3 -3
  42. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +26 -26
  43. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +7 -0
  44. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +10 -6
  45. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +29 -19
  46. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  47. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
  48. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +13 -2
  49. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +8 -9
  50. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
  51. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +2 -2
  52. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +17 -1
  53. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  54. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  55. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  56. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  57. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  58. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  59. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  60. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  61. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  62. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  63. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  64. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  65. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  66. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  67. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  68. data/bundler/man/bundle-add.1 +1 -1
  69. data/bundler/man/bundle-add.1.txt +1 -1
  70. data/bundler/man/bundle-binstubs.1 +1 -1
  71. data/bundler/man/bundle-binstubs.1.txt +1 -1
  72. data/bundler/man/bundle-cache.1 +1 -1
  73. data/bundler/man/bundle-cache.1.txt +1 -1
  74. data/bundler/man/bundle-check.1 +1 -1
  75. data/bundler/man/bundle-check.1.txt +1 -1
  76. data/bundler/man/bundle-clean.1 +1 -1
  77. data/bundler/man/bundle-clean.1.txt +1 -1
  78. data/bundler/man/bundle-config.1 +1 -1
  79. data/bundler/man/bundle-config.1.txt +1 -1
  80. data/bundler/man/bundle-doctor.1 +1 -1
  81. data/bundler/man/bundle-doctor.1.txt +1 -1
  82. data/bundler/man/bundle-exec.1 +1 -1
  83. data/bundler/man/bundle-exec.1.txt +1 -1
  84. data/bundler/man/bundle-gem.1 +1 -1
  85. data/bundler/man/bundle-gem.1.txt +1 -1
  86. data/bundler/man/bundle-info.1 +1 -1
  87. data/bundler/man/bundle-info.1.txt +1 -1
  88. data/bundler/man/bundle-init.1 +1 -1
  89. data/bundler/man/bundle-init.1.txt +1 -1
  90. data/bundler/man/bundle-inject.1 +1 -1
  91. data/bundler/man/bundle-inject.1.txt +1 -1
  92. data/bundler/man/bundle-install.1 +1 -1
  93. data/bundler/man/bundle-install.1.txt +1 -1
  94. data/bundler/man/bundle-list.1 +7 -7
  95. data/bundler/man/bundle-list.1.txt +9 -8
  96. data/bundler/man/bundle-list.ronn +6 -6
  97. data/bundler/man/bundle-lock.1 +1 -1
  98. data/bundler/man/bundle-lock.1.txt +1 -1
  99. data/bundler/man/bundle-open.1 +1 -1
  100. data/bundler/man/bundle-open.1.txt +1 -1
  101. data/bundler/man/bundle-outdated.1 +1 -1
  102. data/bundler/man/bundle-outdated.1.txt +1 -1
  103. data/bundler/man/bundle-platform.1 +1 -1
  104. data/bundler/man/bundle-platform.1.txt +1 -1
  105. data/bundler/man/bundle-pristine.1 +1 -1
  106. data/bundler/man/bundle-pristine.1.txt +1 -1
  107. data/bundler/man/bundle-remove.1 +1 -1
  108. data/bundler/man/bundle-remove.1.txt +1 -1
  109. data/bundler/man/bundle-show.1 +1 -1
  110. data/bundler/man/bundle-show.1.txt +1 -1
  111. data/bundler/man/bundle-update.1 +1 -1
  112. data/bundler/man/bundle-update.1.txt +1 -1
  113. data/bundler/man/bundle-viz.1 +1 -1
  114. data/bundler/man/bundle-viz.1.txt +1 -1
  115. data/bundler/man/bundle.1 +1 -1
  116. data/bundler/man/bundle.1.txt +1 -1
  117. data/bundler/man/gemfile.5 +1 -1
  118. data/bundler/man/gemfile.5.txt +1 -1
  119. data/lib/rubygems.rb +5 -15
  120. data/lib/rubygems/command.rb +28 -6
  121. data/lib/rubygems/commands/generate_index_command.rb +3 -0
  122. data/lib/rubygems/commands/setup_command.rb +1 -1
  123. data/lib/rubygems/commands/sources_command.rb +14 -0
  124. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  125. data/lib/rubygems/core_ext/kernel_warn.rb +8 -4
  126. data/lib/rubygems/ext/builder.rb +1 -1
  127. data/lib/rubygems/remote_fetcher.rb +20 -31
  128. data/lib/rubygems/request.rb +2 -0
  129. data/lib/rubygems/source.rb +7 -1
  130. data/lib/rubygems/specification_policy.rb +44 -29
  131. data/lib/rubygems/uri_formatter.rb +0 -1
  132. data/lib/rubygems/uri_parser.rb +36 -0
  133. data/lib/rubygems/uri_parsing.rb +23 -0
  134. data/rubygems-update.gemspec +1 -8
  135. data/test/rubygems/test_gem.rb +3 -3
  136. data/test/rubygems/test_gem_command.rb +38 -9
  137. data/test/rubygems/test_gem_commands_generate_index_command.rb +37 -1
  138. data/test/rubygems/test_gem_commands_help_command.rb +1 -6
  139. data/test/rubygems/test_gem_commands_server_command.rb +6 -2
  140. data/test/rubygems/test_gem_commands_sources_command.rb +74 -0
  141. data/test/rubygems/test_gem_gem_runner.rb +3 -1
  142. data/test/rubygems/test_gem_indexer.rb +1 -1
  143. data/test/rubygems/test_gem_source.rb +14 -0
  144. data/test/rubygems/test_gem_specification.rb +48 -48
  145. data/test/rubygems/test_project_sanity.rb +0 -43
  146. data/test/rubygems/test_remote_fetch_error.rb +1 -1
  147. data/test/rubygems/test_require.rb +41 -42
  148. data/util/bisect +0 -21
  149. data/util/ci.sh +1 -1
  150. metadata +23 -90
  151. data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
  152. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +0 -5
  153. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
@@ -3,6 +3,10 @@ require 'rubygems/test_case'
3
3
  require 'rubygems/indexer'
4
4
  require 'rubygems/commands/generate_index_command'
5
5
 
6
+ unless defined?(Builder::XChar)
7
+ warn "generate_index tests are being skipped. Install builder gem."
8
+ end
9
+
6
10
  class TestGemCommandsGenerateIndexCommand < Gem::TestCase
7
11
 
8
12
  def setup
@@ -22,6 +26,18 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase
22
26
  assert File.exist?(specs), specs
23
27
  end
24
28
 
29
+ def test_execute_no_modern
30
+ @cmd.options[:modern] = false
31
+
32
+ use_ui @ui do
33
+ @cmd.execute
34
+ end
35
+
36
+ specs = File.join @gemhome, "specs.4.8.gz"
37
+
38
+ assert File.exist?(specs), specs
39
+ end
40
+
25
41
  def test_handle_options_directory
26
42
  return if win_platform?
27
43
  refute_equal '/nonexistent', @cmd.options[:directory]
@@ -47,4 +63,24 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase
47
63
  assert @cmd.options[:update]
48
64
  end
49
65
 
50
- end if ''.respond_to? :to_xs
66
+ def test_handle_options_modern
67
+ use_ui @ui do
68
+ @cmd.handle_options %w[--modern]
69
+ end
70
+
71
+ assert_equal \
72
+ "WARNING: The \"--modern\" option has been deprecated and will be removed in Rubygems 4.0. Modern indexes (specs, latest_specs, and prerelease_specs) are always generated, so this option is not needed.\n",
73
+ @ui.error
74
+ end
75
+
76
+ def test_handle_options_no_modern
77
+ use_ui @ui do
78
+ @cmd.handle_options %w[--no-modern]
79
+ end
80
+
81
+ assert_equal \
82
+ "WARNING: The \"--no-modern\" option has been deprecated and will be removed in Rubygems 4.0. The `--no-modern` option is currently ignored. Modern indexes (specs, latest_specs, and prerelease_specs) are always generated.\n",
83
+ @ui.error
84
+ end
85
+
86
+ end if defined?(Builder::XChar)
@@ -4,20 +4,15 @@ require "rubygems/test_case"
4
4
  require "rubygems/commands/help_command"
5
5
  require "rubygems/package"
6
6
  require "rubygems/command_manager"
7
- require File.expand_path('../rubygems_plugin', __FILE__)
8
7
 
9
8
  class TestGemCommandsHelpCommand < Gem::TestCase
10
9
 
11
- # previously this was calc'd in setup, but 1.8.7 had
12
- # intermittent failures, but no issues with above require
13
- PLUGIN = File.expand_path('../rubygems_plugin.rb', __FILE__)
14
-
15
10
  def setup
16
11
  super
17
12
 
18
13
  @cmd = Gem::Commands::HelpCommand.new
19
14
 
20
- load PLUGIN unless Gem::Commands.const_defined? :InterruptCommand
15
+ load File.expand_path('../rubygems_plugin.rb', __FILE__) unless Gem::Commands.const_defined? :InterruptCommand
21
16
  end
22
17
 
23
18
  def test_gem_help_bad
@@ -38,8 +38,12 @@ class TestGemCommandsServerCommand < Gem::TestCase
38
38
  @cmd.send :handle_options, %w[-p 65535]
39
39
  assert_equal 65535, @cmd.options[:port]
40
40
 
41
- @cmd.send :handle_options, %w[-p discard]
42
- assert_equal 9, @cmd.options[:port]
41
+ begin
42
+ @cmd.send :handle_options, %w[-p discard]
43
+ assert_equal 9, @cmd.options[:port]
44
+ rescue OptionParser::InvalidArgument
45
+ # for container environment on GitHub Actions
46
+ end
43
47
 
44
48
  e = assert_raises OptionParser::InvalidArgument do
45
49
  @cmd.send :handle_options, %w[-p nonexistent]
@@ -74,6 +74,80 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
74
74
  assert_equal '', @ui.error
75
75
  end
76
76
 
77
+ def test_execute_add_allow_typo_squatting_source
78
+ rubygems_org = "https://rubyems.org"
79
+
80
+ spec_fetcher do |fetcher|
81
+ fetcher.spec("a", 1)
82
+ end
83
+
84
+ specs = Gem::Specification.map do |spec|
85
+ [spec.name, spec.version, spec.original_platform]
86
+ end
87
+
88
+ specs_dump_gz = StringIO.new
89
+ Zlib::GzipWriter.wrap(specs_dump_gz) do |io|
90
+ Marshal.dump(specs, io)
91
+ end
92
+
93
+ @fetcher.data["#{rubygems_org}/specs.#{@marshal_version}.gz"] = specs_dump_gz.string
94
+ @cmd.handle_options %W[--add #{rubygems_org}]
95
+ ui = Gem::MockGemUi.new("y")
96
+
97
+ use_ui ui do
98
+ @cmd.execute
99
+ end
100
+
101
+ expected = "https://rubyems.org is too similar to https://rubygems.org\n\nDo you want to add this source? [yn] https://rubyems.org added to sources\n"
102
+
103
+ assert_equal expected, ui.output
104
+
105
+ source = Gem::Source.new(rubygems_org)
106
+ assert Gem.sources.include?(source)
107
+
108
+ assert_empty ui.error
109
+ end
110
+
111
+ def test_execute_add_deny_typo_squatting_source
112
+ rubygems_org = "https://rubyems.org"
113
+
114
+ spec_fetcher do |fetcher|
115
+ fetcher.spec("a", 1)
116
+ end
117
+
118
+ specs = Gem::Specification.map do |spec|
119
+ [spec.name, spec.version, spec.original_platform]
120
+ end
121
+
122
+ specs_dump_gz = StringIO.new
123
+ Zlib::GzipWriter.wrap(specs_dump_gz) do |io|
124
+ Marshal.dump(specs, io)
125
+ end
126
+
127
+ @fetcher.data["#{rubygems_org}/specs.#{@marshal_version}.gz"] =
128
+ specs_dump_gz.string
129
+
130
+ @cmd.handle_options %W[--add #{rubygems_org}]
131
+
132
+ ui = Gem::MockGemUi.new("n")
133
+
134
+ use_ui ui do
135
+
136
+ assert_raises Gem::MockGemUi::TermError do
137
+ @cmd.execute
138
+ end
139
+ end
140
+
141
+ expected = "https://rubyems.org is too similar to https://rubygems.org\n\nDo you want to add this source? [yn] "
142
+
143
+ assert_equal expected, ui.output
144
+
145
+ source = Gem::Source.new(rubygems_org)
146
+ refute Gem.sources.include?(source)
147
+
148
+ assert_empty ui.error
149
+ end
150
+
77
151
  def test_execute_add_nonexistent_source
78
152
  spec_fetcher
79
153
 
@@ -1,13 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
  require 'rubygems/test_case'
3
- require 'rubygems/gem_runner'
4
3
 
5
4
  class TestGemGemRunner < Gem::TestCase
6
5
 
7
6
  def setup
8
7
  super
9
8
 
9
+ require 'rubygems/command'
10
10
  @orig_args = Gem::Command.build_args
11
+
12
+ require 'rubygems/gem_runner'
11
13
  @runner = Gem::GemRunner.new
12
14
  end
13
15
 
@@ -3,7 +3,7 @@ require 'rubygems/test_case'
3
3
  require 'rubygems/indexer'
4
4
 
5
5
  unless defined?(Builder::XChar)
6
- warn "Gem::Indexer tests are being skipped. Install builder gem." if $VERBOSE
6
+ warn "Gem::Indexer tests are being skipped. Install builder gem."
7
7
  end
8
8
 
9
9
  class TestGemIndexer < Gem::TestCase
@@ -235,4 +235,18 @@ class TestGemSource < Gem::TestCase
235
235
  refute @source.update_cache?
236
236
  end
237
237
 
238
+ def test_typo_squatting
239
+ rubygems_source = Gem::Source.new("https://rubgems.org")
240
+ assert rubygems_source.typo_squatting?("rubygems.org")
241
+ assert rubygems_source.typo_squatting?("rubyagems.org")
242
+ assert rubygems_source.typo_squatting?("rubyasgems.org")
243
+ refute rubygems_source.typo_squatting?("rubysertgems.org")
244
+ end
245
+
246
+ def test_typo_squatting_custom_distance_threshold
247
+ rubygems_source = Gem::Source.new("https://rubgems.org")
248
+ distance_threshold = 5
249
+ assert rubygems_source.typo_squatting?("rubysertgems.org", distance_threshold)
250
+ end
251
+
238
252
  end
@@ -126,8 +126,8 @@ end
126
126
  def test_self_activate_ambiguous_direct
127
127
  save_loaded_features do
128
128
  a1 = util_spec "a", "1", "b" => "> 0"
129
- b1 = util_spec("b", "1", { "c" => ">= 1" }, "lib/d.rb")
130
- b2 = util_spec("b", "2", { "c" => ">= 2" }, "lib/d.rb")
129
+ b1 = util_spec("b", "1", { "c" => ">= 1" }, "lib/d#{$$}.rb")
130
+ b2 = util_spec("b", "2", { "c" => ">= 2" }, "lib/d#{$$}.rb")
131
131
  c1 = util_spec "c", "1"
132
132
  c2 = util_spec "c", "2"
133
133
 
@@ -138,7 +138,7 @@ end
138
138
  assert_equal %w(a-1), loaded_spec_names
139
139
  assert_equal ["b (> 0)"], unresolved_names
140
140
 
141
- require "d"
141
+ require "d#{$$}"
142
142
 
143
143
  assert_equal %w(a-1 b-2 c-2), loaded_spec_names
144
144
  assert_equal [], unresolved_names
@@ -176,8 +176,8 @@ end
176
176
  a1 = util_spec "a", "1", "b" => "> 0"
177
177
  b1 = util_spec "b", "1", "c" => ">= 1"
178
178
  b2 = util_spec "b", "2", "c" => ">= 2"
179
- c1 = util_spec "c", "1", nil, "lib/d.rb"
180
- c2 = util_spec "c", "2", nil, "lib/d.rb"
179
+ c1 = util_spec "c", "1", nil, "lib/d#{$$}.rb"
180
+ c2 = util_spec "c", "2", nil, "lib/d#{$$}.rb"
181
181
 
182
182
  install_specs c1, c2, b1, b2, a1
183
183
 
@@ -185,7 +185,7 @@ end
185
185
  assert_equal %w(a-1), loaded_spec_names
186
186
  assert_equal ["b (> 0)"], unresolved_names
187
187
 
188
- require "d"
188
+ require "d#{$$}"
189
189
 
190
190
  assert_equal %w(a-1 b-2 c-2), loaded_spec_names
191
191
  assert_equal [], unresolved_names
@@ -198,8 +198,8 @@ end
198
198
  a2 = util_spec "a", "2", "b" => "> 0"
199
199
  b1 = util_spec "b", "1", "c" => ">= 1"
200
200
  b2 = util_spec "b", "2", "c" => ">= 2"
201
- c1 = util_spec "c", "1", nil, "lib/d.rb"
202
- c2 = util_spec("c", "2", { "a" => "1" }, "lib/d.rb") # conflicts with a-2
201
+ c1 = util_spec "c", "1", nil, "lib/d#{$$}.rb"
202
+ c2 = util_spec("c", "2", { "a" => "1" }, "lib/d#{$$}.rb") # conflicts with a-2
203
203
 
204
204
  install_specs c1, b1, a1, a2, c2, b2
205
205
 
@@ -207,7 +207,7 @@ end
207
207
  assert_equal %w(a-2), loaded_spec_names
208
208
  assert_equal ["b (> 0)"], unresolved_names
209
209
 
210
- require "d"
210
+ require "d#{$$}"
211
211
 
212
212
  assert_equal %w(a-2 b-1 c-1), loaded_spec_names
213
213
  assert_equal [], unresolved_names
@@ -221,7 +221,7 @@ end
221
221
  b2 = util_spec "b", "2", "c" => ">= 2"
222
222
  c1 = util_spec "c", "1"
223
223
  c2 = util_spec "c", "2"
224
- d1 = util_spec "d", "1", nil, "lib/d.rb"
224
+ d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb"
225
225
 
226
226
  install_specs d1, c1, c2, b1, b2, a1
227
227
 
@@ -229,7 +229,7 @@ end
229
229
  assert_equal %w(a-1), loaded_spec_names
230
230
  assert_equal ["b (> 0)"], unresolved_names
231
231
 
232
- require "d"
232
+ require "d#{$$}"
233
233
 
234
234
  assert_equal %w(a-1 d-1), loaded_spec_names
235
235
  assert_equal ["b (> 0)"], unresolved_names
@@ -241,14 +241,14 @@ end
241
241
  a1 = util_spec "a", "1", "b" => "> 0"
242
242
  b1 = util_spec "b", "1", "c" => ">= 0" # unresolved
243
243
  b2 = util_spec "b", "2", "c" => ">= 0"
244
- c1 = util_spec "c", "1", nil, "lib/c.rb" # 1st level
245
- c2 = util_spec "c", "2", nil, "lib/c.rb"
244
+ c1 = util_spec "c", "1", nil, "lib/c#{$$}.rb" # 1st level
245
+ c2 = util_spec "c", "2", nil, "lib/c#{$$}.rb"
246
246
 
247
247
  install_specs c1, c2, b1, b2, a1
248
248
 
249
249
  a1.activate
250
250
 
251
- require "c"
251
+ require "c#{$$}"
252
252
 
253
253
  assert_equal %w(a-1 b-2 c-2), loaded_spec_names
254
254
  end
@@ -261,14 +261,14 @@ end
261
261
  b2 = util_spec "b", "2", "c" => ">= 0"
262
262
  c1 = util_spec "c", "1", "d" => ">= 0" # 1st level
263
263
  c2 = util_spec "c", "2", "d" => ">= 0"
264
- d1 = util_spec "d", "1", nil, "lib/d.rb" # 2nd level
265
- d2 = util_spec "d", "2", nil, "lib/d.rb"
264
+ d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
265
+ d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
266
266
 
267
267
  install_specs d1, d2, c1, c2, b1, b2, a1
268
268
 
269
269
  a1.activate
270
270
 
271
- require "d"
271
+ require "d#{$$}"
272
272
 
273
273
  assert_equal %w(a-1 b-2 c-2 d-2), loaded_spec_names
274
274
  end
@@ -281,15 +281,15 @@ end
281
281
  b2 = util_spec "b", "2", "c" => ">= 0"
282
282
  c1 = util_spec "c", "1", "d" => "<= 2" # 1st level
283
283
  c2 = util_spec "c", "2", "d" => "<= 2"
284
- d1 = util_spec "d", "1", nil, "lib/d.rb" # 2nd level
285
- d2 = util_spec "d", "2", nil, "lib/d.rb"
286
- d3 = util_spec "d", "3", nil, "lib/d.rb"
284
+ d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
285
+ d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
286
+ d3 = util_spec "d", "3", nil, "lib/d#{$$}.rb"
287
287
 
288
288
  install_specs d1, d2, d3, c1, c2, b1, b2, a1
289
289
 
290
290
  a1.activate
291
291
 
292
- require "d"
292
+ require "d#{$$}"
293
293
 
294
294
  assert_equal %w(a-1 b-2 c-2 d-2), loaded_spec_names
295
295
  end
@@ -302,16 +302,16 @@ end
302
302
  b2 = util_spec "b", "2", "c" => ">= 0"
303
303
  c1 = util_spec "c", "1", "d" => "<= 2" # 1st level
304
304
  c2 = util_spec "c", "2", "d" => "<= 2"
305
- d1 = util_spec "d", "1", nil, "lib/d.rb" # 2nd level
306
- d2 = util_spec "d", "2", nil, "lib/d.rb"
307
- d3 = util_spec "d", "3", nil, "lib/d.rb"
308
- e = util_spec "anti_d", "1", nil, "lib/d.rb"
305
+ d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
306
+ d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
307
+ d3 = util_spec "d", "3", nil, "lib/d#{$$}.rb"
308
+ e = util_spec "anti_d", "1", nil, "lib/d#{$$}.rb"
309
309
 
310
310
  install_specs d1, d2, d3, e, c1, c2, b1, b2, a1
311
311
 
312
312
  a1.activate
313
313
 
314
- require "d"
314
+ require "d#{$$}"
315
315
 
316
316
  assert_equal %w(a-1 b-2 c-2 d-2), loaded_spec_names
317
317
  end
@@ -322,8 +322,8 @@ end
322
322
  base = util_spec "0", "1", "A" => ">= 1"
323
323
  a1 = util_spec "A", "1", {"c" => ">= 2", "b" => "> 0"}, "lib/a.rb"
324
324
  a2 = util_spec "A", "2", {"c" => ">= 2", "b" => "> 0"}, "lib/a.rb"
325
- b1 = util_spec "b", "1", {"c" => "= 1"}, "lib/d.rb"
326
- b2 = util_spec "b", "2", {"c" => "= 2"}, "lib/d.rb"
325
+ b1 = util_spec "b", "1", {"c" => "= 1"}, "lib/d#{$$}.rb"
326
+ b2 = util_spec "b", "2", {"c" => "= 2"}, "lib/d#{$$}.rb"
327
327
  c1 = util_spec "c", "1", {}, "lib/c.rb"
328
328
  c2 = util_spec "c", "2", {}, "lib/c.rb"
329
329
  c3 = util_spec "c", "3", {}, "lib/c.rb"
@@ -334,7 +334,7 @@ end
334
334
  assert_equal %w(0-1), loaded_spec_names
335
335
  assert_equal ["A (>= 1)"], unresolved_names
336
336
 
337
- require "d"
337
+ require "d#{$$}"
338
338
 
339
339
  assert_equal %w(0-1 A-2 b-2 c-2), loaded_spec_names
340
340
  assert_equal [], unresolved_names
@@ -349,15 +349,15 @@ end
349
349
  c1 = util_spec "c", "1", "d" => "<= 2" # 1st level
350
350
  c2 = util_spec "c", "2", "d" => "<= 2"
351
351
  c3 = util_spec "c", "3", "d" => "<= 3"
352
- d1 = util_spec "d", "1", nil, "lib/d.rb" # 2nd level
353
- d2 = util_spec "d", "2", nil, "lib/d.rb"
354
- d3 = util_spec "d", "3", nil, "lib/d.rb"
352
+ d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
353
+ d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
354
+ d3 = util_spec "d", "3", nil, "lib/d#{$$}.rb"
355
355
 
356
356
  install_specs d1, d2, d3, c1, c2, c3, b1, b2, a1
357
357
 
358
358
  a1.activate
359
359
 
360
- require "d"
360
+ require "d#{$$}"
361
361
 
362
362
  assert_includes [%w(a-1 b-2 c-3 d-2),%w(a-1 b-2 d-2)], loaded_spec_names
363
363
  end
@@ -371,15 +371,15 @@ end
371
371
  c1 = util_spec "xc", "1", "d" => "<= 3" # 1st level
372
372
  c2 = util_spec "xc", "2", "d" => "<= 2"
373
373
  c3 = util_spec "xc", "3", "d" => "<= 3"
374
- d1 = util_spec "d", "1", nil, "lib/d.rb" # 2nd level
375
- d2 = util_spec "d", "2", nil, "lib/d.rb"
376
- d3 = util_spec "d", "3", nil, "lib/d.rb"
374
+ d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
375
+ d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
376
+ d3 = util_spec "d", "3", nil, "lib/d#{$$}.rb"
377
377
 
378
378
  install_specs d1, d2, d3, c1, c2, c3, b1, b2, a1
379
379
 
380
380
  a1.activate
381
381
 
382
- require "d"
382
+ require "d#{$$}"
383
383
 
384
384
  assert_includes [%w(a-1 b-2 d-2 xc-3), %w(a-1 b-2 d-2)], loaded_spec_names
385
385
  end
@@ -516,12 +516,12 @@ end
516
516
  def test_self_activate_via_require_wtf
517
517
  save_loaded_features do
518
518
  a1 = util_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
519
- b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/b.rb"
520
- b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b.rb" # this
519
+ b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/b#{$$}.rb"
520
+ b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b#{$$}.rb" # this
521
521
  c1 = util_spec "c", "1"
522
522
  c2 = util_spec "c", "2" # this
523
- d1 = util_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
524
- d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
523
+ d1 = util_spec "d", "1", { "c" => "< 2" }, "lib/d#{$$}.rb"
524
+ d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d#{$$}.rb" # this
525
525
 
526
526
  install_specs c1, c2, b1, b2, d1, d2, a1
527
527
 
@@ -530,10 +530,10 @@ end
530
530
  assert_equal %w(a-1), loaded_spec_names
531
531
  assert_equal ["b (> 0)", "d (> 0)"], unresolved_names
532
532
 
533
- require "b"
533
+ require "b#{$$}"
534
534
 
535
535
  e = assert_raises Gem::LoadError do
536
- require "d"
536
+ require "d#{$$}"
537
537
  end
538
538
 
539
539
  assert_equal "unable to find a version of 'd' to activate", e.message
@@ -2287,7 +2287,7 @@ dependencies: []
2287
2287
 
2288
2288
  def test_require_already_activated
2289
2289
  save_loaded_features do
2290
- a1 = util_spec "a", "1", nil, "lib/d.rb"
2290
+ a1 = util_spec "a", "1", nil, "lib/d#{$$}.rb"
2291
2291
 
2292
2292
  install_specs a1 # , a2, b1, b2, c1, c2
2293
2293
 
@@ -2295,7 +2295,7 @@ dependencies: []
2295
2295
  assert_equal %w(a-1), loaded_spec_names
2296
2296
  assert_equal [], unresolved_names
2297
2297
 
2298
- assert require "d"
2298
+ assert require "d#{$$}"
2299
2299
 
2300
2300
  assert_equal %w(a-1), loaded_spec_names
2301
2301
  assert_equal [], unresolved_names
@@ -2308,8 +2308,8 @@ dependencies: []
2308
2308
  a2 = util_spec "a", "2", "b" => "> 0"
2309
2309
  b1 = util_spec "b", "1", "c" => ">= 1"
2310
2310
  b2 = util_spec "b", "2", "c" => ">= 2"
2311
- c1 = util_spec "c", "1", nil, "lib/d.rb"
2312
- c2 = util_spec("c", "2", { "a" => "1" }, "lib/d.rb") # conflicts with a-2
2311
+ c1 = util_spec "c", "1", nil, "lib/d#{$$}.rb"
2312
+ c2 = util_spec("c", "2", { "a" => "1" }, "lib/d#{$$}.rb") # conflicts with a-2
2313
2313
 
2314
2314
  install_specs c1, b1, a1, a2, c2, b2
2315
2315
 
@@ -2318,7 +2318,7 @@ dependencies: []
2318
2318
  assert_equal %w(a-1 c-1), loaded_spec_names
2319
2319
  assert_equal ["b (> 0)"], unresolved_names
2320
2320
 
2321
- assert require "d"
2321
+ assert require "d#{$$}"
2322
2322
 
2323
2323
  assert_equal %w(a-1 c-1), loaded_spec_names
2324
2324
  assert_equal ["b (> 0)"], unresolved_names