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
@@ -23,12 +23,12 @@ class TestGem < Gem::TestCase
23
23
  def assert_activate expected, *specs
24
24
  specs.each do |spec|
25
25
  case spec
26
- when Array
27
- Gem.activate(*spec)
28
- when String
29
- Gem.activate spec
26
+ when String then
27
+ Gem::Specification.find_by_name(spec).activate
28
+ when Gem::Specification then
29
+ spec.activate
30
30
  else
31
- Gem.activate spec.name
31
+ flunk spec.inspect
32
32
  end
33
33
  end
34
34
 
@@ -51,17 +51,21 @@ class TestGem < Gem::TestCase
51
51
  Gem.unresolved_deps.values.map(&:to_s).sort
52
52
  end
53
53
 
54
+ # TODO: move these to specification
54
55
  def test_self_activate_via_require
55
- new_spec "a", "1", "b" => "= 1"
56
- new_spec "b", "1", nil, "lib/b/c.rb"
57
- new_spec "b", "2", nil, "lib/b/c.rb"
56
+ a1 = new_spec "a", "1", "b" => "= 1"
57
+ b1 = new_spec "b", "1", nil, "lib/b/c.rb"
58
+ b2 = new_spec "b", "2", nil, "lib/b/c.rb"
59
+
60
+ install_specs a1, b1, b2
58
61
 
59
- Gem.activate "a", "= 1"
62
+ a1.activate
60
63
  require "b/c"
61
64
 
62
65
  assert_equal %w(a-1 b-1), loaded_spec_names
63
66
  end
64
67
 
68
+ # TODO: move these to specification
65
69
  def test_self_activate_deep_unambiguous
66
70
  a1 = new_spec "a", "1", "b" => "= 1"
67
71
  b1 = new_spec "b", "1", "c" => "= 1"
@@ -71,7 +75,7 @@ class TestGem < Gem::TestCase
71
75
 
72
76
  install_specs a1, b1, b2, c1, c2
73
77
 
74
- Gem.activate "a", "= 1"
78
+ a1.activate
75
79
  assert_equal %w(a-1 b-1 c-1), loaded_spec_names
76
80
  end
77
81
 
@@ -82,6 +86,7 @@ class TestGem < Gem::TestCase
82
86
  $LOADED_FEATURES.replace old_loaded_features
83
87
  end
84
88
 
89
+ # TODO: move these to specification
85
90
  def test_self_activate_ambiguous_direct
86
91
  save_loaded_features do
87
92
  a1 = new_spec "a", "1", "b" => "> 0"
@@ -90,9 +95,10 @@ class TestGem < Gem::TestCase
90
95
  c1 = new_spec "c", "1"
91
96
  c2 = new_spec "c", "2"
92
97
 
98
+ Gem::Specification.reset
93
99
  install_specs a1, b1, b2, c1, c2
94
100
 
95
- Gem.activate "a", "= 1"
101
+ a1.activate
96
102
  assert_equal %w(a-1), loaded_spec_names
97
103
  assert_equal ["b (> 0)"], unresolved_names
98
104
 
@@ -103,6 +109,7 @@ class TestGem < Gem::TestCase
103
109
  end
104
110
  end
105
111
 
112
+ # TODO: move these to specification
106
113
  def test_self_activate_ambiguous_indirect
107
114
  save_loaded_features do
108
115
  a1 = new_spec "a", "1", "b" => "> 0"
@@ -113,7 +120,7 @@ class TestGem < Gem::TestCase
113
120
 
114
121
  install_specs a1, b1, b2, c1, c2
115
122
 
116
- Gem.activate "a", "= 1"
123
+ a1.activate
117
124
  assert_equal %w(a-1), loaded_spec_names
118
125
  assert_equal ["b (> 0)"], unresolved_names
119
126
 
@@ -124,6 +131,7 @@ class TestGem < Gem::TestCase
124
131
  end
125
132
  end
126
133
 
134
+ # TODO: move these to specification
127
135
  def test_self_activate_ambiguous_unrelated
128
136
  save_loaded_features do
129
137
  a1 = new_spec "a", "1", "b" => "> 0"
@@ -135,7 +143,7 @@ class TestGem < Gem::TestCase
135
143
 
136
144
  install_specs a1, b1, b2, c1, c2, d1
137
145
 
138
- Gem.activate "a", "= 1"
146
+ a1.activate
139
147
  assert_equal %w(a-1), loaded_spec_names
140
148
  assert_equal ["b (> 0)"], unresolved_names
141
149
 
@@ -146,6 +154,7 @@ class TestGem < Gem::TestCase
146
154
  end
147
155
  end
148
156
 
157
+ # TODO: move these to specification
149
158
  def test_self_activate_ambiguous_indirect_conflict
150
159
  save_loaded_features do
151
160
  a1 = new_spec "a", "1", "b" => "> 0"
@@ -157,7 +166,7 @@ class TestGem < Gem::TestCase
157
166
 
158
167
  install_specs a1, a2, b1, b2, c1, c2
159
168
 
160
- Gem.activate "a", "= 2"
169
+ a2.activate
161
170
  assert_equal %w(a-2), loaded_spec_names
162
171
  assert_equal ["b (> 0)"], unresolved_names
163
172
 
@@ -168,13 +177,14 @@ class TestGem < Gem::TestCase
168
177
  end
169
178
  end
170
179
 
180
+ # TODO: move these to specification
171
181
  def test_require_already_activated
172
182
  save_loaded_features do
173
183
  a1 = new_spec "a", "1", nil, "lib/d.rb"
174
184
 
175
185
  install_specs a1 # , a2, b1, b2, c1, c2
176
186
 
177
- Gem.activate "a", "= 1"
187
+ a1.activate
178
188
  assert_equal %w(a-1), loaded_spec_names
179
189
  assert_equal [], unresolved_names
180
190
 
@@ -185,6 +195,7 @@ class TestGem < Gem::TestCase
185
195
  end
186
196
  end
187
197
 
198
+ # TODO: move these to specification
188
199
  def test_require_already_activated_indirect_conflict
189
200
  save_loaded_features do
190
201
  a1 = new_spec "a", "1", "b" => "> 0"
@@ -196,8 +207,8 @@ class TestGem < Gem::TestCase
196
207
 
197
208
  install_specs a1, a2, b1, b2, c1, c2
198
209
 
199
- Gem.activate "a", "= 1"
200
- Gem.activate "c", "= 1"
210
+ a1.activate
211
+ c1.activate
201
212
  assert_equal %w(a-1 c-1), loaded_spec_names
202
213
  assert_equal ["b (> 0)"], unresolved_names
203
214
 
@@ -216,11 +227,26 @@ class TestGem < Gem::TestCase
216
227
  end
217
228
  end
218
229
 
230
+ def test_require_does_not_glob
231
+ save_loaded_features do
232
+ a1 = new_spec "a", "1", nil, "lib/a1.rb"
233
+
234
+ install_specs a1
235
+
236
+ assert_raises ::LoadError do
237
+ require "a*"
238
+ end
239
+
240
+ assert_equal [], loaded_spec_names
241
+ end
242
+ end
243
+
244
+ # TODO: move these to specification
219
245
  def test_self_activate_loaded
220
- util_spec 'foo', '1'
246
+ foo = util_spec 'foo', '1'
221
247
 
222
- assert Gem.activate 'foo'
223
- refute Gem.activate 'foo'
248
+ assert foo.activate
249
+ refute foo.activate
224
250
  end
225
251
 
226
252
  ##
@@ -243,15 +269,16 @@ class TestGem < Gem::TestCase
243
269
  # [B] ~> 1.0
244
270
  #
245
271
  # and should resolve using b-1.0
272
+ # TODO: move these to specification
246
273
 
247
274
  def test_self_activate_over
248
- util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '= 1.0'
275
+ a = util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '= 1.0'
249
276
  util_spec 'b', '1.0'
250
277
  util_spec 'b', '1.1'
251
278
  util_spec 'b', '2.0'
252
279
  util_spec 'c', '1.0', 'b' => '~> 1.0'
253
280
 
254
- Gem.activate "a"
281
+ a.activate
255
282
 
256
283
  assert_equal %w[a-1.0 c-1.0], loaded_spec_names
257
284
  assert_equal ["b (>= 1.0, ~> 1.0)"], unresolved_names
@@ -408,10 +435,20 @@ class TestGem < Gem::TestCase
408
435
 
409
436
  def test_self_available?
410
437
  util_make_gems
411
- assert(Gem.available?("a"))
412
- assert(Gem.available?("a", "1"))
413
- assert(Gem.available?("a", ">1"))
414
- assert(!Gem.available?("monkeys"))
438
+ Deprecate.skip_during do
439
+ assert(Gem.available?("a"))
440
+ assert(Gem.available?("a", "1"))
441
+ assert(Gem.available?("a", ">1"))
442
+ assert(!Gem.available?("monkeys"))
443
+ end
444
+ end
445
+
446
+ def test_self_bin_path_no_exec_name
447
+ e = assert_raises ArgumentError do
448
+ Gem.bin_path 'a'
449
+ end
450
+
451
+ assert_equal 'you must supply exec_name', e.message
415
452
  end
416
453
 
417
454
  def test_self_bin_path_bin_name
@@ -474,17 +511,12 @@ class TestGem < Gem::TestCase
474
511
  end
475
512
 
476
513
  def test_self_clear_paths
477
- Gem.dir
478
- Gem.path
479
- searcher = Gem.searcher
480
- source_index = Gem.source_index
514
+ assert_match(/gemhome$/, Gem.dir)
515
+ assert_match(/gemhome$/, Gem.path.first)
481
516
 
482
517
  Gem.clear_paths
483
518
 
484
- assert_equal nil, Gem.instance_variable_get(:@gem_home)
485
- assert_equal nil, Gem.instance_variable_get(:@gem_path)
486
- refute_equal searcher, Gem.searcher
487
- refute_equal source_index.object_id, Gem.source_index.object_id
519
+ assert_nil Gem::Specification.send(:class_variable_get, :@@all)
488
520
  end
489
521
 
490
522
  def test_self_configuration
@@ -507,8 +539,6 @@ class TestGem < Gem::TestCase
507
539
  install_gem foo
508
540
  end
509
541
 
510
- Gem.source_index = nil
511
-
512
542
  gem 'foo'
513
543
 
514
544
  expected = File.join @gemhome, 'gems', foo.full_name, 'data', 'foo'
@@ -565,7 +595,7 @@ class TestGem < Gem::TestCase
565
595
 
566
596
  Gem.ensure_gem_subdirectories @gemhome
567
597
 
568
- assert File.directory?(Gem.cache_dir(@gemhome))
598
+ assert File.directory? File.join(@gemhome, "cache")
569
599
  end
570
600
 
571
601
  def test_self_ensure_gem_directories_missing_parents
@@ -577,7 +607,7 @@ class TestGem < Gem::TestCase
577
607
 
578
608
  Gem.ensure_gem_subdirectories gemdir
579
609
 
580
- assert File.directory?(Gem.cache_dir(gemdir))
610
+ assert File.directory?(util_cache_dir)
581
611
  end
582
612
 
583
613
  unless win_platform? then # only for FS that support write protection
@@ -591,7 +621,7 @@ class TestGem < Gem::TestCase
591
621
 
592
622
  Gem.ensure_gem_subdirectories gemdir
593
623
 
594
- refute File.exist?(Gem.cache_dir(gemdir))
624
+ refute File.exist?(util_cache_dir)
595
625
  ensure
596
626
  FileUtils.chmod 0600, gemdir
597
627
  end
@@ -608,7 +638,7 @@ class TestGem < Gem::TestCase
608
638
 
609
639
  Gem.ensure_gem_subdirectories gemdir
610
640
 
611
- refute File.exist?(Gem.cache_dir(gemdir))
641
+ refute File.exist? File.join(gemdir, "gems")
612
642
  ensure
613
643
  FileUtils.chmod 0600, parent
614
644
  end
@@ -628,30 +658,26 @@ class TestGem < Gem::TestCase
628
658
  end
629
659
 
630
660
  def test_self_find_files
631
- discover_path = File.join 'lib', 'sff', 'discover.rb'
632
661
  cwd = File.expand_path("test/rubygems", @@project_dir)
633
662
  $LOAD_PATH.unshift cwd
634
663
 
635
- foo1 = quick_gem 'sff', '1' do |s|
636
- s.files << discover_path
637
- end
638
-
639
- foo2 = quick_gem 'sff', '2' do |s|
640
- s.files << discover_path
641
- end
642
-
643
- path = File.join 'gems', foo1.full_name, discover_path
644
- write_file(path) { |fp| fp.puts "# #{path}" }
664
+ discover_path = File.join 'lib', 'sff', 'discover.rb'
645
665
 
646
- path = File.join 'gems', foo2.full_name, discover_path
647
- write_file(path) { |fp| fp.puts "# #{path}" }
666
+ foo1, foo2 = %w(1 2).map { |version|
667
+ spec = quick_gem 'sff', version do |s|
668
+ s.files << discover_path
669
+ end
648
670
 
649
- @fetcher = Gem::FakeFetcher.new
650
- Gem::RemoteFetcher.fetcher = @fetcher
671
+ write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
672
+ fp.puts "# #{spec.full_name}"
673
+ end
651
674
 
652
- Gem.source_index = util_setup_spec_fetcher foo1, foo2
675
+ spec
676
+ }
653
677
 
678
+ # HACK should be Gem.refresh
654
679
  Gem.searcher = nil
680
+ Gem::Specification.reset
655
681
 
656
682
  expected = [
657
683
  File.expand_path('test/rubygems/sff/discover.rb', @@project_dir),
@@ -668,9 +694,8 @@ class TestGem < Gem::TestCase
668
694
  def test_self_loaded_specs
669
695
  foo = quick_spec 'foo'
670
696
  install_gem foo
671
- Gem.source_index = nil
672
697
 
673
- Gem.activate 'foo'
698
+ foo.activate
674
699
 
675
700
  assert_equal true, Gem.loaded_specs.keys.include?('foo')
676
701
  end
@@ -691,9 +716,10 @@ class TestGem < Gem::TestCase
691
716
  orig_APPLE_GEM_HOME = APPLE_GEM_HOME
692
717
  Object.send :remove_const, :APPLE_GEM_HOME
693
718
  end
694
- Gem.instance_variable_set :@gem_path, nil
695
719
 
696
- assert_equal [Gem.default_path, Gem.dir].flatten, Gem.path
720
+ Gem.instance_variable_set :@paths, nil
721
+
722
+ assert_equal [Gem.default_path, Gem.dir].flatten.uniq, Gem.path
697
723
  ensure
698
724
  Object.const_set :APPLE_GEM_HOME, orig_APPLE_GEM_HOME
699
725
  end
@@ -724,7 +750,6 @@ class TestGem < Gem::TestCase
724
750
  end
725
751
 
726
752
  def test_self_path_ENV_PATH
727
- Gem.send :set_paths, nil
728
753
  path_count = Gem.path.size
729
754
  Gem.clear_paths
730
755
 
@@ -793,29 +818,20 @@ class TestGem < Gem::TestCase
793
818
  def test_self_refresh
794
819
  util_make_gems
795
820
 
796
- a1_spec = File.join @gemhome, "specifications", @a1.spec_name
797
-
798
- FileUtils.mv a1_spec, @tempdir
799
-
800
- refute Gem.source_index.gems.include?(@a1.full_name)
821
+ a1_spec = @a1.spec_file
822
+ moved_path = File.join @tempdir, File.basename(a1_spec)
801
823
 
802
- FileUtils.mv File.join(@tempdir, @a1.spec_name), a1_spec
824
+ FileUtils.mv a1_spec, moved_path
803
825
 
804
826
  Gem.refresh
805
827
 
806
- assert_includes Gem.source_index.gems, @a1.full_name
807
- assert_equal nil, Gem.instance_variable_get(:@searcher)
808
- end
828
+ refute_includes Gem::Specification.all_names, @a1.full_name
809
829
 
810
- def test_self_required_location
811
- util_make_gems
830
+ FileUtils.mv moved_path, a1_spec
831
+
832
+ Gem.refresh
812
833
 
813
- assert_equal File.join(@tempdir, *%w[gemhome gems c-1.2 lib code.rb]),
814
- Gem.required_location("c", "code.rb")
815
- assert_equal File.join(@tempdir, *%w[gemhome gems a-1 lib code.rb]),
816
- Gem.required_location("a", "code.rb", "< 2")
817
- assert_equal File.join(@tempdir, *%w[gemhome gems a-2 lib code.rb]),
818
- Gem.required_location("a", "code.rb", "= 2")
834
+ assert_includes Gem::Specification.all_names, @a1.full_name
819
835
  end
820
836
 
821
837
  def test_self_ruby_escaping_spaces_in_path
@@ -880,19 +896,20 @@ class TestGem < Gem::TestCase
880
896
  util_restore_RUBY_VERSION
881
897
  end
882
898
 
883
- def test_self_searcher
884
- assert_kind_of Gem::GemPathSearcher, Gem.searcher
885
- end
886
-
887
- def test_self_set_paths
899
+ def test_self_paths_eq
888
900
  other = File.join @tempdir, 'other'
889
901
  path = [@userhome, other].join File::PATH_SEPARATOR
890
- Gem.send :set_paths, path
902
+
903
+ #
904
+ # FIXME remove after fixing test_case
905
+ #
906
+ ENV["GEM_HOME"] = @gemhome
907
+ Gem.paths = { "GEM_PATH" => path }
891
908
 
892
909
  assert_equal [@userhome, other, @gemhome], Gem.path
893
910
  end
894
911
 
895
- def test_self_set_paths_nonexistent_home
912
+ def test_self_paths_eq_nonexistent_home
896
913
  ENV['GEM_HOME'] = @gemhome
897
914
  Gem.clear_paths
898
915
 
@@ -900,19 +917,37 @@ class TestGem < Gem::TestCase
900
917
 
901
918
  ENV['HOME'] = other
902
919
 
903
- Gem.send :set_paths, other
920
+ Gem.paths = { "GEM_PATH" => other }
904
921
 
905
922
  assert_equal [other, @gemhome], Gem.path
906
923
  end
907
924
 
908
925
  def test_self_source_index
909
- assert_kind_of Gem::SourceIndex, Gem.source_index
926
+ Deprecate.skip_during do
927
+ assert_kind_of Gem::SourceIndex, Gem.source_index
928
+ end
910
929
  end
911
930
 
912
931
  def test_self_sources
913
932
  assert_equal %w[http://gems.example.com/], Gem.sources
914
933
  end
915
934
 
935
+ def test_self_try_activate_missing_dep
936
+ a = util_spec 'a', '1.0', 'b' => '>= 1.0'
937
+
938
+ a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
939
+
940
+ write_file a_file do |io|
941
+ io.puts '# a_file.rb'
942
+ end
943
+
944
+ e = assert_raises Gem::LoadError do
945
+ Gem.try_activate 'a_file'
946
+ end
947
+
948
+ assert_match %r%Could not find b %, e.message
949
+ end
950
+
916
951
  def test_ssl_available_eh
917
952
  orig_Gem_ssl_available = Gem.ssl_available?
918
953
 
@@ -947,20 +982,6 @@ class TestGem < Gem::TestCase
947
982
  end
948
983
  end
949
984
 
950
- def test_self_cache_dir
951
- util_ensure_gem_dirs
952
-
953
- assert_equal File.join(@gemhome, 'cache'), Gem.cache_dir
954
- assert_equal File.join(@userhome, '.gem', Gem.ruby_engine, Gem::ConfigMap[:ruby_version], 'cache'), Gem.cache_dir(Gem.user_dir)
955
- end
956
-
957
- def test_self_cache_gem
958
- util_ensure_gem_dirs
959
-
960
- assert_equal File.join(@gemhome, 'cache', 'test.gem'), Gem.cache_gem('test.gem')
961
- assert_equal File.join(@userhome, '.gem', Gem.ruby_engine, Gem::ConfigMap[:ruby_version], 'cache', 'test.gem'), Gem.cache_gem('test.gem', Gem.user_dir)
962
- end
963
-
964
985
  if Gem.win_platform? then
965
986
  def test_self_user_home_userprofile
966
987
  skip 'Ruby 1.9 properly handles ~ path expansion' unless '1.9' > RUBY_VERSION
@@ -1022,8 +1043,8 @@ class TestGem < Gem::TestCase
1022
1043
  install_gem foo
1023
1044
  end
1024
1045
 
1025
- Gem.source_index = nil
1026
1046
  Gem.searcher = nil
1047
+ Gem::Specification.reset
1027
1048
 
1028
1049
  gem 'foo'
1029
1050
 
@@ -1067,6 +1088,10 @@ class TestGem < Gem::TestCase
1067
1088
 
1068
1089
  def util_ensure_gem_dirs
1069
1090
  Gem.ensure_gem_subdirectories @gemhome
1091
+
1092
+ #
1093
+ # FIXME what does this solve precisely? -ebh
1094
+ #
1070
1095
  @additional.each do |dir|
1071
1096
  Gem.ensure_gem_subdirectories @gemhome
1072
1097
  end
@@ -1116,5 +1141,9 @@ class TestGem < Gem::TestCase
1116
1141
  Gem::Commands.send :remove_const, :InterruptCommand if
1117
1142
  Gem::Commands.const_defined? :InterruptCommand
1118
1143
  end
1144
+
1145
+ def util_cache_dir
1146
+ File.join Gem.dir, "cache"
1147
+ end
1119
1148
  end
1120
1149