rubygems-update 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.autotest +24 -0
- data/.document +4 -3
- data/ChangeLog +382 -1
- data/Manifest.txt +214 -0
- data/README +1 -49
- data/Rakefile +124 -191
- data/bin/gem +1 -4
- data/cruise_config.rb +22 -0
- data/doc/release_notes/rel_1_3_1.rdoc +3 -3
- data/doc/release_notes/rel_1_3_2.rdoc +119 -0
- data/lib/gauntlet_rubygems.rb +50 -0
- data/lib/rubygems.rb +250 -25
- data/lib/rubygems/builder.rb +62 -60
- data/lib/rubygems/command.rb +421 -319
- data/lib/rubygems/command_manager.rb +153 -125
- data/lib/rubygems/commands/check_command.rb +12 -7
- data/lib/rubygems/commands/cleanup_command.rb +11 -2
- data/lib/rubygems/commands/contents_command.rb +42 -18
- data/lib/rubygems/commands/generate_index_command.rb +91 -15
- data/lib/rubygems/commands/install_command.rb +33 -47
- data/lib/rubygems/commands/query_command.rb +36 -20
- data/lib/rubygems/commands/rdoc_command.rb +62 -68
- data/lib/rubygems/commands/search_command.rb +26 -32
- data/lib/rubygems/commands/setup_command.rb +353 -0
- data/lib/rubygems/commands/sources_command.rb +5 -0
- data/lib/rubygems/commands/specification_command.rb +23 -3
- data/lib/rubygems/commands/uninstall_command.rb +71 -61
- data/lib/rubygems/commands/unpack_command.rb +14 -12
- data/lib/rubygems/commands/update_command.rb +26 -5
- data/lib/rubygems/defaults.rb +16 -3
- data/lib/rubygems/dependency.rb +38 -7
- data/lib/rubygems/dependency_installer.rb +7 -4
- data/lib/rubygems/digest/digest_adapter.rb +42 -33
- data/lib/rubygems/digest/sha1.rb +6 -1
- data/lib/rubygems/digest/sha2.rb +5 -0
- data/lib/rubygems/doc_manager.rb +31 -11
- data/lib/rubygems/ext/ext_conf_builder.rb +2 -1
- data/lib/rubygems/ext/rake_builder.rb +6 -2
- data/lib/rubygems/format.rb +63 -63
- data/lib/rubygems/gem_openssl.rb +14 -2
- data/lib/rubygems/gem_path_searcher.rb +7 -3
- data/lib/rubygems/gem_runner.rb +59 -39
- data/lib/rubygems/indexer.rb +450 -109
- data/lib/rubygems/install_update_options.rb +13 -1
- data/lib/rubygems/installer.rb +25 -22
- data/lib/rubygems/local_remote_options.rb +5 -3
- data/lib/rubygems/old_format.rb +124 -120
- data/lib/rubygems/package/tar_header.rb +25 -3
- data/lib/rubygems/package/tar_input.rb +5 -5
- data/lib/rubygems/package/tar_output.rb +2 -0
- data/lib/rubygems/package/tar_reader.rb +19 -0
- data/lib/rubygems/package/tar_reader/entry.rb +43 -0
- data/lib/rubygems/package/tar_writer.rb +65 -3
- data/lib/rubygems/package_task.rb +117 -0
- data/lib/rubygems/platform.rb +12 -8
- data/lib/rubygems/remote_fetcher.rb +43 -24
- data/lib/rubygems/require_paths_builder.rb +14 -12
- data/lib/rubygems/requirement.rb +15 -6
- data/lib/rubygems/rubygems_version.rb +14 -1
- data/lib/rubygems/source_index.rb +38 -16
- data/lib/rubygems/source_info_cache_entry.rb +2 -2
- data/lib/rubygems/spec_fetcher.rb +43 -20
- data/lib/rubygems/specification.rb +1122 -947
- data/lib/rubygems/text.rb +30 -0
- data/lib/rubygems/timer.rb +14 -11
- data/lib/rubygems/uninstaller.rb +25 -5
- data/lib/rubygems/user_interaction.rb +294 -264
- data/lib/rubygems/validator.rb +70 -36
- data/lib/rubygems/version.rb +97 -33
- data/lib/rubygems/version_option.rb +1 -0
- data/setup.rb +11 -306
- data/test/foo/discover.rb +0 -0
- data/test/gem_installer_test_case.rb +22 -11
- data/test/gem_package_tar_test_case.rb +0 -14
- data/test/gemutilities.rb +89 -8
- data/test/mockgemui.rb +2 -1
- data/test/rubygems_plugin.rb +16 -0
- data/test/test_gem.rb +107 -36
- data/test/test_gem_command.rb +3 -13
- data/test/test_gem_command_manager.rb +1 -14
- data/test/test_gem_commands_cert_command.rb +1 -1
- data/test/test_gem_commands_contents_command.rb +63 -0
- data/test/test_gem_commands_environment_command.rb +1 -1
- data/test/test_gem_commands_generate_index_command.rb +104 -1
- data/test/test_gem_commands_install_command.rb +95 -0
- data/test/test_gem_commands_pristine_command.rb +3 -3
- data/test/test_gem_commands_query_command.rb +46 -0
- data/test/test_gem_commands_sources_command.rb +9 -5
- data/test/test_gem_commands_specification_command.rb +31 -0
- data/test/test_gem_commands_uninstall_command.rb +3 -2
- data/test/test_gem_commands_unpack_command.rb +3 -2
- data/test/test_gem_commands_update_command.rb +12 -7
- data/test/test_gem_dependency.rb +62 -11
- data/test/test_gem_dependency_installer.rb +18 -5
- data/test/test_gem_dependency_list.rb +6 -6
- data/test/test_gem_doc_manager.rb +7 -1
- data/test/test_gem_ext_configure_builder.rb +8 -10
- data/test/test_gem_ext_ext_conf_builder.rb +14 -8
- data/test/test_gem_gem_path_searcher.rb +1 -1
- data/test/test_gem_gem_runner.rb +11 -0
- data/test/test_gem_indexer.rb +398 -21
- data/test/test_gem_install_update_options.rb +20 -6
- data/test/test_gem_installer.rb +22 -14
- data/test/test_gem_local_remote_options.rb +2 -1
- data/test/test_gem_package_tar_header.rb +3 -3
- data/test/test_gem_package_tar_input.rb +3 -3
- data/test/test_gem_package_tar_output.rb +2 -2
- data/test/test_gem_package_task.rb +70 -0
- data/test/test_gem_platform.rb +12 -6
- data/test/test_gem_remote_fetcher.rb +23 -1
- data/test/test_gem_source_index.rb +32 -21
- data/test/test_gem_spec_fetcher.rb +77 -5
- data/test/test_gem_specification.rb +274 -1
- data/test/test_gem_uninstaller.rb +34 -4
- data/test/test_gem_version.rb +94 -4
- data/test/test_gem_version_option.rb +13 -0
- data/test/test_kernel.rb +4 -4
- data/util/CL2notes +56 -0
- data/util/gem_prelude.rb.template +251 -0
- metadata +30 -20
- metadata.gz.sig +3 -4
- data/TODO +0 -1
- data/scripts/buildtests.rb +0 -31
- data/scripts/gemdoc.rb +0 -67
- data/scripts/runtest.rb +0 -40
- data/scripts/specdoc.rb +0 -171
- data/scripts/upload_gemdoc.rb +0 -140
data/test/test_gem_gem_runner.rb
CHANGED
@@ -30,5 +30,16 @@ class TestGemGemRunner < RubyGemTestCase
|
|
30
30
|
assert_equal %w[--all], Gem::DocManager.configured_args
|
31
31
|
end
|
32
32
|
|
33
|
+
def test_build_args__are_handled
|
34
|
+
Gem.clear_paths
|
35
|
+
|
36
|
+
gr = Gem::GemRunner.new
|
37
|
+
assert_raises(Gem::SystemExitException) do
|
38
|
+
gr.run(%W[--help -- --build_arg1 --build_arg2])
|
39
|
+
end
|
40
|
+
|
41
|
+
assert_equal %w[--build_arg1 --build_arg2], Gem::Command.build_args
|
42
|
+
end
|
43
|
+
|
33
44
|
end
|
34
45
|
|
data/test/test_gem_indexer.rb
CHANGED
@@ -19,21 +19,45 @@ class TestGemIndexer < RubyGemTestCase
|
|
19
19
|
|
20
20
|
util_make_gems
|
21
21
|
|
22
|
-
@d2_0 = quick_gem 'd', '2.0'
|
22
|
+
@d2_0 = quick_gem 'd', '2.0' do |s|
|
23
|
+
s.date = Gem::Specification::TODAY - 86400 * 3
|
24
|
+
end
|
23
25
|
util_build_gem @d2_0
|
24
26
|
|
27
|
+
@d2_0_a = quick_gem 'd', '2.0.a'
|
28
|
+
util_build_gem @d2_0_a
|
29
|
+
|
30
|
+
@d2_0_b = quick_gem 'd', '2.0.b'
|
31
|
+
util_build_gem @d2_0_b
|
32
|
+
|
25
33
|
gems = File.join(@tempdir, 'gems')
|
26
34
|
FileUtils.mkdir_p gems
|
27
35
|
cache_gems = File.join @gemhome, 'cache', '*.gem'
|
28
36
|
FileUtils.mv Dir[cache_gems], gems
|
29
37
|
|
30
|
-
@indexer = Gem::Indexer.new @tempdir
|
38
|
+
@indexer = Gem::Indexer.new @tempdir, :rss_title => 'ExampleForge gems',
|
39
|
+
:rss_host => 'example.com',
|
40
|
+
:rss_gems_host => 'gems.example.com'
|
31
41
|
end
|
32
42
|
|
33
43
|
def test_initialize
|
34
44
|
assert_equal @tempdir, @indexer.dest_directory
|
35
45
|
assert_equal File.join(Dir.tmpdir, "gem_generate_index_#{$$}"),
|
36
46
|
@indexer.directory
|
47
|
+
|
48
|
+
indexer = Gem::Indexer.new @tempdir
|
49
|
+
assert indexer.build_legacy
|
50
|
+
assert indexer.build_modern
|
51
|
+
|
52
|
+
indexer = Gem::Indexer.new @tempdir, :build_legacy => false,
|
53
|
+
:build_modern => true
|
54
|
+
refute indexer.build_legacy
|
55
|
+
assert indexer.build_modern
|
56
|
+
|
57
|
+
indexer = Gem::Indexer.new @tempdir, :build_legacy => true,
|
58
|
+
:build_modern => false
|
59
|
+
assert indexer.build_legacy
|
60
|
+
refute indexer.build_modern
|
37
61
|
end
|
38
62
|
|
39
63
|
def test_build_indicies
|
@@ -137,6 +161,296 @@ pl-1-i386-linux
|
|
137
161
|
|
138
162
|
assert_indexed @tempdir, "latest_specs.#{@marshal_version}"
|
139
163
|
assert_indexed @tempdir, "latest_specs.#{@marshal_version}.gz"
|
164
|
+
|
165
|
+
expected = <<-EOF
|
166
|
+
<?xml version="1.0"?>
|
167
|
+
<rss version="2.0">
|
168
|
+
<channel>
|
169
|
+
<title>ExampleForge gems</title>
|
170
|
+
<link>http://example.com</link>
|
171
|
+
<description>Recently released gems from http://example.com</description>
|
172
|
+
<generator>RubyGems v#{Gem::RubyGemsVersion}</generator>
|
173
|
+
<docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
|
174
|
+
<item>
|
175
|
+
<title>a-2</title>
|
176
|
+
<description>
|
177
|
+
<pre>This is a test description</pre>
|
178
|
+
</description>
|
179
|
+
<author>example@example.com (A User)</author>
|
180
|
+
<guid>a-2</guid>
|
181
|
+
<enclosure url="http://gems.example.com/gems/a-2.gem"
|
182
|
+
length="3072" type="application/octet-stream" />
|
183
|
+
<pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate>
|
184
|
+
<link>http://example.com</link>
|
185
|
+
</item>
|
186
|
+
<item>
|
187
|
+
<title>a_evil-9</title>
|
188
|
+
<description>
|
189
|
+
<pre>This is a test description</pre>
|
190
|
+
</description>
|
191
|
+
<author>example@example.com (A User)</author>
|
192
|
+
<guid>a_evil-9</guid>
|
193
|
+
<enclosure url="http://gems.example.com/gems/a_evil-9.gem"
|
194
|
+
length="3072" type="application/octet-stream" />
|
195
|
+
<pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate>
|
196
|
+
<link>http://example.com</link>
|
197
|
+
</item>
|
198
|
+
<item>
|
199
|
+
<title>b-2</title>
|
200
|
+
<description>
|
201
|
+
<pre>This is a test description</pre>
|
202
|
+
</description>
|
203
|
+
<author>example@example.com (A User)</author>
|
204
|
+
<guid>b-2</guid>
|
205
|
+
<enclosure url="http://gems.example.com/gems/b-2.gem"
|
206
|
+
length="3072" type="application/octet-stream" />
|
207
|
+
<pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate>
|
208
|
+
<link>http://example.com</link>
|
209
|
+
</item>
|
210
|
+
<item>
|
211
|
+
<title>c-1.2</title>
|
212
|
+
<description>
|
213
|
+
<pre>This is a test description</pre>
|
214
|
+
</description>
|
215
|
+
<author>example@example.com (A User)</author>
|
216
|
+
<guid>c-1.2</guid>
|
217
|
+
<enclosure url="http://gems.example.com/gems/c-1.2.gem"
|
218
|
+
length="3072" type="application/octet-stream" />
|
219
|
+
<pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate>
|
220
|
+
<link>http://example.com</link>
|
221
|
+
</item>
|
222
|
+
<item>
|
223
|
+
<title>pl-1-x86-linux</title>
|
224
|
+
<description>
|
225
|
+
<pre>This is a test description</pre>
|
226
|
+
</description>
|
227
|
+
<author>example@example.com (A User)</author>
|
228
|
+
<guid>pl-1-x86-linux</guid>
|
229
|
+
<enclosure url="http://gems.example.com/gems/pl-1-x86-linux.gem"
|
230
|
+
length="3072" type="application/octet-stream" />
|
231
|
+
<pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate>
|
232
|
+
<link>http://example.com</link>
|
233
|
+
</item>
|
234
|
+
<item>
|
235
|
+
<title>a-1</title>
|
236
|
+
<description>
|
237
|
+
<pre>This line is really, really long. So long, in fact, that it is more than
|
238
|
+
eighty characters long! The purpose of this line is for testing wrapping
|
239
|
+
behavior because sometimes people don't wrap their text to eighty characters.
|
240
|
+
Without the wrapping, the text might not look good in the RSS feed.
|
241
|
+
|
242
|
+
Also, a list:
|
243
|
+
* An entry that's actually kind of sort
|
244
|
+
* an entry that's really long, which will probably get wrapped funny.
|
245
|
+
That's ok, somebody wasn't thinking straight when they made it more than
|
246
|
+
eighty characters.</pre>
|
247
|
+
</description>
|
248
|
+
<author>example@example.com (Example), example2@example.com (Example2)</author>
|
249
|
+
<guid>a-1</guid>
|
250
|
+
<enclosure url="http://gems.example.com/gems/a-1.gem"
|
251
|
+
length="3584" type="application/octet-stream" />
|
252
|
+
<pubDate>#{(Gem::Specification::TODAY - 86400).rfc2822}</pubDate>
|
253
|
+
<link>http://a.example.com</link>
|
254
|
+
</item>
|
255
|
+
</channel>
|
256
|
+
</rss>
|
257
|
+
EOF
|
258
|
+
|
259
|
+
gems_rss = File.read File.join(@tempdir, 'index.rss')
|
260
|
+
|
261
|
+
assert_equal expected, gems_rss
|
262
|
+
end
|
263
|
+
|
264
|
+
def test_generate_index_legacy
|
265
|
+
@indexer.build_modern = false
|
266
|
+
@indexer.build_legacy = true
|
267
|
+
|
268
|
+
use_ui @ui do
|
269
|
+
@indexer.generate_index
|
270
|
+
end
|
271
|
+
|
272
|
+
assert_indexed @tempdir, 'yaml'
|
273
|
+
assert_indexed @tempdir, 'yaml.Z'
|
274
|
+
assert_indexed @tempdir, "Marshal.#{@marshal_version}"
|
275
|
+
assert_indexed @tempdir, "Marshal.#{@marshal_version}.Z"
|
276
|
+
|
277
|
+
quickdir = File.join @tempdir, 'quick'
|
278
|
+
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
279
|
+
|
280
|
+
assert File.directory?(quickdir)
|
281
|
+
assert File.directory?(marshal_quickdir)
|
282
|
+
|
283
|
+
assert_indexed quickdir, "index"
|
284
|
+
assert_indexed quickdir, "index.rz"
|
285
|
+
|
286
|
+
assert_indexed quickdir, "latest_index"
|
287
|
+
assert_indexed quickdir, "latest_index.rz"
|
288
|
+
|
289
|
+
assert_indexed quickdir, "#{@a1.full_name}.gemspec.rz"
|
290
|
+
assert_indexed quickdir, "#{@a2.full_name}.gemspec.rz"
|
291
|
+
assert_indexed quickdir, "#{@b2.full_name}.gemspec.rz"
|
292
|
+
assert_indexed quickdir, "#{@c1_2.full_name}.gemspec.rz"
|
293
|
+
|
294
|
+
assert_indexed quickdir, "#{@pl1.original_name}.gemspec.rz"
|
295
|
+
refute_indexed quickdir, "#{@pl1.full_name}.gemspec.rz"
|
296
|
+
|
297
|
+
assert_indexed marshal_quickdir, "#{@a1.full_name}.gemspec.rz"
|
298
|
+
assert_indexed marshal_quickdir, "#{@a2.full_name}.gemspec.rz"
|
299
|
+
|
300
|
+
refute_indexed quickdir, "#{@c1_2.full_name}.gemspec"
|
301
|
+
refute_indexed marshal_quickdir, "#{@c1_2.full_name}.gemspec"
|
302
|
+
|
303
|
+
refute_indexed @tempdir, "specs.#{@marshal_version}"
|
304
|
+
refute_indexed @tempdir, "specs.#{@marshal_version}.gz"
|
305
|
+
|
306
|
+
refute_indexed @tempdir, "latest_specs.#{@marshal_version}"
|
307
|
+
refute_indexed @tempdir, "latest_specs.#{@marshal_version}.gz"
|
308
|
+
end
|
309
|
+
|
310
|
+
def test_generate_index_legacy_back_to_back
|
311
|
+
@indexer.build_modern = true
|
312
|
+
@indexer.build_legacy = true
|
313
|
+
|
314
|
+
use_ui @ui do
|
315
|
+
@indexer.generate_index
|
316
|
+
end
|
317
|
+
|
318
|
+
@indexer = Gem::Indexer.new @tempdir
|
319
|
+
@indexer.build_modern = false
|
320
|
+
@indexer.build_legacy = true
|
321
|
+
|
322
|
+
use_ui @ui do
|
323
|
+
@indexer.generate_index
|
324
|
+
end
|
325
|
+
|
326
|
+
assert_indexed @tempdir, 'yaml'
|
327
|
+
assert_indexed @tempdir, 'yaml.Z'
|
328
|
+
assert_indexed @tempdir, "Marshal.#{@marshal_version}"
|
329
|
+
assert_indexed @tempdir, "Marshal.#{@marshal_version}.Z"
|
330
|
+
|
331
|
+
quickdir = File.join @tempdir, 'quick'
|
332
|
+
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
333
|
+
|
334
|
+
assert File.directory?(quickdir)
|
335
|
+
assert File.directory?(marshal_quickdir)
|
336
|
+
|
337
|
+
assert_indexed quickdir, "index"
|
338
|
+
assert_indexed quickdir, "index.rz"
|
339
|
+
|
340
|
+
assert_indexed quickdir, "latest_index"
|
341
|
+
assert_indexed quickdir, "latest_index.rz"
|
342
|
+
|
343
|
+
assert_indexed quickdir, "#{@a1.full_name}.gemspec.rz"
|
344
|
+
assert_indexed quickdir, "#{@a2.full_name}.gemspec.rz"
|
345
|
+
assert_indexed quickdir, "#{@b2.full_name}.gemspec.rz"
|
346
|
+
assert_indexed quickdir, "#{@c1_2.full_name}.gemspec.rz"
|
347
|
+
|
348
|
+
assert_indexed quickdir, "#{@pl1.original_name}.gemspec.rz"
|
349
|
+
|
350
|
+
assert_indexed marshal_quickdir, "#{@a1.full_name}.gemspec.rz"
|
351
|
+
assert_indexed marshal_quickdir, "#{@a2.full_name}.gemspec.rz"
|
352
|
+
|
353
|
+
assert_indexed @tempdir, "specs.#{@marshal_version}"
|
354
|
+
assert_indexed @tempdir, "specs.#{@marshal_version}.gz"
|
355
|
+
|
356
|
+
assert_indexed @tempdir, "latest_specs.#{@marshal_version}"
|
357
|
+
assert_indexed @tempdir, "latest_specs.#{@marshal_version}.gz"
|
358
|
+
end
|
359
|
+
|
360
|
+
def test_generate_index_modern
|
361
|
+
@indexer.build_modern = true
|
362
|
+
@indexer.build_legacy = false
|
363
|
+
|
364
|
+
use_ui @ui do
|
365
|
+
@indexer.generate_index
|
366
|
+
end
|
367
|
+
|
368
|
+
refute_indexed @tempdir, 'yaml'
|
369
|
+
refute_indexed @tempdir, 'yaml.Z'
|
370
|
+
refute_indexed @tempdir, "Marshal.#{@marshal_version}"
|
371
|
+
refute_indexed @tempdir, "Marshal.#{@marshal_version}.Z"
|
372
|
+
|
373
|
+
quickdir = File.join @tempdir, 'quick'
|
374
|
+
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
375
|
+
|
376
|
+
assert File.directory?(quickdir), 'quickdir should be directory'
|
377
|
+
assert File.directory?(marshal_quickdir)
|
378
|
+
|
379
|
+
refute_indexed quickdir, "index"
|
380
|
+
refute_indexed quickdir, "index.rz"
|
381
|
+
|
382
|
+
refute_indexed quickdir, "latest_index"
|
383
|
+
refute_indexed quickdir, "latest_index.rz"
|
384
|
+
|
385
|
+
refute_indexed quickdir, "#{@a1.full_name}.gemspec.rz"
|
386
|
+
refute_indexed quickdir, "#{@a2.full_name}.gemspec.rz"
|
387
|
+
refute_indexed quickdir, "#{@b2.full_name}.gemspec.rz"
|
388
|
+
refute_indexed quickdir, "#{@c1_2.full_name}.gemspec.rz"
|
389
|
+
|
390
|
+
refute_indexed quickdir, "#{@pl1.original_name}.gemspec.rz"
|
391
|
+
refute_indexed quickdir, "#{@pl1.full_name}.gemspec.rz"
|
392
|
+
|
393
|
+
assert_indexed marshal_quickdir, "#{@a1.full_name}.gemspec.rz"
|
394
|
+
assert_indexed marshal_quickdir, "#{@a2.full_name}.gemspec.rz"
|
395
|
+
|
396
|
+
refute_indexed quickdir, "#{@c1_2.full_name}.gemspec"
|
397
|
+
refute_indexed marshal_quickdir, "#{@c1_2.full_name}.gemspec"
|
398
|
+
|
399
|
+
assert_indexed @tempdir, "specs.#{@marshal_version}"
|
400
|
+
assert_indexed @tempdir, "specs.#{@marshal_version}.gz"
|
401
|
+
|
402
|
+
assert_indexed @tempdir, "latest_specs.#{@marshal_version}"
|
403
|
+
assert_indexed @tempdir, "latest_specs.#{@marshal_version}.gz"
|
404
|
+
end
|
405
|
+
|
406
|
+
def test_generate_index_modern_back_to_back
|
407
|
+
@indexer.build_modern = true
|
408
|
+
@indexer.build_legacy = true
|
409
|
+
|
410
|
+
use_ui @ui do
|
411
|
+
@indexer.generate_index
|
412
|
+
end
|
413
|
+
|
414
|
+
@indexer = Gem::Indexer.new @tempdir
|
415
|
+
@indexer.build_modern = true
|
416
|
+
@indexer.build_legacy = false
|
417
|
+
|
418
|
+
use_ui @ui do
|
419
|
+
@indexer.generate_index
|
420
|
+
end
|
421
|
+
|
422
|
+
assert_indexed @tempdir, 'yaml'
|
423
|
+
assert_indexed @tempdir, 'yaml.Z'
|
424
|
+
assert_indexed @tempdir, "Marshal.#{@marshal_version}"
|
425
|
+
assert_indexed @tempdir, "Marshal.#{@marshal_version}.Z"
|
426
|
+
|
427
|
+
quickdir = File.join @tempdir, 'quick'
|
428
|
+
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
429
|
+
|
430
|
+
assert File.directory?(quickdir)
|
431
|
+
assert File.directory?(marshal_quickdir)
|
432
|
+
|
433
|
+
assert_indexed quickdir, "index"
|
434
|
+
assert_indexed quickdir, "index.rz"
|
435
|
+
|
436
|
+
assert_indexed quickdir, "latest_index"
|
437
|
+
assert_indexed quickdir, "latest_index.rz"
|
438
|
+
|
439
|
+
assert_indexed quickdir, "#{@a1.full_name}.gemspec.rz"
|
440
|
+
assert_indexed quickdir, "#{@a2.full_name}.gemspec.rz"
|
441
|
+
assert_indexed quickdir, "#{@b2.full_name}.gemspec.rz"
|
442
|
+
assert_indexed quickdir, "#{@c1_2.full_name}.gemspec.rz"
|
443
|
+
|
444
|
+
assert_indexed quickdir, "#{@pl1.original_name}.gemspec.rz"
|
445
|
+
|
446
|
+
assert_indexed marshal_quickdir, "#{@a1.full_name}.gemspec.rz"
|
447
|
+
assert_indexed marshal_quickdir, "#{@a2.full_name}.gemspec.rz"
|
448
|
+
|
449
|
+
assert_indexed @tempdir, "specs.#{@marshal_version}"
|
450
|
+
assert_indexed @tempdir, "specs.#{@marshal_version}.gz"
|
451
|
+
|
452
|
+
assert_indexed @tempdir, "latest_specs.#{@marshal_version}"
|
453
|
+
assert_indexed @tempdir, "latest_specs.#{@marshal_version}.gz"
|
140
454
|
end
|
141
455
|
|
142
456
|
def test_generate_index_ui
|
@@ -144,25 +458,24 @@ pl-1-i386-linux
|
|
144
458
|
@indexer.generate_index
|
145
459
|
end
|
146
460
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
Generating
|
156
|
-
Generating
|
157
|
-
Generating
|
158
|
-
Generating
|
159
|
-
Generating
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
461
|
+
assert_match %r%^Loading 9 gems from #{Regexp.escape @tempdir}$%, @ui.output
|
462
|
+
assert_match %r%^\.\.\.\.\.\.\.\.\.$%, @ui.output
|
463
|
+
assert_match %r%^Loaded all gems$%, @ui.output
|
464
|
+
assert_match %r%^Generating Marshal quick index gemspecs for 7 gems$%,
|
465
|
+
@ui.output
|
466
|
+
assert_match %r%^Generating YAML quick index gemspecs for 7 gems$%,
|
467
|
+
@ui.output
|
468
|
+
assert_match %r%^Complete$%, @ui.output
|
469
|
+
assert_match %r%^Generating specs index$%, @ui.output
|
470
|
+
assert_match %r%^Generating latest specs index$%, @ui.output
|
471
|
+
assert_match %r%^Generating quick index$%, @ui.output
|
472
|
+
assert_match %r%^Generating latest index$%, @ui.output
|
473
|
+
assert_match %r%^Generating prerelease specs index$%, @ui.output
|
474
|
+
assert_match %r%^Generating Marshal master index$%, @ui.output
|
475
|
+
assert_match %r%^Generating YAML master index for 7 gems \(this may take a while\)$%, @ui.output
|
476
|
+
assert_match %r%^Complete$%, @ui.output
|
477
|
+
assert_match %r%^Compressing indicies$%, @ui.output
|
164
478
|
|
165
|
-
assert_equal expected, @ui.output
|
166
479
|
assert_equal '', @ui.error
|
167
480
|
end
|
168
481
|
|
@@ -248,6 +561,70 @@ Compressing indicies
|
|
248
561
|
'identical platforms not identical'
|
249
562
|
end
|
250
563
|
|
564
|
+
def test_generate_index_prerelease_specs
|
565
|
+
use_ui @ui do
|
566
|
+
@indexer.generate_index
|
567
|
+
end
|
568
|
+
|
569
|
+
prerelease_specs_path = File.join @tempdir, "prerelease_specs.#{@marshal_version}"
|
570
|
+
|
571
|
+
prerelease_specs_dump = Gem.read_binary prerelease_specs_path
|
572
|
+
prerelease_specs = Marshal.load prerelease_specs_dump
|
573
|
+
|
574
|
+
assert_equal [['d', Gem::Version.new('2.0.a'), 'ruby'],
|
575
|
+
['d', Gem::Version.new('2.0.b'), 'ruby']],
|
576
|
+
prerelease_specs
|
577
|
+
end
|
578
|
+
|
579
|
+
def test_update_index
|
580
|
+
use_ui @ui do
|
581
|
+
@indexer.generate_index
|
582
|
+
end
|
583
|
+
|
584
|
+
quickdir = File.join @tempdir, 'quick'
|
585
|
+
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
586
|
+
|
587
|
+
assert File.directory?(quickdir)
|
588
|
+
assert File.directory?(marshal_quickdir)
|
589
|
+
|
590
|
+
@d2_1 = quick_gem 'd', '2.1'
|
591
|
+
util_build_gem @d2_1
|
592
|
+
@d2_1_tuple = [@d2_1.name, @d2_1.version, @d2_1.original_platform]
|
593
|
+
|
594
|
+
@d2_1_a = quick_gem 'd', '2.2.a'
|
595
|
+
util_build_gem @d2_1_a
|
596
|
+
@d2_1_a_tuple = [@d2_1_a.name, @d2_1_a.version, @d2_1_a.original_platform]
|
597
|
+
|
598
|
+
gems = File.join @tempdir, 'gems'
|
599
|
+
FileUtils.mv File.join(@gemhome, 'cache', "#{@d2_1.full_name}.gem"), gems
|
600
|
+
FileUtils.mv File.join(@gemhome, 'cache', "#{@d2_1_a.full_name}.gem"), gems
|
601
|
+
|
602
|
+
use_ui @ui do
|
603
|
+
@indexer.update_index
|
604
|
+
end
|
605
|
+
|
606
|
+
assert_indexed marshal_quickdir, "#{@d2_1.full_name}.gemspec.rz"
|
607
|
+
|
608
|
+
specs_index = Marshal.load Gem.read_binary(@indexer.dest_specs_index)
|
609
|
+
|
610
|
+
assert_includes specs_index, @d2_1_tuple
|
611
|
+
refute_includes specs_index, @d2_1_a_tuple
|
612
|
+
|
613
|
+
latest_specs_index = Marshal.load \
|
614
|
+
Gem.read_binary(@indexer.dest_latest_specs_index)
|
615
|
+
|
616
|
+
assert_includes latest_specs_index, @d2_1_tuple
|
617
|
+
assert_includes latest_specs_index,
|
618
|
+
[@d2_0.name, @d2_0.version, @d2_0.original_platform]
|
619
|
+
refute_includes latest_specs_index, @d2_1_a_tuple
|
620
|
+
|
621
|
+
pre_specs_index = Marshal.load \
|
622
|
+
Gem.read_binary(@indexer.dest_prerelease_specs_index)
|
623
|
+
|
624
|
+
assert_includes pre_specs_index, @d2_1_a_tuple
|
625
|
+
refute_includes pre_specs_index, @d2_1_tuple
|
626
|
+
end
|
627
|
+
|
251
628
|
def assert_indexed(dir, name)
|
252
629
|
file = File.join dir, name
|
253
630
|
assert File.exist?(file), "#{file} does not exist"
|
@@ -255,7 +632,7 @@ Compressing indicies
|
|
255
632
|
|
256
633
|
def refute_indexed(dir, name)
|
257
634
|
file = File.join dir, name
|
258
|
-
|
635
|
+
refute File.exist?(file), "#{file} exists"
|
259
636
|
end
|
260
637
|
|
261
638
|
end if ''.respond_to? :to_xs
|