rubygems-update 1.7.2 → 1.8.0

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.

Files changed (104) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +5 -1
  3. data/History.txt +101 -4
  4. data/LICENSE.txt +42 -37
  5. data/MIT.txt +20 -0
  6. data/Manifest.txt +5 -4
  7. data/Rakefile +6 -7
  8. data/lib/rubygems.rb +175 -278
  9. data/lib/rubygems/builder.rb +7 -6
  10. data/lib/rubygems/command_manager.rb +16 -2
  11. data/lib/rubygems/commands/build_command.rb +13 -11
  12. data/lib/rubygems/commands/cert_command.rb +1 -1
  13. data/lib/rubygems/commands/cleanup_command.rb +10 -19
  14. data/lib/rubygems/commands/contents_command.rb +5 -5
  15. data/lib/rubygems/commands/dependency_command.rb +17 -40
  16. data/lib/rubygems/commands/fetch_command.rb +1 -1
  17. data/lib/rubygems/commands/install_command.rb +2 -1
  18. data/lib/rubygems/commands/lock_command.rb +4 -4
  19. data/lib/rubygems/commands/outdated_command.rb +18 -6
  20. data/lib/rubygems/commands/pristine_command.rb +25 -15
  21. data/lib/rubygems/commands/query_command.rb +9 -6
  22. data/lib/rubygems/commands/setup_command.rb +1 -1
  23. data/lib/rubygems/commands/specification_command.rb +8 -23
  24. data/lib/rubygems/commands/stale_command.rb +2 -1
  25. data/lib/rubygems/commands/unpack_command.rb +7 -5
  26. data/lib/rubygems/commands/update_command.rb +2 -4
  27. data/lib/rubygems/commands/which_command.rb +5 -9
  28. data/lib/rubygems/config_file.rb +9 -7
  29. data/lib/rubygems/custom_require.rb +6 -4
  30. data/lib/rubygems/defaults.rb +30 -14
  31. data/lib/rubygems/dependency.rb +44 -1
  32. data/lib/rubygems/dependency_installer.rb +37 -41
  33. data/lib/rubygems/dependency_list.rb +20 -9
  34. data/lib/rubygems/deprecate.rb +3 -3
  35. data/lib/rubygems/doc_manager.rb +10 -11
  36. data/lib/rubygems/ext/rake_builder.rb +1 -1
  37. data/lib/rubygems/gem_path_searcher.rb +19 -4
  38. data/lib/rubygems/gem_runner.rb +1 -1
  39. data/lib/rubygems/indexer.rb +117 -123
  40. data/lib/rubygems/installer.rb +101 -94
  41. data/lib/rubygems/installer_test_case.rb +28 -30
  42. data/lib/rubygems/local_remote_options.rb +1 -1
  43. data/lib/rubygems/mock_gem_ui.rb +10 -3
  44. data/lib/rubygems/package.rb +0 -26
  45. data/lib/rubygems/package/tar_input.rb +5 -6
  46. data/lib/rubygems/package_task.rb +1 -1
  47. data/lib/rubygems/path_support.rb +72 -0
  48. data/lib/rubygems/platform.rb +12 -2
  49. data/lib/rubygems/remote_fetcher.rb +7 -6
  50. data/lib/rubygems/requirement.rb +3 -0
  51. data/lib/rubygems/security.rb +1 -1
  52. data/lib/rubygems/server.rb +67 -67
  53. data/lib/rubygems/source_index.rb +58 -29
  54. data/lib/rubygems/spec_fetcher.rb +5 -1
  55. data/lib/rubygems/specification.rb +1422 -877
  56. data/lib/rubygems/test_case.rb +114 -64
  57. data/lib/rubygems/test_utilities.rb +4 -3
  58. data/lib/rubygems/text.rb +1 -1
  59. data/lib/rubygems/uninstaller.rb +37 -44
  60. data/test/rubygems/test_gem.rb +131 -102
  61. data/test/rubygems/test_gem_builder.rb +18 -1
  62. data/test/rubygems/test_gem_command_manager.rb +2 -0
  63. data/test/rubygems/test_gem_commands_build_command.rb +31 -3
  64. data/test/rubygems/test_gem_commands_cleanup_command.rb +51 -0
  65. data/test/rubygems/test_gem_commands_dependency_command.rb +1 -10
  66. data/test/rubygems/test_gem_commands_fetch_command.rb +5 -4
  67. data/test/rubygems/test_gem_commands_help_command.rb +58 -0
  68. data/test/rubygems/test_gem_commands_install_command.rb +25 -24
  69. data/test/rubygems/test_gem_commands_list_command.rb +1 -4
  70. data/test/rubygems/test_gem_commands_outdated_command.rb +10 -9
  71. data/test/rubygems/test_gem_commands_pristine_command.rb +63 -22
  72. data/test/rubygems/test_gem_commands_push_command.rb +1 -1
  73. data/test/rubygems/test_gem_commands_query_command.rb +15 -82
  74. data/test/rubygems/test_gem_commands_sources_command.rb +8 -9
  75. data/test/rubygems/test_gem_commands_specification_command.rb +10 -6
  76. data/test/rubygems/test_gem_commands_stale_command.rb +4 -4
  77. data/test/rubygems/test_gem_commands_unpack_command.rb +20 -21
  78. data/test/rubygems/test_gem_commands_update_command.rb +19 -23
  79. data/test/rubygems/test_gem_commands_which_command.rb +7 -4
  80. data/test/rubygems/test_gem_dependency.rb +14 -8
  81. data/test/rubygems/test_gem_dependency_installer.rb +87 -33
  82. data/test/rubygems/test_gem_dependency_list.rb +7 -3
  83. data/test/rubygems/test_gem_doc_manager.rb +3 -3
  84. data/test/rubygems/test_gem_format.rb +1 -1
  85. data/test/rubygems/test_gem_gem_path_searcher.rb +45 -29
  86. data/test/rubygems/test_gem_indexer.rb +48 -47
  87. data/test/rubygems/test_gem_install_update_options.rb +6 -5
  88. data/test/rubygems/test_gem_installer.rb +61 -37
  89. data/test/rubygems/test_gem_path_support.rb +58 -0
  90. data/test/rubygems/test_gem_platform.rb +5 -5
  91. data/test/rubygems/test_gem_remote_fetcher.rb +18 -21
  92. data/test/rubygems/test_gem_server.rb +23 -15
  93. data/test/rubygems/test_gem_source_index.rb +165 -127
  94. data/test/rubygems/test_gem_spec_fetcher.rb +42 -49
  95. data/test/rubygems/test_gem_specification.rb +104 -74
  96. data/test/rubygems/test_gem_text.rb +15 -0
  97. data/test/rubygems/test_gem_uninstaller.rb +15 -26
  98. data/test/rubygems/test_kernel.rb +1 -2
  99. metadata +64 -14
  100. metadata.gz.sig +0 -0
  101. data/GPL.txt +0 -340
  102. data/pkgs/sources/lib/sources.rb +0 -3
  103. data/pkgs/sources/sources.gemspec +0 -14
  104. data/test/rubygems/functional.rb +0 -92
@@ -10,43 +10,43 @@ class TestGemSpecFetcher < Gem::TestCase
10
10
 
11
11
  util_setup_fake_fetcher
12
12
 
13
- @a_pre = quick_spec 'a', '1.a'
14
- @source_index.add_spec @pl1
15
- @source_index.add_spec @a_pre
13
+ @a_pre = new_spec 'a', '1.a'
16
14
 
17
- @specs = @source_index.gems.sort.map do |name, spec|
18
- [spec.name, spec.version, spec.original_platform]
19
- end.sort
15
+ install_specs @a_pre
20
16
 
21
- @latest_specs = @source_index.latest_specs.sort.map do |spec|
22
- [spec.name, spec.version, spec.original_platform]
23
- end
17
+ Gem::Specification.remove_spec @b2
24
18
 
25
- @prerelease_specs = @source_index.prerelease_gems.sort.map do |name, spec|
19
+ @specs = Gem::Specification.map { |spec|
26
20
  [spec.name, spec.version, spec.original_platform]
27
- end.sort
21
+ }.sort
28
22
 
29
- @fetcher.data["#{@gem_repo}specs.#{Gem.marshal_version}.gz"] =
30
- util_gzip(Marshal.dump(@specs))
23
+ # TODO: couldn't all of this come from the fake spec fetcher?
24
+ @latest_specs = Gem::Specification.latest_specs.sort.map { |spec|
25
+ [spec.name, spec.version, spec.original_platform]
26
+ }
31
27
 
32
- @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] =
33
- util_gzip(Marshal.dump(@latest_specs))
28
+ prerelease = Gem::Specification.find_all { |s| s.version.prerelease? }
29
+ @prerelease_specs = prerelease.map { |spec|
30
+ [spec.name, spec.version, spec.original_platform]
31
+ }.sort
34
32
 
35
- @fetcher.data["#{@gem_repo}prerelease_specs.#{Gem.marshal_version}.gz"] =
36
- util_gzip(Marshal.dump(@prerelease_specs))
33
+ v = Gem.marshal_version
34
+ s_zip = util_gzip(Marshal.dump(@specs))
35
+ l_zip = util_gzip(Marshal.dump(@latest_specs))
36
+ p_zip = util_gzip(Marshal.dump(@prerelease_specs))
37
+ @fetcher.data["#{@gem_repo}specs.#{v}.gz"] = s_zip
38
+ @fetcher.data["#{@gem_repo}latest_specs.#{v}.gz"] = l_zip
39
+ @fetcher.data["#{@gem_repo}prerelease_specs.#{v}.gz"] = p_zip
37
40
 
38
41
  @sf = Gem::SpecFetcher.new
39
42
  end
40
43
 
41
44
  def test_fetch_all
42
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}.rz"] =
43
- util_zip(Marshal.dump(@a1))
44
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a2.spec_name}.rz"] =
45
- util_zip(Marshal.dump(@a2))
46
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.spec_name}.rz"] =
47
- util_zip(Marshal.dump(@a_pre))
48
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a3a.spec_name}.rz"] =
49
- util_zip(Marshal.dump(@a3a))
45
+ d = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}"
46
+ @fetcher.data["#{d}#{@a1.spec_name}.rz"] = util_zip(Marshal.dump(@a1))
47
+ @fetcher.data["#{d}#{@a2.spec_name}.rz"] = util_zip(Marshal.dump(@a2))
48
+ @fetcher.data["#{d}#{@a_pre.spec_name}.rz"] = util_zip(Marshal.dump(@a_pre))
49
+ @fetcher.data["#{d}#{@a3a.spec_name}.rz"] = util_zip(Marshal.dump(@a3a))
50
50
 
51
51
  dep = Gem::Dependency.new 'a', 1
52
52
 
@@ -64,12 +64,10 @@ class TestGemSpecFetcher < Gem::TestCase
64
64
  end
65
65
 
66
66
  def test_fetch_latest
67
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}.rz"] =
68
- util_zip(Marshal.dump(@a1))
69
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a2.spec_name}.rz"] =
70
- util_zip(Marshal.dump(@a2))
71
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.spec_name}.rz"] =
72
- util_zip(Marshal.dump(@a_pre))
67
+ d = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}"
68
+ @fetcher.data["#{d}#{@a1.spec_name}.rz"] = util_zip(Marshal.dump(@a1))
69
+ @fetcher.data["#{d}#{@a2.spec_name}.rz"] = util_zip(Marshal.dump(@a2))
70
+ @fetcher.data["#{d}#{@a_pre.spec_name}.rz"] = util_zip(Marshal.dump(@a_pre))
73
71
 
74
72
  dep = Gem::Dependency.new 'a', 1
75
73
  specs_and_sources = @sf.fetch dep
@@ -82,15 +80,12 @@ class TestGemSpecFetcher < Gem::TestCase
82
80
  end
83
81
 
84
82
  def test_fetch_prerelease
85
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}.rz"] =
86
- util_zip(Marshal.dump(@a1))
87
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a2.spec_name}.rz"] =
88
- util_zip(Marshal.dump(@a2))
89
- @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.spec_name}.rz"] =
90
- util_zip(Marshal.dump(@a_pre))
83
+ d = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}"
84
+ @fetcher.data["#{d}#{@a1.spec_name}.rz"] = util_zip(Marshal.dump(@a1))
85
+ @fetcher.data["#{d}#{@a2.spec_name}.rz"] = util_zip(Marshal.dump(@a2))
86
+ @fetcher.data["#{d}#{@a_pre.spec_name}.rz"] = util_zip(Marshal.dump(@a_pre))
91
87
 
92
- dep = Gem::Dependency.new 'a', '1.a'
93
- specs_and_sources = @sf.fetch dep, false, true, true
88
+ specs_and_sources = @sf.fetch dep('a', '1.a'), false, true, true
94
89
 
95
90
  spec_names = specs_and_sources.map do |spec, source_uri|
96
91
  [spec.full_name, source_uri]
@@ -287,11 +282,11 @@ class TestGemSpecFetcher < Gem::TestCase
287
282
 
288
283
  assert_equal [@uri], specs.keys
289
284
 
290
- assert_equal([["a", Gem::Version.new("1"), "ruby"],
291
- ["a", Gem::Version.new("2"), "ruby"],
292
- ["a_evil", Gem::Version.new("9"), "ruby"],
293
- ["c", Gem::Version.new("1.2"), "ruby"],
294
- ["pl", Gem::Version.new("1"), "i386-linux"]],
285
+ assert_equal([["a", Gem::Version.new("1"), "ruby"],
286
+ ["a", Gem::Version.new("2"), "ruby"],
287
+ ["a_evil", Gem::Version.new("9"), "ruby"],
288
+ ["c", Gem::Version.new("1.2"), "ruby"],
289
+ ["pl", Gem::Version.new("1"), "i386-linux"]],
295
290
  specs[@uri].sort)
296
291
  end
297
292
 
@@ -341,19 +336,17 @@ class TestGemSpecFetcher < Gem::TestCase
341
336
  end
342
337
 
343
338
  def test_load_specs
344
- specs = @sf.load_specs @uri, 'specs'
345
-
346
339
  expected = [
347
- ['a', Gem::Version.new('1.a'), Gem::Platform::RUBY],
340
+ ['a', Gem::Version.new('1.a'), Gem::Platform::RUBY],
348
341
  ['a', Gem::Version.new(1), Gem::Platform::RUBY],
349
342
  ['a', Gem::Version.new(2), Gem::Platform::RUBY],
350
- ['a', Gem::Version.new('3.a'), Gem::Platform::RUBY],
343
+ ['a', Gem::Version.new('3.a'), Gem::Platform::RUBY],
351
344
  ['a_evil', Gem::Version.new(9), Gem::Platform::RUBY],
352
345
  ['c', Gem::Version.new('1.2'), Gem::Platform::RUBY],
353
346
  ['pl', Gem::Version.new(1), 'i386-linux'],
354
347
  ]
355
348
 
356
- assert_equal expected, specs
349
+ assert_equal expected, @sf.load_specs(@uri, 'specs')
357
350
 
358
351
  cache_dir = File.join Gem.user_home, '.gem', 'specs', 'gems.example.com%80'
359
352
  assert File.exist?(cache_dir), "#{cache_dir} does not exist"
@@ -29,8 +29,8 @@ Gem::Specification.new do |s|
29
29
  s.version = %q{0.4.0}
30
30
  s.has_rdoc = true
31
31
  s.summary = %q{A Hash which automatically computes keys.}
32
- s.files = ["lib/keyedlist.rb"]
33
- s.require_paths = ["lib"]
32
+ s.files = [%q{lib/keyedlist.rb}]
33
+ s.require_paths = [%q{lib}]
34
34
  s.autorequire = %q{keyedlist}
35
35
  s.author = %q{Florian Gross}
36
36
  s.email = %q{flgr@ccan.de}
@@ -115,9 +115,8 @@ end
115
115
  end
116
116
 
117
117
  def test_self_load
118
- full_path = File.join @gemhome, 'specifications', @a2.spec_name
119
- path = File.join "specifications", @a2.spec_name
120
- write_file path do |io|
118
+ full_path = @a2.spec_file
119
+ write_file full_path do |io|
121
120
  io.write @a2.to_ruby_for_cache
122
121
  end
123
122
 
@@ -392,51 +391,20 @@ end
392
391
  end
393
392
 
394
393
  def test_eql_eh
395
- g1 = quick_spec 'gem'
396
- g2 = quick_spec 'gem'
394
+ g1 = new_spec 'gem', 1
395
+ g2 = new_spec 'gem', 1
397
396
 
398
397
  assert_equal g1, g2
399
398
  assert_equal g1.hash, g2.hash
400
399
  assert_equal true, g1.eql?(g2)
401
400
  end
402
401
 
403
- def test_equals2
404
- assert_equal @a1, @a1
405
- assert_equal @a1, @a1.dup
406
- refute_equal @a1, @a2
407
- refute_equal @a1, Object.new
408
- end
409
-
410
- # The cgikit specification was reported to be causing trouble in at least
411
- # one version of RubyGems, so we test explicitly for it.
412
- def test_equals2_cgikit
413
- cgikit = Gem::Specification.new do |s|
414
- s.name = %q{cgikit}
415
- s.version = "1.1.0"
416
- s.date = %q{2004-03-13}
417
- s.summary = %q{CGIKit is a componented-oriented web application } +
418
- %q{framework like Apple Computers WebObjects. } +
419
- %{This framework services Model-View-Controller architecture } +
420
- %q{programming by components based on a HTML file, a definition } +
421
- %q{file and a Ruby source. }
422
- s.email = %q{info@spice-of-life.net}
423
- s.homepage = %q{http://www.spice-of-life.net/download/cgikit/}
424
- s.autorequire = %q{cgikit}
425
- s.bindir = nil
426
- s.required_ruby_version = nil
427
- s.platform = nil
428
- s.files = ["lib/cgikit", "lib/cgikit.rb", "lib/cgikit/components", "..."]
429
- end
430
-
431
- assert_equal cgikit, cgikit
432
- end
433
-
434
- def test_equals2_extensions
402
+ def test_eql_eh_extensions
435
403
  spec = @a1.dup
436
404
  spec.extensions = 'xx'
437
405
 
438
- refute_equal @a1, spec
439
- refute_equal spec, @a1
406
+ refute_operator @a1, :eql?, spec
407
+ refute_operator spec, :eql?, @a1
440
408
  end
441
409
 
442
410
  def test_executables
@@ -562,11 +530,11 @@ end
562
530
  end
563
531
 
564
532
  def test_full_gem_path_double_slash
565
- gemhome = @gemhome.sub(/\w\//, '\&/')
566
- @a1.loaded_from = File.join gemhome, 'specifications', @a1.spec_name
533
+ gemhome = @gemhome.to_s.sub(/\w\//, '\&/')
534
+ @a1.loaded_from = File.join gemhome, "specifications", @a1.spec_name
567
535
 
568
- assert_equal File.join(@gemhome, 'gems', @a1.full_name),
569
- @a1.full_gem_path
536
+ expected = File.join @gemhome, "gems", @a1.full_name
537
+ assert_equal expected, @a1.full_gem_path
570
538
  end
571
539
 
572
540
  def test_full_name
@@ -605,15 +573,14 @@ end
605
573
  end
606
574
 
607
575
  def test_installation_path
608
- assert_equal @gemhome, @a1.installation_path
576
+ Deprecate.skip_during do
577
+ assert_equal @gemhome, @a1.installation_path
609
578
 
610
- @a1.instance_variable_set :@loaded_from, nil
579
+ @a1.instance_variable_set :@loaded_from, nil
580
+ @a1.instance_variable_set :@loaded, false
611
581
 
612
- e = assert_raises Gem::Exception do
613
- @a1.installation_path
582
+ assert_nil @a1.installation_path
614
583
  end
615
-
616
- assert_equal 'spec a-1 is not from an installed gem', e.message
617
584
  end
618
585
 
619
586
  def test_lib_files
@@ -711,8 +678,8 @@ end
711
678
  end
712
679
 
713
680
  def test_spaceship_name
714
- s1 = quick_spec 'a', '1'
715
- s2 = quick_spec 'b', '1'
681
+ s1 = new_spec 'a', '1'
682
+ s2 = new_spec 'b', '1'
716
683
 
717
684
  assert_equal(-1, (s1 <=> s2))
718
685
  assert_equal( 0, (s1 <=> s1))
@@ -720,8 +687,8 @@ end
720
687
  end
721
688
 
722
689
  def test_spaceship_platform
723
- s1 = quick_spec 'a', '1'
724
- s2 = quick_spec 'a', '1' do |s|
690
+ s1 = new_spec 'a', '1'
691
+ s2 = new_spec 'a', '1' do |s|
725
692
  s.platform = Gem::Platform.new 'x86-my_platform1'
726
693
  end
727
694
 
@@ -731,8 +698,8 @@ end
731
698
  end
732
699
 
733
700
  def test_spaceship_version
734
- s1 = quick_spec 'a', '1'
735
- s2 = quick_spec 'a', '2'
701
+ s1 = new_spec 'a', '1'
702
+ s2 = new_spec 'a', '2'
736
703
 
737
704
  assert_equal( -1, (s1 <=> s2))
738
705
  assert_equal( 0, (s1 <=> s1))
@@ -767,13 +734,13 @@ Gem::Specification.new do |s|
767
734
  s.version = \"2\"
768
735
 
769
736
  s.required_rubygems_version = Gem::Requirement.new(\"> 0\") if s.respond_to? :required_rubygems_version=
770
- s.authors = [\"A User\"]
737
+ s.authors = [%q{A User}]
771
738
  s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}}
772
739
  s.description = %q{This is a test description}
773
740
  s.email = %q{example@example.com}
774
- s.files = [\"lib/code.rb\"]
741
+ s.files = [%q{lib/code.rb}]
775
742
  s.homepage = %q{http://example.com}
776
- s.require_paths = [\"lib\"]
743
+ s.require_paths = [%q{lib}]
777
744
  s.rubygems_version = %q{#{Gem::VERSION}}
778
745
  s.summary = %q{this is a summary}
779
746
 
@@ -814,12 +781,12 @@ Gem::Specification.new do |s|
814
781
  s.version = \"2\"
815
782
 
816
783
  s.required_rubygems_version = Gem::Requirement.new(\"> 0\") if s.respond_to? :required_rubygems_version=
817
- s.authors = [\"A User\"]
784
+ s.authors = [%q{A User}]
818
785
  s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}}
819
786
  s.description = %q{This is a test description}
820
787
  s.email = %q{example@example.com}
821
788
  s.homepage = %q{http://example.com}
822
- s.require_paths = [\"lib\"]
789
+ s.require_paths = [%q{lib}]
823
790
  s.rubygems_version = %q{#{Gem::VERSION}}
824
791
  s.summary = %q{this is a summary}
825
792
 
@@ -862,21 +829,21 @@ Gem::Specification.new do |s|
862
829
  s.platform = Gem::Platform.new(#{expected_platform})
863
830
 
864
831
  s.required_rubygems_version = Gem::Requirement.new(\">= 0\") if s.respond_to? :required_rubygems_version=
865
- s.authors = [\"A User\"]
832
+ s.authors = [%q{A User}]
866
833
  s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}}
867
834
  s.description = %q{This is a test description}
868
835
  s.email = %q{example@example.com}
869
- s.executables = [\"exec\"]
870
- s.extensions = [\"ext/a/extconf.rb\"]
871
- s.files = [\"lib/code.rb\", \"test/suite.rb\", \"bin/exec\", \"ext/a/extconf.rb\"]
836
+ s.executables = [%q{exec}]
837
+ s.extensions = [%q{ext/a/extconf.rb}]
838
+ s.files = [%q{lib/code.rb}, %q{test/suite.rb}, %q{bin/exec}, %q{ext/a/extconf.rb}]
872
839
  s.homepage = %q{http://example.com}
873
- s.licenses = [\"MIT\"]
874
- s.require_paths = [\"lib\"]
875
- s.requirements = [\"A working computer\"]
840
+ s.licenses = [%q{MIT}]
841
+ s.require_paths = [%q{lib}]
842
+ s.requirements = [%q{A working computer}]
876
843
  s.rubyforge_project = %q{example}
877
844
  s.rubygems_version = %q{#{Gem::VERSION}}
878
845
  s.summary = %q{this is a summary}
879
- s.test_files = [\"test/suite.rb\"]
846
+ s.test_files = [%q{test/suite.rb}]
880
847
 
881
848
  if s.respond_to? :specification_version then
882
849
  s.specification_version = 3
@@ -931,7 +898,7 @@ end
931
898
 
932
899
  refute_match '!!null', yaml_str
933
900
 
934
- same_spec = YAML.load(yaml_str)
901
+ same_spec = Gem::Specification.from_yaml(yaml_str)
935
902
 
936
903
  assert_equal @a1, same_spec
937
904
  end
@@ -940,7 +907,7 @@ end
940
907
  @a1.platform = Gem::Platform.local
941
908
  yaml_str = @a1.to_yaml
942
909
 
943
- same_spec = YAML.load(yaml_str)
910
+ same_spec = Gem::Specification.from_yaml(yaml_str)
944
911
 
945
912
  assert_equal Gem::Platform.local, same_spec.platform
946
913
 
@@ -988,7 +955,7 @@ end
988
955
  util_setup_validate
989
956
 
990
957
  Dir.chdir @tempdir do
991
- @a1.authors = []
958
+ @a1.authors = [""]
992
959
 
993
960
  use_ui @ui do
994
961
  @a1.validate
@@ -998,11 +965,13 @@ end
998
965
 
999
966
  @a1.authors = [Object.new]
1000
967
 
968
+ assert_equal [], @a1.authors
969
+
1001
970
  e = assert_raises Gem::InvalidSpecificationException do
1002
971
  @a1.validate
1003
972
  end
1004
973
 
1005
- assert_equal "authors must be an Array of String instances", e.message
974
+ assert_equal "authors may not be empty", e.message
1006
975
 
1007
976
  @a1.authors = ["#{f} (who is writing this software)"]
1008
977
 
@@ -1328,6 +1297,67 @@ end
1328
1297
  specfile.delete
1329
1298
  end
1330
1299
 
1300
+ ##
1301
+ # KEEP p-1-x86-darwin-8
1302
+ # KEEP p-1
1303
+ # KEEP c-1.2
1304
+ # KEEP a_evil-9
1305
+ # a-1
1306
+ # a-1-x86-my_platform-1
1307
+ # KEEP a-2
1308
+ # a-2-x86-other_platform-1
1309
+ # KEEP a-2-x86-my_platform-1
1310
+ # a-3.a
1311
+ # KEEP a-3-x86-other_platform-1
1312
+
1313
+ def test_latest_specs
1314
+ util_clear_gems
1315
+ util_setup_fake_fetcher
1316
+
1317
+ quick_spec 'p', '1'
1318
+
1319
+ p1_curr = quick_spec 'p', '1' do |spec|
1320
+ spec.platform = Gem::Platform::CURRENT
1321
+ end
1322
+
1323
+ quick_spec @a1.name, @a1.version do |s|
1324
+ s.platform = Gem::Platform.new 'x86-my_platform1'
1325
+ end
1326
+
1327
+ quick_spec @a1.name, @a1.version do |s|
1328
+ s.platform = Gem::Platform.new 'x86-third_platform1'
1329
+ end
1330
+
1331
+ quick_spec @a2.name, @a2.version do |s|
1332
+ s.platform = Gem::Platform.new 'x86-my_platform1'
1333
+ end
1334
+
1335
+ quick_spec @a2.name, @a2.version do |s|
1336
+ s.platform = Gem::Platform.new 'x86-other_platform1'
1337
+ end
1338
+
1339
+ quick_spec @a2.name, @a2.version.bump do |s|
1340
+ s.platform = Gem::Platform.new 'x86-other_platform1'
1341
+ end
1342
+
1343
+ Gem::Specification.remove_spec @b2
1344
+ Gem::Specification.remove_spec @pl1
1345
+
1346
+ expected = %W[
1347
+ a-2
1348
+ a-2-x86-my_platform-1
1349
+ a-3-x86-other_platform-1
1350
+ a_evil-9
1351
+ c-1.2
1352
+ p-1
1353
+ #{p1_curr.full_name}
1354
+ ]
1355
+
1356
+ latest_specs = Gem::Specification.latest_specs.map(&:full_name).sort
1357
+
1358
+ assert_equal expected, latest_specs
1359
+ end
1360
+
1331
1361
  def util_setup_deps
1332
1362
  @gem = quick_spec "awesome", "1.0" do |awesome|
1333
1363
  awesome.add_runtime_dependency "bonobo", []