rubygems-update 1.2.0 → 1.3.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 (65) hide show
  1. data.tar.gz.sig +2 -4
  2. data/ChangeLog +155 -0
  3. data/Rakefile +20 -5
  4. data/doc/release_notes/rel_1_3_0.rdoc +125 -0
  5. data/lib/rubygems.rb +107 -15
  6. data/lib/rubygems/commands/contents_command.rb +1 -1
  7. data/lib/rubygems/commands/environment_command.rb +40 -0
  8. data/lib/rubygems/commands/help_command.rb +2 -2
  9. data/lib/rubygems/commands/install_command.rb +15 -0
  10. data/lib/rubygems/commands/lock_command.rb +15 -6
  11. data/lib/rubygems/commands/outdated_command.rb +1 -1
  12. data/lib/rubygems/commands/pristine_command.rb +1 -1
  13. data/lib/rubygems/commands/query_command.rb +14 -9
  14. data/lib/rubygems/commands/rdoc_command.rb +5 -1
  15. data/lib/rubygems/commands/specification_command.rb +2 -2
  16. data/lib/rubygems/commands/unpack_command.rb +1 -1
  17. data/lib/rubygems/commands/update_command.rb +23 -14
  18. data/lib/rubygems/commands/which_command.rb +4 -3
  19. data/lib/rubygems/config_file.rb +25 -3
  20. data/lib/rubygems/defaults.rb +42 -11
  21. data/lib/rubygems/dependency_installer.rb +19 -15
  22. data/lib/rubygems/doc_manager.rb +162 -115
  23. data/lib/rubygems/ext/builder.rb +2 -2
  24. data/lib/rubygems/ext/rake_builder.rb +1 -1
  25. data/lib/rubygems/gem_path_searcher.rb +35 -19
  26. data/lib/rubygems/indexer.rb +15 -6
  27. data/lib/rubygems/install_update_options.rb +7 -0
  28. data/lib/rubygems/installer.rb +85 -9
  29. data/lib/rubygems/local_remote_options.rb +7 -0
  30. data/lib/rubygems/package/tar_reader.rb +7 -7
  31. data/lib/rubygems/platform.rb +1 -18
  32. data/lib/rubygems/remote_fetcher.rb +45 -54
  33. data/lib/rubygems/rubygems_version.rb +1 -1
  34. data/lib/rubygems/source_index.rb +22 -7
  35. data/lib/rubygems/source_info_cache.rb +9 -0
  36. data/lib/rubygems/spec_fetcher.rb +18 -20
  37. data/lib/rubygems/specification.rb +502 -293
  38. data/lib/rubygems/test_utilities.rb +19 -8
  39. data/lib/rubygems/uninstaller.rb +60 -26
  40. data/setup.rb +15 -7
  41. data/test/gemutilities.rb +84 -0
  42. data/test/mockgemui.rb +22 -2
  43. data/test/test_gem.rb +118 -13
  44. data/test/test_gem_commands_dependency_command.rb +1 -1
  45. data/test/test_gem_commands_list_command.rb +37 -0
  46. data/test/test_gem_commands_lock_command.rb +69 -0
  47. data/test/test_gem_commands_query_command.rb +40 -1
  48. data/test/test_gem_commands_uninstall_command.rb +60 -0
  49. data/test/test_gem_config_file.rb +51 -17
  50. data/test/test_gem_ext_configure_builder.rb +9 -9
  51. data/test/test_gem_ext_rake_builder.rb +21 -12
  52. data/test/test_gem_gem_path_searcher.rb +15 -7
  53. data/test/test_gem_indexer.rb +35 -1
  54. data/test/test_gem_install_update_options.rb +26 -5
  55. data/test/test_gem_installer.rb +93 -21
  56. data/test/test_gem_local_remote_options.rb +12 -0
  57. data/test/test_gem_platform.rb +6 -13
  58. data/test/test_gem_remote_fetcher.rb +121 -31
  59. data/test/test_gem_source_index.rb +74 -21
  60. data/test/test_gem_source_info_cache.rb +2 -1
  61. data/test/test_gem_spec_fetcher.rb +13 -3
  62. data/test/test_gem_specification.rb +13 -7
  63. data/test/test_gem_uninstaller.rb +25 -2
  64. metadata +6 -2
  65. metadata.gz.sig +0 -0
@@ -64,6 +64,54 @@ class TestGemSourceIndex < RubyGemTestCase
64
64
  assert_equal a1.author, spec.author
65
65
  end
66
66
 
67
+ def test_self_load_specification_utf_8
68
+ spec_dir = File.join @gemhome, 'specifications'
69
+
70
+ FileUtils.rm_r spec_dir
71
+
72
+ FileUtils.mkdir_p spec_dir
73
+
74
+ spec_file = File.join spec_dir, "utf-8.gemspec"
75
+ spec_data = <<-SPEC
76
+ Gem::Specification.new do |s|
77
+ s.name = %q{utf}
78
+ s.version = "8"
79
+
80
+ s.required_rubygems_version = Gem::Requirement.new(">= 0")
81
+ s.authors = ["\317\200"]
82
+ s.date = %q{2008-09-10}
83
+ s.description = %q{This is a test description}
84
+ s.email = %q{example@example.com}
85
+ s.has_rdoc = true
86
+ s.homepage = %q{http://example.com}
87
+ s.require_paths = ["lib"]
88
+ s.rubygems_version = %q{1.2.0}
89
+ s.summary = %q{this is a summary}
90
+
91
+ if s.respond_to? :specification_version then
92
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
93
+ s.specification_version = 2
94
+
95
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
96
+ else
97
+ end
98
+ else
99
+ end
100
+ end
101
+ SPEC
102
+
103
+ spec_data.force_encoding 'UTF-8'
104
+
105
+ File.open spec_file, 'w' do |io| io.write spec_data end
106
+
107
+ spec = Gem::SourceIndex.load_specification spec_file
108
+
109
+ pi = "\317\200"
110
+ pi.force_encoding 'UTF-8' if pi.respond_to? :force_encoding
111
+
112
+ assert_equal pi, spec.author
113
+ end if Gem.ruby_version > Gem::Version.new('1.9')
114
+
67
115
  def test_self_load_specification_exception
68
116
  spec_dir = File.join @gemhome, 'specifications'
69
117
 
@@ -437,6 +485,27 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
437
485
  assert_equal [], missing
438
486
  end
439
487
 
488
+ def test_find_name
489
+ assert_equal [@a1, @a2], @source_index.find_name('a')
490
+ assert_equal [@a2], @source_index.find_name('a', '= 2')
491
+ assert_equal [], @source_index.find_name('bogusstring')
492
+ assert_equal [], @source_index.find_name('a', '= 3')
493
+
494
+ source_index = Gem::SourceIndex.new
495
+ source_index.add_spec @a1
496
+ source_index.add_spec @a2
497
+
498
+ assert_equal [@a1], source_index.find_name(@a1.name, '= 1')
499
+
500
+ r1 = Gem::Requirement.create '= 1'
501
+ assert_equal [@a1], source_index.find_name(@a1.name, r1)
502
+ end
503
+
504
+ def test_find_name_empty_cache
505
+ empty_source_index = Gem::SourceIndex.new({})
506
+ assert_equal [], empty_source_index.find_name("foo")
507
+ end
508
+
440
509
  def test_latest_specs
441
510
  p1_ruby = quick_gem 'p', '1'
442
511
  p1_platform = quick_gem 'p', '1' do |spec|
@@ -573,28 +642,12 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
573
642
  end
574
643
 
575
644
  def test_search
576
- assert_equal [@a1, @a2, @a_evil9], @source_index.search('a')
577
- assert_equal [@a2], @source_index.search('a', '= 2')
578
-
579
- assert_equal [], @source_index.search('bogusstring')
580
- assert_equal [], @source_index.search('a', '= 3')
645
+ requirement = Gem::Requirement.create '= 9'
646
+ with_version = Gem::Dependency.new(/^a/, requirement)
647
+ assert_equal [@a_evil9], @source_index.search(with_version)
581
648
 
582
- source_index = Gem::SourceIndex.new
583
- source_index.add_spec @a1
584
- source_index.add_spec @a2
585
-
586
- assert_equal [@a1], source_index.search(@a1.name, '= 1')
587
-
588
- r1 = Gem::Requirement.create '= 1'
589
- assert_equal [@a1], source_index.search(@a1.name, r1)
590
-
591
- dep = Gem::Dependency.new @a1.name, r1
592
- assert_equal [@a1], source_index.search(dep)
593
- end
594
-
595
- def test_search_empty_cache
596
- empty_source_index = Gem::SourceIndex.new({})
597
- assert_equal [], empty_source_index.search("foo")
649
+ with_default = Gem::Dependency.new(/^a/, Gem::Requirement.default)
650
+ assert_equal [@a1, @a2, @a_evil9], @source_index.search(with_default)
598
651
  end
599
652
 
600
653
  def test_search_platform
@@ -224,7 +224,8 @@ class TestGemSourceInfoCache < RubyGemTestCase
224
224
 
225
225
  @sic.set_cache_data @gem_repo => sice
226
226
  latest = @sic.latest_cache_data
227
- gems = latest[@gem_repo].source_index.search('a').map { |s| s.full_name }
227
+ beginning_with_a = Gem::Dependency.new(/^a/, Gem::Requirement.default)
228
+ gems = latest[@gem_repo].source_index.search(beginning_with_a).map { |s| s.full_name }
228
229
 
229
230
  assert_equal %w[a-2 a_evil-9], gems
230
231
  end
@@ -67,7 +67,7 @@ class TestGemSpecFetcher < RubyGemTestCase
67
67
  end
68
68
 
69
69
  def test_fetch_legacy_repo
70
- @fetcher.data["#{@gem_repo}specs.#{Gem.marshal_version}.gz"] = nil
70
+ @fetcher.data.delete "#{@gem_repo}specs.#{Gem.marshal_version}.gz"
71
71
  @fetcher.data["#{@gem_repo}yaml"] = ''
72
72
  util_setup_source_info_cache @a1, @a2
73
73
 
@@ -259,6 +259,16 @@ RubyGems will revert to legacy indexes degrading performance.
259
259
  assert_equal specs, cached_specs
260
260
  end
261
261
 
262
+ def test_list_latest_all
263
+ specs = @sf.list false
264
+
265
+ assert_equal [@latest_specs], specs.values
266
+
267
+ specs = @sf.list true
268
+
269
+ assert_equal [@specs], specs.values, 'specs file not loaded'
270
+ end
271
+
262
272
  def test_load_specs
263
273
  specs = @sf.load_specs @uri, 'specs'
264
274
 
@@ -294,9 +304,9 @@ RubyGems will revert to legacy indexes degrading performance.
294
304
  Marshal.dump @latest_specs, io
295
305
  end
296
306
 
297
- specs = @sf.load_specs @uri, 'specs'
307
+ latest_specs = @sf.load_specs @uri, 'latest_specs'
298
308
 
299
- assert_equal @specs, specs
309
+ assert_equal @latest_specs, latest_specs
300
310
  end
301
311
 
302
312
  end
@@ -500,7 +500,7 @@ end
500
500
  end
501
501
 
502
502
  def test_has_rdoc_eh
503
- assert_equal true, @a1.has_rdoc?
503
+ assert @a1.has_rdoc?
504
504
  end
505
505
 
506
506
  def test_hash
@@ -634,7 +634,10 @@ end
634
634
 
635
635
  ruby_code = @a2.to_ruby
636
636
 
637
- expected = "Gem::Specification.new do |s|
637
+ expected = <<-SPEC
638
+ # -*- encoding: utf-8 -*-
639
+
640
+ Gem::Specification.new do |s|
638
641
  s.name = %q{a}
639
642
  s.version = \"2\"
640
643
 
@@ -654,7 +657,7 @@ end
654
657
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
655
658
  s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
656
659
 
657
- if current_version >= 3 then
660
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
658
661
  s.add_runtime_dependency(%q<b>, [\"= 1\"])
659
662
  else
660
663
  s.add_dependency(%q<b>, [\"= 1\"])
@@ -663,7 +666,7 @@ end
663
666
  s.add_dependency(%q<b>, [\"= 1\"])
664
667
  end
665
668
  end
666
- "
669
+ SPEC
667
670
 
668
671
  assert_equal expected, ruby_code
669
672
 
@@ -679,7 +682,10 @@ end
679
682
  local = Gem::Platform.local
680
683
  expected_platform = "[#{local.cpu.inspect}, #{local.os.inspect}, #{local.version.inspect}]"
681
684
 
682
- expected = "Gem::Specification.new do |s|
685
+ expected = <<-SPEC
686
+ # -*- encoding: utf-8 -*-
687
+
688
+ Gem::Specification.new do |s|
683
689
  s.name = %q{a}
684
690
  s.version = \"1\"
685
691
  s.platform = Gem::Platform.new(#{expected_platform})
@@ -706,7 +712,7 @@ end
706
712
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
707
713
  s.specification_version = 2
708
714
 
709
- if current_version >= 3 then
715
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
710
716
  s.add_runtime_dependency(%q<rake>, [\"> 0.4\"])
711
717
  s.add_runtime_dependency(%q<jabber4r>, [\"> 0.0.0\"])
712
718
  s.add_runtime_dependency(%q<pqa>, [\"> 0.4\", \"<= 0.6\"])
@@ -721,7 +727,7 @@ end
721
727
  s.add_dependency(%q<pqa>, [\"> 0.4\", \"<= 0.6\"])
722
728
  end
723
729
  end
724
- "
730
+ SPEC
725
731
 
726
732
  assert_equal expected, ruby_code
727
733
 
@@ -10,8 +10,10 @@ class TestGemUninstaller < GemInstallerTestCase
10
10
  ui = MockGemUi.new
11
11
  util_setup_gem ui
12
12
 
13
- use_ui ui do
14
- @installer.install
13
+ build_rake_in do
14
+ use_ui ui do
15
+ @installer.install
16
+ end
15
17
  end
16
18
  end
17
19
 
@@ -60,5 +62,26 @@ class TestGemUninstaller < GemInstallerTestCase
60
62
  assert_equal true, uninstaller.path_ok?(@spec)
61
63
  end
62
64
 
65
+ def test_uninstall
66
+ uninstaller = Gem::Uninstaller.new @spec.name, :executables => true
67
+
68
+ gem_dir = File.join @gemhome, 'gems', @spec.full_name
69
+
70
+ Gem.pre_uninstall do
71
+ assert File.exist?(gem_dir), 'gem_dir should exist'
72
+ end
73
+
74
+ Gem.post_uninstall do
75
+ assert !File.exist?(gem_dir), 'gem_dir should not exist'
76
+ end
77
+
78
+ uninstaller.uninstall
79
+
80
+ assert !File.exist?(gem_dir)
81
+
82
+ assert_same uninstaller, @pre_uninstall_hook_arg
83
+ assert_same uninstaller, @post_uninstall_hook_arg
84
+ end
85
+
63
86
  end
64
87
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -32,7 +32,7 @@ cert_chain:
32
32
  x52qPcexcYZR7w==
33
33
  -----END CERTIFICATE-----
34
34
 
35
- date: 2008-06-23 00:00:00 -07:00
35
+ date: 2008-09-25 00:00:00 -07:00
36
36
  default_executable:
37
37
  dependencies: []
38
38
 
@@ -79,6 +79,7 @@ files:
79
79
  - doc/release_notes/rel_1_1_0.rdoc
80
80
  - doc/release_notes/rel_1_1_1.rdoc
81
81
  - doc/release_notes/rel_1_2_0.rdoc
82
+ - doc/release_notes/rel_1_3_0.rdoc
82
83
  - lib/rbconfig/datadir.rb
83
84
  - lib/rubygems/builder.rb
84
85
  - lib/rubygems/command.rb
@@ -204,6 +205,8 @@ files:
204
205
  - test/test_gem_commands_fetch_command.rb
205
206
  - test/test_gem_commands_generate_index_command.rb
206
207
  - test/test_gem_commands_install_command.rb
208
+ - test/test_gem_commands_list_command.rb
209
+ - test/test_gem_commands_lock_command.rb
207
210
  - test/test_gem_commands_mirror_command.rb
208
211
  - test/test_gem_commands_outdated_command.rb
209
212
  - test/test_gem_commands_pristine_command.rb
@@ -212,6 +215,7 @@ files:
212
215
  - test/test_gem_commands_sources_command.rb
213
216
  - test/test_gem_commands_specification_command.rb
214
217
  - test/test_gem_commands_stale_command.rb
218
+ - test/test_gem_commands_uninstall_command.rb
215
219
  - test/test_gem_commands_unpack_command.rb
216
220
  - test/test_gem_commands_update_command.rb
217
221
  - test/test_gem_config_file.rb
metadata.gz.sig CHANGED
Binary file