rubygems-update 2.4.8 → 2.5.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 (125) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/CODE_OF_CONDUCT.md +40 -0
  5. data/CVE-2015-3900.txt +40 -0
  6. data/History.txt +173 -2
  7. data/Manifest.txt +14 -1
  8. data/Rakefile +36 -1
  9. data/lib/rubygems.rb +32 -14
  10. data/lib/rubygems/basic_specification.rb +31 -9
  11. data/lib/rubygems/commands/dependency_command.rb +25 -15
  12. data/lib/rubygems/commands/environment_command.rb +2 -0
  13. data/lib/rubygems/commands/help_command.rb +0 -10
  14. data/lib/rubygems/commands/install_command.rb +1 -1
  15. data/lib/rubygems/commands/list_command.rb +1 -1
  16. data/lib/rubygems/commands/pristine_command.rb +11 -1
  17. data/lib/rubygems/commands/query_command.rb +1 -1
  18. data/lib/rubygems/commands/sources_command.rb +1 -1
  19. data/lib/rubygems/commands/update_command.rb +2 -2
  20. data/lib/rubygems/config_file.rb +4 -4
  21. data/lib/rubygems/core_ext/kernel_require.rb +2 -2
  22. data/lib/rubygems/dependency.rb +9 -6
  23. data/lib/rubygems/dependency_list.rb +3 -0
  24. data/lib/rubygems/ext/builder.rb +2 -0
  25. data/lib/rubygems/ext/ext_conf_builder.rb +6 -1
  26. data/lib/rubygems/indexer.rb +26 -91
  27. data/lib/rubygems/installer.rb +58 -26
  28. data/lib/rubygems/installer_test_case.rb +2 -2
  29. data/lib/rubygems/package.rb +18 -6
  30. data/lib/rubygems/package/old.rb +2 -2
  31. data/lib/rubygems/package/tar_reader/entry.rb +7 -1
  32. data/lib/rubygems/package/tar_test_case.rb +12 -3
  33. data/lib/rubygems/package/tar_writer.rb +19 -1
  34. data/lib/rubygems/platform.rb +3 -2
  35. data/lib/rubygems/rdoc.rb +1 -2
  36. data/lib/rubygems/remote_fetcher.rb +25 -6
  37. data/lib/rubygems/request/connection_pools.rb +8 -4
  38. data/lib/rubygems/request_set.rb +3 -4
  39. data/lib/rubygems/request_set/gem_dependency_api.rb +2 -2
  40. data/lib/rubygems/request_set/lockfile.rb +1 -1
  41. data/lib/rubygems/request_set/lockfile/parser.rb +54 -43
  42. data/lib/rubygems/request_set/lockfile/tokenizer.rb +16 -13
  43. data/lib/rubygems/resolver.rb +47 -242
  44. data/lib/rubygems/resolver/activation_request.rb +2 -1
  45. data/lib/rubygems/resolver/conflict.rb +0 -1
  46. data/lib/rubygems/resolver/dependency_request.rb +4 -1
  47. data/lib/rubygems/resolver/git_specification.rb +1 -2
  48. data/lib/rubygems/resolver/molinillo.rb +1 -0
  49. data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +5 -0
  50. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +266 -0
  51. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +69 -0
  52. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +3 -0
  53. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +99 -0
  54. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +63 -0
  55. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +430 -0
  56. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +43 -0
  57. data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +51 -0
  58. data/lib/rubygems/resolver/specification.rb +1 -1
  59. data/lib/rubygems/specification.rb +256 -86
  60. data/lib/rubygems/stub_specification.rb +37 -29
  61. data/lib/rubygems/test_case.rb +65 -28
  62. data/lib/rubygems/test_utilities.rb +18 -18
  63. data/lib/rubygems/text.rb +0 -2
  64. data/lib/rubygems/uninstaller.rb +1 -1
  65. data/lib/rubygems/util.rb +4 -4
  66. data/lib/rubygems/util/licenses.rb +309 -0
  67. data/lib/rubygems/util/list.rb +9 -21
  68. data/lib/rubygems/version.rb +24 -14
  69. data/test/rubygems/simple_gem.rb +1 -1
  70. data/test/rubygems/test_config.rb +10 -1
  71. data/test/rubygems/test_gem.rb +58 -11
  72. data/test/rubygems/test_gem_available_set.rb +2 -1
  73. data/test/rubygems/test_gem_commands_cleanup_command.rb +6 -5
  74. data/test/rubygems/test_gem_commands_dependency_command.rb +9 -1
  75. data/test/rubygems/test_gem_commands_install_command.rb +17 -28
  76. data/test/rubygems/test_gem_commands_mirror.rb +0 -13
  77. data/test/rubygems/test_gem_commands_outdated_command.rb +2 -3
  78. data/test/rubygems/test_gem_commands_pristine_command.rb +33 -5
  79. data/test/rubygems/test_gem_commands_query_command.rb +123 -158
  80. data/test/rubygems/test_gem_commands_server_command.rb +2 -2
  81. data/test/rubygems/test_gem_commands_specification_command.rb +4 -4
  82. data/test/rubygems/test_gem_commands_stale_command.rb +2 -0
  83. data/test/rubygems/test_gem_commands_uninstall_command.rb +5 -4
  84. data/test/rubygems/test_gem_commands_unpack_command.rb +4 -6
  85. data/test/rubygems/test_gem_commands_update_command.rb +22 -52
  86. data/test/rubygems/test_gem_commands_which_command.rb +1 -0
  87. data/test/rubygems/test_gem_config_file.rb +1 -1
  88. data/test/rubygems/test_gem_dependency.rb +7 -3
  89. data/test/rubygems/test_gem_dependency_installer.rb +5 -5
  90. data/test/rubygems/test_gem_doctor.rb +1 -1
  91. data/test/rubygems/test_gem_ext_builder.rb +2 -0
  92. data/test/rubygems/test_gem_ext_configure_builder.rb +8 -4
  93. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +25 -21
  94. data/test/rubygems/test_gem_indexer.rb +4 -4
  95. data/test/rubygems/test_gem_install_update_options.rb +2 -2
  96. data/test/rubygems/test_gem_installer.rb +32 -26
  97. data/test/rubygems/test_gem_package.rb +46 -1
  98. data/test/rubygems/test_gem_package_tar_reader_entry.rb +8 -1
  99. data/test/rubygems/test_gem_package_tar_writer.rb +10 -1
  100. data/test/rubygems/test_gem_package_task.rb +5 -2
  101. data/test/rubygems/test_gem_platform.rb +11 -0
  102. data/test/rubygems/test_gem_remote_fetcher.rb +64 -3
  103. data/test/rubygems/test_gem_request.rb +1 -1
  104. data/test/rubygems/test_gem_request_connection_pools.rb +10 -1
  105. data/test/rubygems/test_gem_request_set.rb +5 -8
  106. data/test/rubygems/test_gem_request_set_lockfile.rb +2 -4
  107. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
  108. data/test/rubygems/test_gem_resolver.rb +12 -31
  109. data/test/rubygems/test_gem_resolver_git_specification.rb +1 -0
  110. data/test/rubygems/test_gem_resolver_installer_set.rb +7 -11
  111. data/test/rubygems/test_gem_resolver_lock_specification.rb +3 -2
  112. data/test/rubygems/test_gem_security_trust_dir.rb +2 -0
  113. data/test/rubygems/test_gem_server.rb +4 -0
  114. data/test/rubygems/test_gem_specification.rb +344 -61
  115. data/test/rubygems/test_gem_stream_ui.rb +6 -6
  116. data/test/rubygems/test_gem_stub_specification.rb +21 -6
  117. data/test/rubygems/test_gem_text.rb +2 -0
  118. data/test/rubygems/test_gem_uninstaller.rb +2 -1
  119. data/test/rubygems/test_gem_util.rb +8 -0
  120. data/test/rubygems/test_require.rb +156 -125
  121. data/util/generate_spdx_license_list.rb +21 -0
  122. data/util/update_bundled_ca_certificates.rb +2 -1
  123. metadata +42 -6
  124. metadata.gz.sig +0 -0
  125. data/lib/rubygems/util/stringio.rb +0 -34
@@ -16,7 +16,7 @@ SIMPLE_GEM = <<-GEMDATA
16
16
  @directory = options[:directory] || Gem.dir
17
17
  @force = options[:force]
18
18
 
19
- gem = Gem::Installer.new(__FILE__).install(@force, @directory)
19
+ gem = Gem::Installer.at(__FILE__).install(@force, @directory)
20
20
  if options[:gen_rdoc]
21
21
  Gem::DocManager.new(gem).generate_rdoc
22
22
  end
@@ -10,5 +10,14 @@ class TestConfig < Gem::TestCase
10
10
  assert_equal "#{spec.full_gem_path}/data/a", Gem.datadir('a')
11
11
  end
12
12
 
13
- end
13
+ def test_good_rake_path_is_escaped
14
+ path = Gem::TestCase.class_eval('@@good_rake')
15
+ assert_match(/#{Gem.ruby} "[^"]*good_rake.rb"/, path)
16
+ end
14
17
 
18
+ def test_bad_rake_path_is_escaped
19
+ path = Gem::TestCase.class_eval('@@bad_rake')
20
+ assert_match(/#{Gem.ruby} "[^"]*bad_rake.rb"/, path)
21
+ end
22
+
23
+ end
@@ -37,7 +37,7 @@ class TestGem < Gem::TestCase
37
37
  c1 = new_spec "c", "1"
38
38
  c2 = new_spec "c", "2"
39
39
 
40
- install_specs a1, b1, b2, c1, c2
40
+ install_specs c1, c2, b1, b2, a1
41
41
 
42
42
  a1.activate
43
43
 
@@ -61,7 +61,7 @@ class TestGem < Gem::TestCase
61
61
  d1 = new_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
62
62
  d2 = new_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
63
63
 
64
- install_specs a1, b1, b2, c1, c2, d1, d2
64
+ install_specs c1, c2, b1, b2, d1, d2, a1
65
65
 
66
66
  a1.activate
67
67
 
@@ -90,6 +90,23 @@ class TestGem < Gem::TestCase
90
90
  assert_path_exists File.join(gemhome2, 'gems', 'a-1')
91
91
  end
92
92
 
93
+ def test_self_install_in_rescue
94
+ spec_fetcher do |f|
95
+ f.gem 'a', 1
96
+ f.spec 'a', 2
97
+ end
98
+
99
+ gemhome2 = "#{@gemhome}2"
100
+
101
+ installed =
102
+ begin
103
+ raise 'Error'
104
+ rescue StandardError
105
+ Gem.install 'a', '= 1', :install_dir => gemhome2
106
+ end
107
+ assert_equal %w[a-1], installed.map { |spec| spec.full_name }
108
+ end
109
+
93
110
  def test_require_missing
94
111
  save_loaded_features do
95
112
  assert_raises ::LoadError do
@@ -135,12 +152,12 @@ class TestGem < Gem::TestCase
135
152
  end
136
153
 
137
154
  def test_self_bin_path_bin_name
138
- util_exec_gem
155
+ install_specs util_exec_gem
139
156
  assert_equal @abin_path, Gem.bin_path('a', 'abin')
140
157
  end
141
158
 
142
159
  def test_self_bin_path_bin_name_version
143
- util_exec_gem
160
+ install_specs util_exec_gem
144
161
  assert_equal @abin_path, Gem.bin_path('a', 'abin', '4')
145
162
  end
146
163
 
@@ -167,10 +184,11 @@ class TestGem < Gem::TestCase
167
184
  end
168
185
 
169
186
  def test_self_bin_path_bin_file_gone_in_latest
170
- util_exec_gem
171
- util_spec 'a', '10' do |s|
187
+ install_specs util_exec_gem
188
+ spec = util_spec 'a', '10' do |s|
172
189
  s.executables = []
173
190
  end
191
+ install_specs spec
174
192
  # Should not find a-10's non-abin (bug)
175
193
  assert_equal @abin_path, Gem.bin_path('a', 'abin')
176
194
  end
@@ -881,9 +899,23 @@ class TestGem < Gem::TestCase
881
899
  assert_equal %w[http://gems.example.com/], Gem.sources
882
900
  end
883
901
 
902
+ def test_try_activate_returns_true_for_activated_specs
903
+ b = util_spec 'b', '1.0' do |spec|
904
+ spec.files << 'lib/b.rb'
905
+ end
906
+ install_specs b
907
+
908
+ assert Gem.try_activate('b'), 'try_activate should return true'
909
+ assert Gem.try_activate('b'), 'try_activate should still return true'
910
+ end
911
+
884
912
  def test_self_try_activate_missing_dep
913
+ b = util_spec 'b', '1.0'
885
914
  a = util_spec 'a', '1.0', 'b' => '>= 1.0'
886
915
 
916
+ install_specs b, a
917
+ uninstall_gem b
918
+
887
919
  a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
888
920
 
889
921
  write_file a_file do |io|
@@ -898,12 +930,17 @@ class TestGem < Gem::TestCase
898
930
  end
899
931
 
900
932
  def test_self_try_activate_missing_extensions
901
- util_spec 'ext', '1' do |s|
933
+ spec = util_spec 'ext', '1' do |s|
902
934
  s.extensions = %w[ext/extconf.rb]
903
935
  s.mark_version
904
936
  s.installed_by_version = v('2.2')
905
937
  end
906
938
 
939
+ # write the spec without install to simulate a failed install
940
+ write_file spec.spec_file do |io|
941
+ io.write spec.to_ruby_for_cache
942
+ end
943
+
907
944
  _, err = capture_io do
908
945
  refute Gem.try_activate 'nonexistent'
909
946
  end
@@ -944,7 +981,7 @@ class TestGem < Gem::TestCase
944
981
  b = util_spec "b", "1", "c" => nil
945
982
  c = util_spec "c", "2"
946
983
 
947
- install_specs a, b, c
984
+ install_specs a, c, b
948
985
 
949
986
  Gem.needs do |r|
950
987
  r.gem "a"
@@ -966,7 +1003,7 @@ class TestGem < Gem::TestCase
966
1003
  d = new_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
967
1004
  e = util_spec "e", "1"
968
1005
 
969
- install_specs a, b, c, d, e
1006
+ install_specs a, c, b, e, d
970
1007
 
971
1008
  Gem.needs do |r|
972
1009
  r.gem "a"
@@ -1274,7 +1311,7 @@ class TestGem < Gem::TestCase
1274
1311
  ENV['GEM_PATH'] = path
1275
1312
  ENV['RUBYGEMS_GEMDEPS'] = "-"
1276
1313
 
1277
- out = `#{Gem.ruby.dup.untaint} -I #{LIB_PATH.untaint} -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
1314
+ out = `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
1278
1315
 
1279
1316
  assert_equal '["a-1", "b-1", "c-1"]', out.strip
1280
1317
  end
@@ -1306,7 +1343,7 @@ class TestGem < Gem::TestCase
1306
1343
 
1307
1344
  Dir.mkdir "sub1"
1308
1345
  out = Dir.chdir "sub1" do
1309
- `#{Gem.ruby.dup.untaint} -I #{LIB_PATH.untaint} -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
1346
+ `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
1310
1347
  end
1311
1348
 
1312
1349
  Dir.rmdir "sub1"
@@ -1372,16 +1409,21 @@ class TestGem < Gem::TestCase
1372
1409
  def test_use_gemdeps
1373
1410
  gem_deps_file = 'gem.deps.rb'.untaint
1374
1411
  spec = util_spec 'a', 1
1412
+ install_specs spec
1375
1413
 
1414
+ spec = Gem::Specification.find { |s| s == spec }
1376
1415
  refute spec.activated?
1377
1416
 
1378
1417
  open gem_deps_file, 'w' do |io|
1379
1418
  io.write 'gem "a"'
1380
1419
  end
1381
1420
 
1421
+ assert_nil Gem.gemdeps
1422
+
1382
1423
  Gem.use_gemdeps gem_deps_file
1383
1424
 
1384
1425
  assert spec.activated?
1426
+ refute_nil Gem.gemdeps
1385
1427
  end
1386
1428
 
1387
1429
  def test_use_gemdeps_ENV
@@ -1430,6 +1472,8 @@ class TestGem < Gem::TestCase
1430
1472
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
1431
1473
 
1432
1474
  spec = util_spec 'a', 1
1475
+ install_specs spec
1476
+ spec = Gem::Specification.find { |s| s == spec }
1433
1477
 
1434
1478
  refute spec.activated?
1435
1479
 
@@ -1499,7 +1543,9 @@ You may need to `gem install -g` to install missing gems
1499
1543
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
1500
1544
 
1501
1545
  spec = util_spec 'a', 1
1546
+ install_specs spec
1502
1547
 
1548
+ spec = Gem::Specification.find { |s| s == spec }
1503
1549
  refute spec.activated?
1504
1550
 
1505
1551
  open 'x', 'w' do |io|
@@ -1560,6 +1606,7 @@ You may need to `gem install -g` to install missing gems
1560
1606
 
1561
1607
  @exec_path = File.join spec.full_gem_path, spec.bindir, 'exec'
1562
1608
  @abin_path = File.join spec.full_gem_path, spec.bindir, 'abin'
1609
+ spec
1563
1610
  end
1564
1611
 
1565
1612
  def util_remove_interrupt_command
@@ -79,7 +79,8 @@ class TestGemAvailableSet < Gem::TestCase
79
79
  end
80
80
 
81
81
  def test_remove_installed_bang
82
- a1, _ = util_gem 'a', '1'
82
+ a1, _ = util_spec 'a', '1'
83
+ install_specs a1
83
84
 
84
85
  a1.activate
85
86
 
@@ -1,5 +1,6 @@
1
1
  require 'rubygems/test_case'
2
2
  require 'rubygems/commands/cleanup_command'
3
+ require 'rubygems/installer'
3
4
 
4
5
  class TestGemCommandsCleanupCommand < Gem::TestCase
5
6
 
@@ -78,8 +79,8 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
78
79
  end
79
80
 
80
81
  def test_execute_all_user
81
- @a_1_1 = util_spec 'a', '1.1'
82
- @a_1_1 = install_gem_user @a_1_1 # pick up user install path
82
+ @a_1_1, = util_gem 'a', '1.1'
83
+ @a_1_1 = install_gem @a_1_1 # pick up user install path
83
84
 
84
85
  Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
85
86
 
@@ -97,8 +98,8 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
97
98
  def test_execute_all_user_no_sudo
98
99
  FileUtils.chmod 0555, @gemhome
99
100
 
100
- @a_1_1 = util_spec 'a', '1.1'
101
- @a_1_1 = install_gem_user @a_1_1 # pick up user install path
101
+ @a_1_1, = util_gem 'a', '1.1'
102
+ @a_1_1 = install_gem @a_1_1, :user_install => true # pick up user install path
102
103
 
103
104
  Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
104
105
 
@@ -132,9 +133,9 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
132
133
  s.add_dependency 'b', '1'
133
134
  end
134
135
 
135
- install_gem @c
136
136
  install_gem @b_1
137
137
  install_gem @b_2
138
+ install_gem @c
138
139
 
139
140
  @cmd.options[:args] = []
140
141
 
@@ -28,6 +28,8 @@ class TestGemCommandsDependencyCommand < Gem::TestCase
28
28
  end
29
29
 
30
30
  def test_execute_no_args
31
+ install_specs new_spec 'x', '2'
32
+
31
33
  spec_fetcher do |fetcher|
32
34
  fetcher.spec 'a', 1
33
35
  fetcher.spec 'a', '2.a'
@@ -51,6 +53,8 @@ Gem dep_x-1
51
53
 
52
54
  Gem pl-1-x86-linux
53
55
 
56
+ Gem x-2
57
+
54
58
  EOF
55
59
 
56
60
  assert_equal expected, @ui.output
@@ -71,9 +75,11 @@ Gem pl-1-x86-linux
71
75
  end
72
76
 
73
77
  def test_execute_pipe_format
74
- util_spec 'foo' do |gem|
78
+ spec = util_spec 'foo' do |gem|
75
79
  gem.add_dependency 'bar', '> 1'
76
80
  end
81
+ install_specs util_spec 'bar', 2
82
+ install_specs spec
77
83
 
78
84
  @cmd.options[:args] = %w[foo]
79
85
  @cmd.options[:pipe_format] = true
@@ -164,6 +170,8 @@ ERROR: Only reverse dependencies for local gems are supported.
164
170
  end
165
171
 
166
172
  def test_execute_remote
173
+ install_specs new_spec 'bar', '2'
174
+
167
175
  spec_fetcher do |fetcher|
168
176
  fetcher.spec 'foo', 2, 'bar' => '> 1'
169
177
  end
@@ -1,5 +1,6 @@
1
1
  require 'rubygems/test_case'
2
2
  require 'rubygems/commands/install_command'
3
+ require 'rubygems/request_set'
3
4
  require 'rubygems/rdoc'
4
5
 
5
6
  class TestGemCommandsInstallCommand < Gem::TestCase
@@ -251,8 +252,7 @@ ERROR: Possible alternatives: non_existent_with_hint
251
252
  correctly_spelled = "nonexistent-with_hint"
252
253
 
253
254
  spec_fetcher do |fetcher|
254
- fetcher.spec correctly_spelled, 2
255
- fetcher.clear
255
+ fetcher.download correctly_spelled, 2
256
256
  end
257
257
 
258
258
  @cmd.options[:args] = [misspelled]
@@ -310,9 +310,8 @@ ERROR: Possible alternatives: non_existent_with_hint
310
310
 
311
311
  def test_execute_prerelease_wins_over_previous_ver
312
312
  spec_fetcher do |fetcher|
313
- fetcher.gem 'a', 1
314
- fetcher.gem 'a', '2.a'
315
- fetcher.clear
313
+ fetcher.download 'a', 1
314
+ fetcher.download 'a', '2.a'
316
315
  end
317
316
 
318
317
  @cmd.options[:prerelease] = true
@@ -535,9 +534,7 @@ ERROR: Possible alternatives: non_existent_with_hint
535
534
 
536
535
  def test_execute_conservative
537
536
  spec_fetcher do |fetcher|
538
- fetcher.gem 'b', 2
539
-
540
- fetcher.clear
537
+ fetcher.download 'b', 2
541
538
 
542
539
  fetcher.gem 'a', 2
543
540
  end
@@ -665,8 +662,7 @@ ERROR: Possible alternatives: non_existent_with_hint
665
662
 
666
663
  def test_show_source_problems_even_on_success
667
664
  spec_fetcher do |fetcher|
668
- fetcher.gem 'a', 2
669
- fetcher.clear
665
+ fetcher.download 'a', 2
670
666
  end
671
667
 
672
668
  Gem.sources << "http://nonexistent.example"
@@ -738,8 +734,7 @@ ERROR: Possible alternatives: non_existent_with_hint
738
734
 
739
735
  def test_execute_installs_from_a_gemdeps_with_conservative
740
736
  spec_fetcher do |fetcher|
741
- fetcher.gem 'a', 2
742
- fetcher.clear
737
+ fetcher.download 'a', 2
743
738
  fetcher.gem 'a', 1
744
739
  end
745
740
 
@@ -763,8 +758,7 @@ ERROR: Possible alternatives: non_existent_with_hint
763
758
 
764
759
  def test_execute_installs_from_a_gemdeps
765
760
  spec_fetcher do |fetcher|
766
- fetcher.gem 'a', 2
767
- fetcher.clear
761
+ fetcher.download 'a', 2
768
762
  end
769
763
 
770
764
  File.open @gemdeps, "w" do |f|
@@ -786,9 +780,8 @@ ERROR: Possible alternatives: non_existent_with_hint
786
780
 
787
781
  def test_execute_installs_deps_a_gemdeps
788
782
  spec_fetcher do |fetcher|
789
- fetcher.gem 'q', '1.0'
790
- fetcher.gem 'r', '2.0', 'q' => nil
791
- fetcher.clear
783
+ fetcher.download 'q', '1.0'
784
+ fetcher.download 'r', '2.0', 'q' => nil
792
785
  end
793
786
 
794
787
  File.open @gemdeps, "w" do |f|
@@ -813,9 +806,7 @@ ERROR: Possible alternatives: non_existent_with_hint
813
806
 
814
807
  def test_execute_uses_deps_a_gemdeps
815
808
  spec_fetcher do |fetcher|
816
- fetcher.gem 'r', '2.0', 'q' => nil
817
-
818
- fetcher.clear
809
+ fetcher.download 'r', '2.0', 'q' => nil
819
810
 
820
811
  fetcher.spec 'q', '1.0'
821
812
  end
@@ -842,9 +833,8 @@ ERROR: Possible alternatives: non_existent_with_hint
842
833
 
843
834
  def test_execute_installs_deps_a_gemdeps_into_a_path
844
835
  spec_fetcher do |fetcher|
845
- fetcher.gem 'q', '1.0'
846
- fetcher.gem 'r', '2.0', 'q' => nil
847
- fetcher.clear
836
+ fetcher.download 'q', '1.0'
837
+ fetcher.download 'r', '2.0', 'q' => nil
848
838
  end
849
839
 
850
840
  File.open @gemdeps, "w" do |f|
@@ -873,12 +863,11 @@ ERROR: Possible alternatives: non_existent_with_hint
873
863
 
874
864
  def test_execute_with_gemdeps_path_ignores_system
875
865
  specs = spec_fetcher do |fetcher|
876
- fetcher.gem 'q', '1.0'
877
- fetcher.gem 'r', '2.0', 'q' => nil
878
- fetcher.clear
866
+ fetcher.download 'q', '1.0'
867
+ fetcher.download 'r', '2.0', 'q' => nil
879
868
  end
880
869
 
881
- Gem::Specification.add_specs specs['q-1.0']
870
+ install_specs specs['q-1.0']
882
871
 
883
872
  File.open @gemdeps, "w" do |f|
884
873
  f << "gem 'r'"
@@ -910,7 +899,7 @@ ERROR: Possible alternatives: non_existent_with_hint
910
899
  fetcher.gem 'r', '2.0', 'q' => nil
911
900
  end
912
901
 
913
- i = Gem::Installer.new specs['q-1.0'].cache_file, :install_dir => "gf-path"
902
+ i = Gem::Installer.at specs['q-1.0'].cache_file, :install_dir => "gf-path"
914
903
  i.install
915
904
 
916
905
  assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
@@ -2,23 +2,10 @@ require 'rubygems/test_case'
2
2
  require 'rubygems/commands/mirror_command'
3
3
 
4
4
  class TestGemCommandsMirrorCommand < Gem::TestCase
5
-
6
5
  def setup
7
6
  super
8
7
 
9
8
  @cmd = Gem::Commands::MirrorCommand.new
10
-
11
- @mirror_specs = Gem::Specification.find_all_by_name('rubygems-mirror').each do |spec|
12
- Gem::Specification.remove_spec spec
13
- end
14
- end
15
-
16
- def teardown
17
- @mirror_specs.each do |spec|
18
- Gem::Specification.add_spec spec
19
- end
20
-
21
- super
22
9
  end
23
10
 
24
11
  def test_execute