rubygems-update 1.6.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.autotest +0 -1
- data/History.txt +70 -4
- data/README.rdoc +3 -0
- data/Rakefile +76 -0
- data/lib/rubygems.rb +57 -27
- data/lib/rubygems/command.rb +6 -4
- data/lib/rubygems/commands/contents_command.rb +14 -11
- data/lib/rubygems/commands/fetch_command.rb +6 -3
- data/lib/rubygems/commands/outdated_command.rb +2 -1
- data/lib/rubygems/commands/pristine_command.rb +4 -3
- data/lib/rubygems/commands/unpack_command.rb +46 -4
- data/lib/rubygems/commands/update_command.rb +24 -10
- data/lib/rubygems/custom_require.rb +1 -2
- data/lib/rubygems/dependency_installer.rb +1 -1
- data/lib/rubygems/ext/rake_builder.rb +1 -1
- data/lib/rubygems/gem_runner.rb +1 -0
- data/lib/rubygems/mock_gem_ui.rb +2 -1
- data/lib/rubygems/package/tar_input.rb +1 -0
- data/lib/rubygems/remote_fetcher.rb +62 -39
- data/lib/rubygems/server.rb +1 -1
- data/lib/rubygems/source_index.rb +64 -43
- data/lib/rubygems/spec_fetcher.rb +5 -6
- data/lib/rubygems/specification.rb +375 -402
- data/lib/rubygems/test_case.rb +7 -8
- data/lib/rubygems/uninstaller.rb +2 -2
- data/lib/rubygems/user_interaction.rb +27 -31
- data/test/rubygems/test_gem.rb +2 -44
- data/test/rubygems/test_gem_commands_contents_command.rb +19 -30
- data/test/rubygems/test_gem_commands_unpack_command.rb +24 -0
- data/test/rubygems/test_gem_commands_update_command.rb +26 -1
- data/test/rubygems/test_gem_dependency_installer.rb +9 -5
- data/test/rubygems/test_gem_dependency_list.rb +2 -6
- data/test/rubygems/test_gem_gem_runner.rb +1 -4
- data/test/rubygems/test_gem_installer.rb +1 -2
- data/test/rubygems/test_gem_remote_fetcher.rb +131 -24
- data/test/rubygems/test_gem_source_index.rb +7 -192
- data/test/rubygems/test_gem_specification.rb +132 -103
- metadata +9 -9
- metadata.gz.sig +0 -0
data/lib/rubygems/test_case.rb
CHANGED
@@ -310,7 +310,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
310
310
|
s.author = 'A User'
|
311
311
|
s.email = 'example@example.com'
|
312
312
|
s.homepage = 'http://example.com'
|
313
|
-
s.has_rdoc = true
|
314
313
|
s.summary = "this is a summary"
|
315
314
|
s.description = "This is a test description"
|
316
315
|
|
@@ -319,12 +318,12 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
319
318
|
|
320
319
|
path = File.join "specifications", spec.spec_name
|
321
320
|
written_path = write_file path do |io|
|
322
|
-
io.write
|
321
|
+
io.write spec.to_ruby_for_cache
|
323
322
|
end
|
324
323
|
|
325
|
-
spec.loaded_from = written_path
|
324
|
+
spec.loaded_from = spec.loaded_from = written_path
|
326
325
|
|
327
|
-
Gem.source_index.add_spec spec
|
326
|
+
Gem.source_index.add_spec spec.for_cache
|
328
327
|
|
329
328
|
return spec
|
330
329
|
end
|
@@ -339,14 +338,14 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
339
338
|
s.author = 'A User'
|
340
339
|
s.email = 'example@example.com'
|
341
340
|
s.homepage = 'http://example.com'
|
342
|
-
s.has_rdoc = true
|
343
341
|
s.summary = "this is a summary"
|
344
342
|
s.description = "This is a test description"
|
345
343
|
|
346
344
|
yield(s) if block_given?
|
347
345
|
end
|
348
346
|
|
349
|
-
|
347
|
+
path = File.join @gemhome, "specifications", spec.spec_name
|
348
|
+
spec.loaded_from = path
|
350
349
|
|
351
350
|
Gem.source_index.add_spec spec
|
352
351
|
|
@@ -605,8 +604,8 @@ Also, a list:
|
|
605
604
|
# Best used with +@all_gems+ from #util_setup_fake_fetcher.
|
606
605
|
|
607
606
|
def util_setup_spec_fetcher(*specs)
|
608
|
-
|
609
|
-
si
|
607
|
+
si = Gem::SourceIndex.new
|
608
|
+
si.add_specs(*specs)
|
610
609
|
|
611
610
|
spec_fetcher = Gem::SpecFetcher.fetcher
|
612
611
|
|
data/lib/rubygems/uninstaller.rb
CHANGED
@@ -57,11 +57,11 @@ class Gem::Uninstaller
|
|
57
57
|
@user_install = options[:user_install] unless options[:install_dir]
|
58
58
|
|
59
59
|
spec_dir = File.join @gem_home, 'specifications'
|
60
|
-
@source_index = Gem::SourceIndex.
|
60
|
+
@source_index = Gem::SourceIndex.new [spec_dir]
|
61
61
|
|
62
62
|
if @user_install then
|
63
63
|
user_dir = File.join Gem.user_dir, 'specifications'
|
64
|
-
@user_index = Gem::SourceIndex.
|
64
|
+
@user_index = Gem::SourceIndex.new [user_dir]
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -84,44 +84,40 @@ module Gem::UserInteraction
|
|
84
84
|
|
85
85
|
include Gem::DefaultUserInteraction
|
86
86
|
|
87
|
-
|
88
|
-
|
87
|
+
def alert(*args)
|
88
|
+
ui.alert(*args)
|
89
|
+
end
|
89
90
|
|
90
|
-
|
91
|
-
|
91
|
+
def alert_error(*args)
|
92
|
+
ui.alert_error(*args)
|
93
|
+
end
|
92
94
|
|
93
|
-
|
94
|
-
|
95
|
+
def alert_warning(*args)
|
96
|
+
ui.alert_warning(*args)
|
97
|
+
end
|
95
98
|
|
96
|
-
|
97
|
-
|
99
|
+
def ask(*args)
|
100
|
+
ui.ask(*args)
|
101
|
+
end
|
98
102
|
|
99
|
-
|
100
|
-
|
103
|
+
def ask_for_password(*args)
|
104
|
+
ui.ask_for_password(*args)
|
105
|
+
end
|
101
106
|
|
102
|
-
|
103
|
-
|
107
|
+
def ask_yes_no(*args)
|
108
|
+
ui.ask_yes_no(*args)
|
109
|
+
end
|
104
110
|
|
105
|
-
|
106
|
-
|
111
|
+
def choose_from_list(*args)
|
112
|
+
ui.choose_from_list(*args)
|
113
|
+
end
|
107
114
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
:ask,
|
115
|
-
:ask_for_password,
|
116
|
-
:ask_yes_no,
|
117
|
-
:choose_from_list,
|
118
|
-
:say,
|
119
|
-
:terminate_interaction ].each do |methname|
|
120
|
-
class_eval %{
|
121
|
-
def #{methname}(*args)
|
122
|
-
ui.#{methname}(*args)
|
123
|
-
end
|
124
|
-
}, __FILE__, __LINE__
|
115
|
+
def say(*args)
|
116
|
+
ui.say(*args)
|
117
|
+
end
|
118
|
+
|
119
|
+
def terminate_interaction(*args)
|
120
|
+
ui.terminate_interaction(*args)
|
125
121
|
end
|
126
122
|
end
|
127
123
|
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -406,22 +406,6 @@ class TestGem < Gem::TestCase
|
|
406
406
|
assert_activate %w[d-1 e-1], e1, "d"
|
407
407
|
end
|
408
408
|
|
409
|
-
def test_self_all_load_paths
|
410
|
-
util_make_gems
|
411
|
-
|
412
|
-
expected = [
|
413
|
-
File.join(@gemhome, *%W[gems #{@a1.full_name} lib]),
|
414
|
-
File.join(@gemhome, *%W[gems #{@a2.full_name} lib]),
|
415
|
-
File.join(@gemhome, *%W[gems #{@a3a.full_name} lib]),
|
416
|
-
File.join(@gemhome, *%W[gems #{@a_evil9.full_name} lib]),
|
417
|
-
File.join(@gemhome, *%W[gems #{@b2.full_name} lib]),
|
418
|
-
File.join(@gemhome, *%W[gems #{@c1_2.full_name} lib]),
|
419
|
-
File.join(@gemhome, *%W[gems #{@pl1.full_name} lib]),
|
420
|
-
]
|
421
|
-
|
422
|
-
assert_equal expected, Gem.all_load_paths.sort
|
423
|
-
end
|
424
|
-
|
425
409
|
def test_self_available?
|
426
410
|
util_make_gems
|
427
411
|
assert(Gem.available?("a"))
|
@@ -440,16 +424,6 @@ class TestGem < Gem::TestCase
|
|
440
424
|
assert_equal @abin_path, Gem.bin_path('a', 'abin', '4')
|
441
425
|
end
|
442
426
|
|
443
|
-
def test_self_bin_path_name
|
444
|
-
util_exec_gem
|
445
|
-
assert_equal @exec_path, Gem.bin_path('a')
|
446
|
-
end
|
447
|
-
|
448
|
-
def test_self_bin_path_name_version
|
449
|
-
util_exec_gem
|
450
|
-
assert_equal @exec_path, Gem.bin_path('a', nil, '4')
|
451
|
-
end
|
452
|
-
|
453
427
|
def test_self_bin_path_nonexistent_binfile
|
454
428
|
quick_spec 'a', '2' do |s|
|
455
429
|
s.executables = ['exec']
|
@@ -461,14 +435,14 @@ class TestGem < Gem::TestCase
|
|
461
435
|
|
462
436
|
def test_self_bin_path_no_bin_file
|
463
437
|
quick_spec 'a', '1'
|
464
|
-
assert_raises(
|
438
|
+
assert_raises(ArgumentError) do
|
465
439
|
Gem.bin_path('a', nil, '1')
|
466
440
|
end
|
467
441
|
end
|
468
442
|
|
469
443
|
def test_self_bin_path_not_found
|
470
444
|
assert_raises(Gem::GemNotFoundException) do
|
471
|
-
Gem.bin_path('non-existent')
|
445
|
+
Gem.bin_path('non-existent', 'blah')
|
472
446
|
end
|
473
447
|
end
|
474
448
|
|
@@ -476,7 +450,6 @@ class TestGem < Gem::TestCase
|
|
476
450
|
util_exec_gem
|
477
451
|
quick_spec 'a', '10' do |s|
|
478
452
|
s.executables = []
|
479
|
-
s.default_executable = nil
|
480
453
|
end
|
481
454
|
# Should not find a-10's non-abin (bug)
|
482
455
|
assert_equal @abin_path, Gem.bin_path('a', 'abin')
|
@@ -692,20 +665,6 @@ class TestGem < Gem::TestCase
|
|
692
665
|
assert_equal cwd, $LOAD_PATH.shift
|
693
666
|
end
|
694
667
|
|
695
|
-
def test_self_latest_load_paths
|
696
|
-
util_make_gems
|
697
|
-
|
698
|
-
expected = [
|
699
|
-
File.join(@gemhome, *%W[gems #{@a3a.full_name} lib]),
|
700
|
-
File.join(@gemhome, *%W[gems #{@a_evil9.full_name} lib]),
|
701
|
-
File.join(@gemhome, *%W[gems #{@b2.full_name} lib]),
|
702
|
-
File.join(@gemhome, *%W[gems #{@c1_2.full_name} lib]),
|
703
|
-
File.join(@gemhome, *%W[gems #{@pl1.full_name} lib]),
|
704
|
-
]
|
705
|
-
|
706
|
-
assert_equal expected, Gem.latest_load_paths.sort
|
707
|
-
end
|
708
|
-
|
709
668
|
def test_self_loaded_specs
|
710
669
|
foo = quick_spec 'foo'
|
711
670
|
install_gem foo
|
@@ -1115,7 +1074,6 @@ class TestGem < Gem::TestCase
|
|
1115
1074
|
|
1116
1075
|
def util_exec_gem
|
1117
1076
|
spec, _ = quick_spec 'a', '4' do |s|
|
1118
|
-
s.default_executable = 'exec'
|
1119
1077
|
s.executables = ['exec', 'abin']
|
1120
1078
|
end
|
1121
1079
|
|
@@ -9,11 +9,18 @@ class TestGemCommandsContentsCommand < Gem::TestCase
|
|
9
9
|
@cmd = Gem::Commands::ContentsCommand.new
|
10
10
|
end
|
11
11
|
|
12
|
+
def gem name
|
13
|
+
spec = quick_gem name do |gem|
|
14
|
+
gem.files = %W[lib/#{name}.rb Rakefile]
|
15
|
+
end
|
16
|
+
write_file File.join(*%W[gems #{spec.full_name} lib #{name}.rb])
|
17
|
+
write_file File.join(*%W[gems #{spec.full_name} Rakefile])
|
18
|
+
end
|
19
|
+
|
12
20
|
def test_execute
|
13
21
|
@cmd.options[:args] = %w[foo]
|
14
|
-
|
15
|
-
|
16
|
-
end
|
22
|
+
|
23
|
+
gem 'foo'
|
17
24
|
|
18
25
|
use_ui @ui do
|
19
26
|
@cmd.execute
|
@@ -27,13 +34,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase
|
|
27
34
|
def test_execute_all
|
28
35
|
@cmd.options[:all] = true
|
29
36
|
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
quick_gem 'bar' do |gem|
|
35
|
-
gem.files = %w[lib/bar.rb Rakefile]
|
36
|
-
end
|
37
|
+
gem 'foo'
|
38
|
+
gem 'bar'
|
37
39
|
|
38
40
|
use_ui @ui do
|
39
41
|
@cmd.execute
|
@@ -61,13 +63,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase
|
|
61
63
|
|
62
64
|
def test_execute_exact_match
|
63
65
|
@cmd.options[:args] = %w[foo]
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
quick_gem 'foo_bar' do |gem|
|
69
|
-
gem.files = %w[lib/foo_bar.rb Rakefile]
|
70
|
-
end
|
66
|
+
gem 'foo'
|
67
|
+
gem 'bar'
|
71
68
|
|
72
69
|
use_ui @ui do
|
73
70
|
@cmd.execute
|
@@ -82,9 +79,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
|
|
82
79
|
@cmd.options[:args] = %w[foo]
|
83
80
|
@cmd.options[:lib_only] = true
|
84
81
|
|
85
|
-
|
86
|
-
gem.files = %w[lib/foo.rb Rakefile]
|
87
|
-
end
|
82
|
+
gem 'foo'
|
88
83
|
|
89
84
|
use_ui @ui do
|
90
85
|
@cmd.execute
|
@@ -98,13 +93,9 @@ class TestGemCommandsContentsCommand < Gem::TestCase
|
|
98
93
|
|
99
94
|
def test_execute_multiple
|
100
95
|
@cmd.options[:args] = %w[foo bar]
|
101
|
-
quick_gem 'foo' do |gem|
|
102
|
-
gem.files = %w[lib/foo.rb Rakefile]
|
103
|
-
end
|
104
96
|
|
105
|
-
|
106
|
-
|
107
|
-
end
|
97
|
+
gem 'foo'
|
98
|
+
gem 'bar'
|
108
99
|
|
109
100
|
use_ui @ui do
|
110
101
|
@cmd.execute
|
@@ -120,17 +111,15 @@ class TestGemCommandsContentsCommand < Gem::TestCase
|
|
120
111
|
@cmd.options[:args] = %w[foo]
|
121
112
|
@cmd.options[:prefix] = false
|
122
113
|
|
123
|
-
|
124
|
-
gem.files = %w[lib/foo.rb Rakefile]
|
125
|
-
end
|
114
|
+
gem 'foo'
|
126
115
|
|
127
116
|
use_ui @ui do
|
128
117
|
@cmd.execute
|
129
118
|
end
|
130
119
|
|
131
120
|
expected = <<-EOF
|
132
|
-
lib/foo.rb
|
133
121
|
Rakefile
|
122
|
+
lib/foo.rb
|
134
123
|
EOF
|
135
124
|
|
136
125
|
assert_equal expected, @ui.output
|
@@ -136,6 +136,22 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
|
|
136
136
|
assert File.exist?(File.join(@tempdir, 'a-2')), 'a should be unpacked'
|
137
137
|
end
|
138
138
|
|
139
|
+
def test_execute_spec
|
140
|
+
util_make_gems
|
141
|
+
|
142
|
+
@cmd.options[:args] = %w[a b]
|
143
|
+
@cmd.options[:spec] = true
|
144
|
+
|
145
|
+
use_ui @ui do
|
146
|
+
Dir.chdir @tempdir do
|
147
|
+
@cmd.execute
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
assert File.exist?(File.join(@tempdir, 'a-3.a.gemspec'))
|
152
|
+
assert File.exist?(File.join(@tempdir, 'b-2.gemspec'))
|
153
|
+
end
|
154
|
+
|
139
155
|
def test_execute_sudo
|
140
156
|
util_make_gems
|
141
157
|
|
@@ -197,5 +213,13 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
|
|
197
213
|
assert File.exist?(File.join(@tempdir, foo_spec.full_name))
|
198
214
|
end
|
199
215
|
|
216
|
+
def test_handle_options_metadata
|
217
|
+
refute @cmd.options[:spec]
|
218
|
+
|
219
|
+
@cmd.send :handle_options, %w[--spec a]
|
220
|
+
|
221
|
+
assert @cmd.options[:spec]
|
222
|
+
end
|
223
|
+
|
200
224
|
end
|
201
225
|
|
@@ -117,7 +117,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
|
|
117
117
|
@cmd.options[:generate_rdoc] = false
|
118
118
|
@cmd.options[:generate_ri] = false
|
119
119
|
|
120
|
-
assert_raises Gem::SystemExitException do
|
120
|
+
assert_raises Gem::MockGemUi::SystemExitException do
|
121
121
|
use_ui @ui do
|
122
122
|
@cmd.execute
|
123
123
|
end
|
@@ -178,6 +178,31 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
|
|
178
178
|
assert_empty out
|
179
179
|
end
|
180
180
|
|
181
|
+
def test_execute_system_specifically_to_latest_version
|
182
|
+
util_clear_gems
|
183
|
+
util_setup_rubygem9
|
184
|
+
util_setup_rubygem8
|
185
|
+
util_setup_spec_fetcher @rubygem8, @rubygem9
|
186
|
+
util_add_to_fetcher @rubygem8, @rubygem9
|
187
|
+
|
188
|
+
@cmd.options[:args] = []
|
189
|
+
@cmd.options[:system] = "9"
|
190
|
+
@cmd.options[:generate_rdoc] = false
|
191
|
+
@cmd.options[:generate_ri] = false
|
192
|
+
|
193
|
+
use_ui @ui do
|
194
|
+
@cmd.execute
|
195
|
+
end
|
196
|
+
|
197
|
+
out = @ui.output.split "\n"
|
198
|
+
assert_equal "Updating rubygems-update", out.shift
|
199
|
+
assert_equal "Successfully installed rubygems-update-9", out.shift
|
200
|
+
assert_equal "Installing RubyGems 9", out.shift
|
201
|
+
assert_equal "RubyGems system software updated", out.shift
|
202
|
+
|
203
|
+
assert_empty out
|
204
|
+
end
|
205
|
+
|
181
206
|
def test_execute_system_with_gems
|
182
207
|
@cmd.options[:args] = %w[gem]
|
183
208
|
@cmd.options[:system] = true
|
@@ -33,8 +33,10 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
33
33
|
inst.install 'a'
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
si = Gem::SourceIndex.new
|
37
|
+
si.add_spec @a1
|
38
|
+
|
39
|
+
assert_equal Gem.source_index, si
|
38
40
|
|
39
41
|
assert_equal [@a1], inst.installed_gems
|
40
42
|
end
|
@@ -103,7 +105,7 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
103
105
|
inst.install 'b'
|
104
106
|
end
|
105
107
|
|
106
|
-
installed = Gem
|
108
|
+
installed = Gem.source_index.map { |n,s| s.full_name }
|
107
109
|
|
108
110
|
assert_equal %w[a-2 b-1], installed.sort
|
109
111
|
|
@@ -396,8 +398,10 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
396
398
|
inst.install 'a'
|
397
399
|
end
|
398
400
|
|
399
|
-
|
400
|
-
|
401
|
+
si = Gem::SourceIndex.new
|
402
|
+
si.add_spec @a1
|
403
|
+
|
404
|
+
assert_equal Gem.source_index, si
|
401
405
|
|
402
406
|
assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
|
403
407
|
end
|
@@ -22,12 +22,8 @@ class TestGemDependencyList < Gem::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_self_from_source_index
|
25
|
-
|
26
|
-
|
27
|
-
'b-2' => @b2,
|
28
|
-
}
|
29
|
-
|
30
|
-
si = Gem::SourceIndex.new hash
|
25
|
+
si = Gem::SourceIndex.new
|
26
|
+
si.add_specs @a1, @b2
|
31
27
|
deps = Gem::DependencyList.from_source_index si
|
32
28
|
|
33
29
|
assert_equal %w[b-2 a-1], deps.dependency_order.map { |s| s.full_name }
|