rubygems-update 1.3.3 → 1.3.4
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/ChangeLog +238 -184
- data/lib/rubygems.rb +11 -5
- data/lib/rubygems/command.rb +4 -1
- data/lib/rubygems/commands/install_command.rb +40 -0
- data/lib/rubygems/commands/query_command.rb +16 -1
- data/lib/rubygems/commands/setup_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +1 -1
- data/lib/rubygems/config_file.rb +0 -1
- data/lib/rubygems/defaults.rb +2 -1
- data/lib/rubygems/dependency.rb +0 -2
- data/lib/rubygems/dependency_list.rb +36 -16
- data/lib/rubygems/exceptions.rb +0 -2
- data/lib/rubygems/ext/builder.rb +0 -2
- data/lib/rubygems/gem_openssl.rb +0 -1
- data/lib/rubygems/gem_path_searcher.rb +0 -2
- data/lib/rubygems/indexer.rb +1 -0
- data/lib/rubygems/package/f_sync_dir.rb +0 -2
- data/lib/rubygems/package/tar_header.rb +0 -2
- data/lib/rubygems/package/tar_input.rb +0 -2
- data/lib/rubygems/package/tar_output.rb +0 -2
- data/lib/rubygems/package/tar_reader.rb +2 -2
- data/lib/rubygems/package/tar_reader/entry.rb +0 -2
- data/lib/rubygems/package/tar_writer.rb +0 -2
- data/lib/rubygems/platform.rb +0 -2
- data/lib/rubygems/remote_fetcher.rb +5 -1
- data/lib/rubygems/requirement.rb +2 -4
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/source_index.rb +19 -9
- data/lib/rubygems/spec_fetcher.rb +0 -1
- data/lib/rubygems/specification.rb +0 -1
- data/lib/rubygems/uninstaller.rb +4 -4
- data/lib/rubygems/version.rb +0 -2
- data/test/gemutilities.rb +13 -4
- data/test/test_gem.rb +54 -5
- data/test/test_gem_commands_install_command.rb +2 -0
- data/test/test_gem_commands_query_command.rb +68 -8
- data/test/test_gem_commands_unpack_command.rb +4 -4
- data/test/test_gem_dependency_installer.rb +3 -1
- data/test/test_gem_format.rb +1 -1
- data/test/test_gem_indexer.rb +5 -3
- data/test/test_gem_source_index.rb +14 -445
- data/test/test_gem_source_info_cache.rb +1 -1
- data/test/test_gem_specification.rb +2 -1
- metadata +4 -4
- metadata.gz.sig +0 -0
@@ -358,13 +358,15 @@ class TestGemDependencyInstaller < RubyGemTestCase
|
|
358
358
|
FileUtils.mv @b1_gem, @tempdir
|
359
359
|
inst = nil
|
360
360
|
|
361
|
-
Gem.source_index.
|
361
|
+
Gem.source_index.remove_spec @a1.full_name
|
362
|
+
Gem.source_index.remove_spec @a1_pre.full_name
|
362
363
|
|
363
364
|
Dir.chdir @tempdir do
|
364
365
|
e = assert_raises Gem::InstallError do
|
365
366
|
inst = Gem::DependencyInstaller.new :domain => :local
|
366
367
|
inst.install 'b'
|
367
368
|
end
|
369
|
+
|
368
370
|
assert_equal 'b requires a (>= 0, runtime)', e.message
|
369
371
|
end
|
370
372
|
|
data/test/test_gem_format.rb
CHANGED
@@ -21,7 +21,7 @@ class TestGemFormat < RubyGemTestCase
|
|
21
21
|
|
22
22
|
gems = Dir[File.join(@gemhome, 'cache', '*.gem')]
|
23
23
|
|
24
|
-
names = [@a1, @a2, @a_evil9, @b2, @c1_2, @pl1].map do |spec|
|
24
|
+
names = [@a1, @a2, @a3a, @a_evil9, @b2, @c1_2, @pl1].map do |spec|
|
25
25
|
spec.original_name
|
26
26
|
end
|
27
27
|
|
data/test/test_gem_indexer.rb
CHANGED
@@ -458,8 +458,9 @@ eighty characters.</pre>
|
|
458
458
|
@indexer.generate_index
|
459
459
|
end
|
460
460
|
|
461
|
-
assert_match %r%^Loading
|
462
|
-
|
461
|
+
assert_match %r%^Loading 10 gems from #{Regexp.escape @tempdir}$%,
|
462
|
+
@ui.output
|
463
|
+
assert_match %r%^\.\.\.\.\.\.\.\.\.\.$%, @ui.output
|
463
464
|
assert_match %r%^Loaded all gems$%, @ui.output
|
464
465
|
assert_match %r%^Generating Marshal quick index gemspecs for 7 gems$%,
|
465
466
|
@ui.output
|
@@ -571,7 +572,8 @@ eighty characters.</pre>
|
|
571
572
|
prerelease_specs_dump = Gem.read_binary prerelease_specs_path
|
572
573
|
prerelease_specs = Marshal.load prerelease_specs_dump
|
573
574
|
|
574
|
-
assert_equal [['
|
575
|
+
assert_equal [['a', Gem::Version.new('3.a'), 'ruby'],
|
576
|
+
['d', Gem::Version.new('2.0.a'), 'ruby'],
|
575
577
|
['d', Gem::Version.new('2.0.b'), 'ruby']],
|
576
578
|
prerelease_specs
|
577
579
|
end
|
@@ -208,269 +208,6 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
208
208
|
assert_equal @fetcher, @source_index.fetcher
|
209
209
|
end
|
210
210
|
|
211
|
-
def test_fetch_bulk_index_compressed
|
212
|
-
util_setup_bulk_fetch true
|
213
|
-
|
214
|
-
use_ui @ui do
|
215
|
-
fetched_index = @source_index.fetch_bulk_index @uri
|
216
|
-
assert_equal [@a1.full_name, @a2.full_name, @a_evil9.full_name,
|
217
|
-
@c1_2.full_name].sort,
|
218
|
-
fetched_index.gems.map { |n,s| n }.sort
|
219
|
-
end
|
220
|
-
|
221
|
-
paths = @fetcher.paths
|
222
|
-
|
223
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
224
|
-
|
225
|
-
assert_empty paths, paths.join(', ')
|
226
|
-
end
|
227
|
-
|
228
|
-
def test_fetch_bulk_index_error
|
229
|
-
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}.Z"] = proc { raise SocketError }
|
230
|
-
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}"] = proc { raise SocketError }
|
231
|
-
@fetcher.data["#{@gem_repo}yaml.Z"] = proc { raise SocketError }
|
232
|
-
@fetcher.data["#{@gem_repo}yaml"] = proc { raise SocketError }
|
233
|
-
|
234
|
-
e = assert_raises Gem::RemoteSourceException do
|
235
|
-
use_ui @ui do
|
236
|
-
@source_index.fetch_bulk_index @uri
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
paths = @fetcher.paths
|
241
|
-
|
242
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
243
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}", paths.shift
|
244
|
-
assert_equal "#{@gem_repo}yaml.Z", paths.shift
|
245
|
-
assert_equal "#{@gem_repo}yaml", paths.shift
|
246
|
-
|
247
|
-
assert_empty paths, paths.join(', ')
|
248
|
-
|
249
|
-
assert_equal 'Error fetching remote gem cache: SocketError',
|
250
|
-
e.message
|
251
|
-
end
|
252
|
-
|
253
|
-
def test_fetch_bulk_index_fallback
|
254
|
-
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}.Z"] =
|
255
|
-
proc { raise SocketError }
|
256
|
-
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}"] =
|
257
|
-
proc { raise SocketError }
|
258
|
-
@fetcher.data["#{@gem_repo}yaml.Z"] = proc { raise SocketError }
|
259
|
-
@fetcher.data["#{@gem_repo}yaml"] = @source_index.to_yaml
|
260
|
-
|
261
|
-
use_ui @ui do
|
262
|
-
fetched_index = @source_index.fetch_bulk_index @uri
|
263
|
-
assert_equal [@a1.full_name, @a2.full_name, @a_evil9.full_name,
|
264
|
-
@c1_2.full_name].sort,
|
265
|
-
fetched_index.gems.map { |n,s| n }.sort
|
266
|
-
end
|
267
|
-
|
268
|
-
paths = @fetcher.paths
|
269
|
-
|
270
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
271
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}", paths.shift
|
272
|
-
assert_equal "#{@gem_repo}yaml.Z", paths.shift
|
273
|
-
assert_equal "#{@gem_repo}yaml", paths.shift
|
274
|
-
|
275
|
-
assert_empty paths, paths.join(', ')
|
276
|
-
end
|
277
|
-
|
278
|
-
def test_fetch_bulk_index_marshal_mismatch
|
279
|
-
marshal = @source_index.dump
|
280
|
-
marshal[0] = (Marshal::MAJOR_VERSION - 1).chr
|
281
|
-
|
282
|
-
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}"] = marshal
|
283
|
-
@fetcher.data["#{@gem_repo}yaml"] = @source_index.to_yaml
|
284
|
-
|
285
|
-
use_ui @ui do
|
286
|
-
fetched_index = @source_index.fetch_bulk_index @uri
|
287
|
-
assert_equal [@a1.full_name, @a2.full_name, @a_evil9.full_name,
|
288
|
-
@c1_2.full_name].sort,
|
289
|
-
fetched_index.gems.map { |n,s| n }.sort
|
290
|
-
end
|
291
|
-
|
292
|
-
paths = @fetcher.paths
|
293
|
-
|
294
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
295
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}", paths.shift
|
296
|
-
assert_equal "#{@gem_repo}yaml.Z", paths.shift
|
297
|
-
assert_equal "#{@gem_repo}yaml", paths.shift
|
298
|
-
|
299
|
-
assert_empty paths, paths.join(', ')
|
300
|
-
end
|
301
|
-
|
302
|
-
def test_fetch_bulk_index_uncompressed
|
303
|
-
util_setup_bulk_fetch false
|
304
|
-
use_ui @ui do
|
305
|
-
fetched_index = @source_index.fetch_bulk_index @uri
|
306
|
-
assert_equal [@a1.full_name, @a2.full_name, @a_evil9.full_name,
|
307
|
-
@c1_2.full_name].sort,
|
308
|
-
fetched_index.gems.map { |n,s| n }.sort
|
309
|
-
end
|
310
|
-
|
311
|
-
paths = @fetcher.paths
|
312
|
-
|
313
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
314
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}", paths.shift
|
315
|
-
|
316
|
-
assert_empty paths, paths.join(', ')
|
317
|
-
end
|
318
|
-
|
319
|
-
def test_fetch_quick_index
|
320
|
-
index = util_zip @gem_names
|
321
|
-
latest_index = util_zip [@a2.full_name, @b2.full_name].join("\n")
|
322
|
-
|
323
|
-
@fetcher.data["#{@gem_repo}quick/index.rz"] = index
|
324
|
-
@fetcher.data["#{@gem_repo}quick/latest_index.rz"] = latest_index
|
325
|
-
|
326
|
-
quick_index = @source_index.fetch_quick_index @uri, false
|
327
|
-
assert_equal [@a2.full_name, @b2.full_name].sort,
|
328
|
-
quick_index.sort
|
329
|
-
|
330
|
-
paths = @fetcher.paths
|
331
|
-
|
332
|
-
assert_equal "#{@gem_repo}quick/latest_index.rz", paths.shift
|
333
|
-
|
334
|
-
assert_empty paths, paths.join(', ')
|
335
|
-
end
|
336
|
-
|
337
|
-
def test_fetch_quick_index_all
|
338
|
-
index = util_zip @gem_names
|
339
|
-
latest_index = util_zip [@a2.full_name, @b2.full_name].join("\n")
|
340
|
-
|
341
|
-
@fetcher.data["#{@gem_repo}quick/index.rz"] = index
|
342
|
-
@fetcher.data["#{@gem_repo}quick/latest_index.rz"] = latest_index
|
343
|
-
|
344
|
-
quick_index = @source_index.fetch_quick_index @uri, true
|
345
|
-
assert_equal [@a1.full_name, @a2.full_name, @b2.full_name].sort,
|
346
|
-
quick_index.sort
|
347
|
-
|
348
|
-
paths = @fetcher.paths
|
349
|
-
|
350
|
-
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
351
|
-
|
352
|
-
assert_empty paths, paths.join(', ')
|
353
|
-
end
|
354
|
-
|
355
|
-
def test_fetch_quick_index_error
|
356
|
-
@fetcher.data["#{@gem_repo}quick/index.rz"] =
|
357
|
-
proc { raise Exception }
|
358
|
-
|
359
|
-
e = assert_raises Gem::OperationNotSupportedError do
|
360
|
-
@source_index.fetch_quick_index @uri, true
|
361
|
-
end
|
362
|
-
|
363
|
-
assert_equal 'No quick index found: Exception', e.message
|
364
|
-
|
365
|
-
paths = @fetcher.paths
|
366
|
-
|
367
|
-
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
368
|
-
|
369
|
-
assert_empty paths, paths.join(', ')
|
370
|
-
end
|
371
|
-
|
372
|
-
def test_fetch_quick_index_fallback
|
373
|
-
index = util_zip @gem_names
|
374
|
-
|
375
|
-
@fetcher.data["#{@gem_repo}quick/index.rz"] = index
|
376
|
-
|
377
|
-
quick_index = @source_index.fetch_quick_index @uri, false
|
378
|
-
assert_equal @gem_names.split, quick_index.sort
|
379
|
-
|
380
|
-
paths = @fetcher.paths
|
381
|
-
|
382
|
-
assert_equal "#{@gem_repo}quick/latest_index.rz", paths.shift
|
383
|
-
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
384
|
-
|
385
|
-
assert_empty paths, paths.join(', ')
|
386
|
-
end
|
387
|
-
|
388
|
-
def test_fetch_quick_index_subdir
|
389
|
-
latest_index = util_zip [@a2.full_name, @b2.full_name].join("\n")
|
390
|
-
repo = URI.parse "#{@gem_repo}~nobody/mirror/"
|
391
|
-
|
392
|
-
@fetcher.data["#{repo}quick/latest_index.rz"] = latest_index
|
393
|
-
|
394
|
-
quick_index = @source_index.fetch_quick_index repo, false
|
395
|
-
assert_equal [@a2.full_name, @b2.full_name].sort,
|
396
|
-
quick_index.sort
|
397
|
-
|
398
|
-
paths = @fetcher.paths
|
399
|
-
|
400
|
-
assert_equal "#{repo}quick/latest_index.rz", paths.shift
|
401
|
-
|
402
|
-
assert_empty paths, paths.join(', ')
|
403
|
-
end
|
404
|
-
|
405
|
-
def test_fetch_single_spec
|
406
|
-
a1_spec_url = "#{@gem_repo}quick/Marshal.#{Gem.marshal_version}/#{@a1.full_name}.gemspec.rz"
|
407
|
-
@fetcher.data[a1_spec_url] = util_zip Marshal.dump(@a1)
|
408
|
-
|
409
|
-
spec = @source_index.send :fetch_single_spec, URI.parse(@gem_repo),
|
410
|
-
@a1.full_name
|
411
|
-
|
412
|
-
assert_equal @a1.full_name, spec.full_name
|
413
|
-
|
414
|
-
paths = @fetcher.paths
|
415
|
-
|
416
|
-
assert_equal a1_spec_url, paths.shift
|
417
|
-
|
418
|
-
assert_empty paths, paths.join(', ')
|
419
|
-
end
|
420
|
-
|
421
|
-
def test_fetch_single_spec_subdir
|
422
|
-
repo = URI.parse "#{@gem_repo}~nobody/mirror/"
|
423
|
-
|
424
|
-
a1_spec_url = "#{repo}quick/Marshal.#{Gem.marshal_version}/#{@a1.full_name}.gemspec.rz"
|
425
|
-
@fetcher.data[a1_spec_url] = util_zip Marshal.dump(@a1)
|
426
|
-
|
427
|
-
spec = @source_index.send :fetch_single_spec, repo, @a1.full_name
|
428
|
-
|
429
|
-
assert_equal @a1.full_name, spec.full_name
|
430
|
-
|
431
|
-
paths = @fetcher.paths
|
432
|
-
|
433
|
-
assert_equal a1_spec_url, paths.shift
|
434
|
-
|
435
|
-
assert_empty paths, paths.join(', ')
|
436
|
-
end
|
437
|
-
|
438
|
-
def test_fetch_single_spec_yaml
|
439
|
-
a1_spec_url = "#{@gem_repo}quick/#{@a1.full_name}.gemspec.rz"
|
440
|
-
@fetcher.data[a1_spec_url] = util_zip @a1.to_yaml
|
441
|
-
|
442
|
-
repo = URI.parse @gem_repo
|
443
|
-
|
444
|
-
spec = @source_index.send :fetch_single_spec, repo, @a1.full_name
|
445
|
-
|
446
|
-
assert_equal @a1.full_name, spec.full_name
|
447
|
-
|
448
|
-
paths = @fetcher.paths
|
449
|
-
|
450
|
-
assert_equal "#{@gem_repo}quick/Marshal.#{Gem.marshal_version}/#{@a1.full_name}.gemspec.rz", paths.shift
|
451
|
-
assert_equal a1_spec_url, paths.shift
|
452
|
-
|
453
|
-
assert_empty paths, paths.join(', ')
|
454
|
-
end
|
455
|
-
|
456
|
-
def test_fetch_single_spec_yaml_subdir
|
457
|
-
repo = URI.parse "#{@gem_repo}~nobody/mirror/"
|
458
|
-
|
459
|
-
a1_spec_url = "#{repo}quick/#{@a1.full_name}.gemspec.rz"
|
460
|
-
@fetcher.data[a1_spec_url] = util_zip @a1.to_yaml
|
461
|
-
|
462
|
-
spec = @source_index.send :fetch_single_spec, repo, @a1.full_name
|
463
|
-
|
464
|
-
assert_equal @a1.full_name, spec.full_name
|
465
|
-
|
466
|
-
paths = @fetcher.paths
|
467
|
-
|
468
|
-
assert_equal "#{repo}quick/Marshal.#{Gem.marshal_version}/#{@a1.full_name}.gemspec.rz", paths.shift
|
469
|
-
assert_equal a1_spec_url, paths.shift
|
470
|
-
|
471
|
-
assert_empty paths, paths.join(', ')
|
472
|
-
end
|
473
|
-
|
474
211
|
def test_find_missing
|
475
212
|
missing = @source_index.find_missing [@b2.full_name]
|
476
213
|
assert_equal [@b2.full_name], missing
|
@@ -485,7 +222,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
485
222
|
end
|
486
223
|
|
487
224
|
def test_find_name
|
488
|
-
assert_equal [@a1, @a2], @source_index.find_name('a')
|
225
|
+
assert_equal [@a1, @a2, @a3a], @source_index.find_name('a')
|
489
226
|
assert_equal [@a2], @source_index.find_name('a', '= 2')
|
490
227
|
assert_equal [], @source_index.find_name('bogusstring')
|
491
228
|
assert_equal [], @source_index.find_name('a', '= 3')
|
@@ -651,13 +388,25 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
651
388
|
assert_equal gems, @source_index.gems.map { |n,s| n }.sort
|
652
389
|
end
|
653
390
|
|
391
|
+
def test_remove_spec
|
392
|
+
deleted = @source_index.remove_spec 'a-1'
|
393
|
+
|
394
|
+
assert_equal %w[a-2 a-3.a a_evil-9 c-1.2],
|
395
|
+
@source_index.all_gems.values.map { |s| s.full_name }.sort
|
396
|
+
|
397
|
+
deleted = @source_index.remove_spec 'a-3.a'
|
398
|
+
|
399
|
+
assert_equal %w[a-2 a_evil-9 c-1.2],
|
400
|
+
@source_index.all_gems.values.map { |s| s.full_name }.sort
|
401
|
+
end
|
402
|
+
|
654
403
|
def test_search
|
655
404
|
requirement = Gem::Requirement.create '= 9'
|
656
405
|
with_version = Gem::Dependency.new(/^a/, requirement)
|
657
406
|
assert_equal [@a_evil9], @source_index.search(with_version)
|
658
407
|
|
659
408
|
with_default = Gem::Dependency.new(/^a/, Gem::Requirement.default)
|
660
|
-
assert_equal [@a1, @a2, @a_evil9], @source_index.search(with_default)
|
409
|
+
assert_equal [@a1, @a2, @a3a, @a_evil9], @source_index.search(with_default)
|
661
410
|
end
|
662
411
|
|
663
412
|
def test_search_platform
|
@@ -703,186 +452,6 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
|
|
703
452
|
assert_equal 'some text', @source_index.unzip(input)
|
704
453
|
end
|
705
454
|
|
706
|
-
def test_update_bulk
|
707
|
-
util_setup_bulk_fetch true
|
708
|
-
|
709
|
-
@source_index.gems.replace({})
|
710
|
-
assert_equal [], @source_index.gems.keys.sort
|
711
|
-
|
712
|
-
use_ui @ui do
|
713
|
-
@source_index.update @uri, true
|
714
|
-
|
715
|
-
assert_equal [@a1.full_name, @a2.full_name, @a_evil9.full_name,
|
716
|
-
@c1_2.full_name],
|
717
|
-
@source_index.gems.keys.sort
|
718
|
-
end
|
719
|
-
|
720
|
-
paths = @fetcher.paths
|
721
|
-
|
722
|
-
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
723
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
724
|
-
|
725
|
-
assert_empty paths, paths.join(', ')
|
726
|
-
end
|
727
|
-
|
728
|
-
def test_update_incremental
|
729
|
-
old_gem_conf = Gem.configuration
|
730
|
-
Gem.configuration = Gem::ConfigFile.new([])
|
731
|
-
|
732
|
-
latest_names = [@a2, @a_evil9, @b2, @c1_2].map { |s| s.full_name }
|
733
|
-
latest_index = util_zip latest_names.join("\n")
|
734
|
-
@fetcher.data["#{@gem_repo}quick/latest_index.rz"] = latest_index
|
735
|
-
|
736
|
-
marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
|
737
|
-
"#{@b2.full_name}.gemspec.rz"
|
738
|
-
@fetcher.data[marshal_uri] = util_zip Marshal.dump(@b2)
|
739
|
-
|
740
|
-
use_ui @ui do
|
741
|
-
@source_index.update @uri, false
|
742
|
-
|
743
|
-
assert_equal latest_names, @source_index.gems.keys.sort
|
744
|
-
end
|
745
|
-
|
746
|
-
paths = @fetcher.paths
|
747
|
-
assert_equal "#{@gem_repo}quick/latest_index.rz", paths.shift
|
748
|
-
assert_equal marshal_uri, paths.shift
|
749
|
-
|
750
|
-
assert_empty paths, paths.join(', ')
|
751
|
-
ensure
|
752
|
-
Gem.configuration = old_gem_conf
|
753
|
-
end
|
754
|
-
|
755
|
-
def test_update_incremental_all
|
756
|
-
old_gem_conf = Gem.configuration
|
757
|
-
Gem.configuration = Gem::ConfigFile.new([])
|
758
|
-
|
759
|
-
quick_index = util_zip @all_gem_names.join("\n")
|
760
|
-
@fetcher.data["#{@gem_repo}quick/index.rz"] = quick_index
|
761
|
-
|
762
|
-
marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
|
763
|
-
"#{@b2.full_name}.gemspec.rz"
|
764
|
-
@fetcher.data[marshal_uri] = util_zip Marshal.dump(@b2)
|
765
|
-
|
766
|
-
use_ui @ui do
|
767
|
-
@source_index.update @uri, true
|
768
|
-
|
769
|
-
assert_equal @all_gem_names, @source_index.gems.keys.sort
|
770
|
-
end
|
771
|
-
|
772
|
-
paths = @fetcher.paths
|
773
|
-
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
774
|
-
assert_equal marshal_uri, paths.shift
|
775
|
-
|
776
|
-
assert_empty paths, paths.join(', ')
|
777
|
-
ensure
|
778
|
-
Gem.configuration = old_gem_conf
|
779
|
-
end
|
780
|
-
|
781
|
-
def test_update_incremental_fallback
|
782
|
-
old_gem_conf = Gem.configuration
|
783
|
-
Gem.configuration = Gem::ConfigFile.new([])
|
784
|
-
|
785
|
-
quick_index = util_zip @all_gem_names.join("\n")
|
786
|
-
@fetcher.data["#{@gem_repo}quick/index.rz"] = quick_index
|
787
|
-
|
788
|
-
marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
|
789
|
-
"#{@b2.full_name}.gemspec.rz"
|
790
|
-
|
791
|
-
yaml_uri = "#{@gem_repo}quick/#{@b2.full_name}.gemspec.rz"
|
792
|
-
@fetcher.data[yaml_uri] = util_zip @b2.to_yaml
|
793
|
-
|
794
|
-
use_ui @ui do
|
795
|
-
@source_index.update @uri, true
|
796
|
-
|
797
|
-
assert_equal @all_gem_names, @source_index.gems.keys.sort
|
798
|
-
end
|
799
|
-
|
800
|
-
paths = @fetcher.paths
|
801
|
-
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
802
|
-
assert_equal marshal_uri, paths.shift
|
803
|
-
assert_equal yaml_uri, paths.shift
|
804
|
-
|
805
|
-
assert_empty paths, paths.join(', ')
|
806
|
-
ensure
|
807
|
-
Gem.configuration = old_gem_conf
|
808
|
-
end
|
809
|
-
|
810
|
-
def test_update_incremental_marshal_mismatch
|
811
|
-
old_gem_conf = Gem.configuration
|
812
|
-
Gem.configuration = Gem::ConfigFile.new([])
|
813
|
-
|
814
|
-
quick_index = util_zip @all_gem_names.join("\n")
|
815
|
-
@fetcher.data["#{@gem_repo}quick/index.rz"] = quick_index
|
816
|
-
|
817
|
-
marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
|
818
|
-
"#{@b2.full_name}.gemspec.rz"
|
819
|
-
marshal_data = Marshal.dump(@b2)
|
820
|
-
marshal_data[0] = (Marshal::MAJOR_VERSION - 1).chr
|
821
|
-
@fetcher.data[marshal_uri] = util_zip marshal_data
|
822
|
-
|
823
|
-
yaml_uri = "#{@gem_repo}quick/#{@b2.full_name}.gemspec.rz"
|
824
|
-
@fetcher.data[yaml_uri] = util_zip @b2.to_yaml
|
825
|
-
|
826
|
-
use_ui @ui do
|
827
|
-
@source_index.update @uri, true
|
828
|
-
|
829
|
-
assert_equal @all_gem_names, @source_index.gems.keys.sort
|
830
|
-
end
|
831
|
-
|
832
|
-
paths = @fetcher.paths
|
833
|
-
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
834
|
-
assert_equal marshal_uri, paths.shift
|
835
|
-
assert_equal yaml_uri, paths.shift
|
836
|
-
|
837
|
-
assert_empty paths, paths.join(', ')
|
838
|
-
ensure
|
839
|
-
Gem.configuration = old_gem_conf
|
840
|
-
end
|
841
|
-
|
842
|
-
def test_update_subdir
|
843
|
-
@gem_repo = @gem_repo + 'subdir/'
|
844
|
-
|
845
|
-
util_setup_bulk_fetch true
|
846
|
-
|
847
|
-
@source_index.gems.replace({})
|
848
|
-
assert_equal [], @source_index.gems.keys.sort
|
849
|
-
|
850
|
-
uri = @uri.to_s + 'subdir/'
|
851
|
-
|
852
|
-
use_ui @ui do
|
853
|
-
@source_index.update uri, true
|
854
|
-
|
855
|
-
assert_equal [@a1.full_name, @a2.full_name, @a_evil9.full_name,
|
856
|
-
@c1_2.full_name],
|
857
|
-
@source_index.gems.keys.sort
|
858
|
-
end
|
859
|
-
|
860
|
-
paths = @fetcher.paths
|
861
|
-
|
862
|
-
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
863
|
-
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
864
|
-
|
865
|
-
assert_empty paths, paths.join(', ')
|
866
|
-
end
|
867
|
-
|
868
|
-
def test_update_with_missing
|
869
|
-
marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
|
870
|
-
"#{@c1_2.full_name}.gemspec.rz"
|
871
|
-
dumped = Marshal.dump @c1_2
|
872
|
-
@fetcher.data[marshal_uri] = util_zip(dumped)
|
873
|
-
|
874
|
-
use_ui @ui do
|
875
|
-
@source_index.update_with_missing @uri, [@c1_2.full_name]
|
876
|
-
end
|
877
|
-
|
878
|
-
spec = @source_index.specification(@c1_2.full_name)
|
879
|
-
# We don't care about the equality of undumped attributes
|
880
|
-
@c1_2.files = spec.files
|
881
|
-
@c1_2.loaded_from = spec.loaded_from
|
882
|
-
|
883
|
-
assert_equal @c1_2, spec
|
884
|
-
end
|
885
|
-
|
886
455
|
def util_setup_bulk_fetch(compressed)
|
887
456
|
source_index = @source_index.dump
|
888
457
|
|