rubygems-update 1.1.1 → 1.2.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.
- data.tar.gz.sig +0 -0
- data/ChangeLog +267 -1
- data/Rakefile +13 -7
- data/doc/release_notes/rel_1_2_0.rdoc +105 -0
- data/lib/rubygems.rb +82 -14
- data/lib/rubygems/command.rb +1 -1
- data/lib/rubygems/command_manager.rb +3 -2
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/dependency_command.rb +57 -19
- data/lib/rubygems/commands/environment_command.rb +2 -0
- data/lib/rubygems/commands/fetch_command.rb +3 -1
- data/lib/rubygems/commands/install_command.rb +3 -3
- data/lib/rubygems/commands/list_command.rb +30 -28
- data/lib/rubygems/commands/lock_command.rb +1 -1
- data/lib/rubygems/commands/outdated_command.rb +5 -2
- data/lib/rubygems/commands/pristine_command.rb +3 -44
- data/lib/rubygems/commands/query_command.rb +80 -21
- data/lib/rubygems/commands/sources_command.rb +56 -28
- data/lib/rubygems/commands/specification_command.rb +4 -3
- data/lib/rubygems/commands/stale_command.rb +27 -0
- data/lib/rubygems/commands/update_command.rb +35 -22
- data/lib/rubygems/config_file.rb +29 -12
- data/lib/rubygems/custom_require.rb +1 -1
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency.rb +63 -9
- data/lib/rubygems/dependency_installer.rb +60 -23
- data/lib/rubygems/dependency_list.rb +1 -1
- data/lib/rubygems/doc_manager.rb +5 -5
- data/lib/rubygems/gem_openssl.rb +1 -1
- data/lib/rubygems/indexer.rb +269 -84
- data/lib/rubygems/install_update_options.rb +6 -0
- data/lib/rubygems/installer.rb +35 -12
- data/lib/rubygems/local_remote_options.rb +26 -5
- data/lib/rubygems/platform.rb +15 -1
- data/lib/rubygems/remote_fetcher.rb +158 -90
- data/lib/rubygems/requirement.rb +16 -12
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/security.rb +2 -2
- data/lib/rubygems/server.rb +239 -110
- data/lib/rubygems/source_index.rb +44 -18
- data/lib/rubygems/source_info_cache.rb +1 -1
- data/lib/rubygems/spec_fetcher.rb +251 -0
- data/lib/rubygems/specification.rb +120 -38
- data/lib/rubygems/test_utilities.rb +120 -0
- data/lib/rubygems/uninstaller.rb +11 -10
- data/lib/rubygems/user_interaction.rb +149 -74
- data/lib/rubygems/validator.rb +3 -3
- data/lib/rubygems/version.rb +23 -21
- data/setup.rb +105 -100
- data/test/gemutilities.rb +63 -86
- data/test/test_config.rb +0 -5
- data/test/test_gem.rb +22 -2
- data/test/test_gem_command_manager.rb +1 -1
- data/test/test_gem_commands_dependency_command.rb +125 -6
- data/test/test_gem_commands_environment_command.rb +1 -0
- data/test/test_gem_commands_fetch_command.rb +24 -4
- data/test/test_gem_commands_install_command.rb +6 -8
- data/test/{test_gem_outdated_command.rb → test_gem_commands_outdated_command.rb} +5 -2
- data/test/test_gem_commands_pristine_command.rb +13 -4
- data/test/test_gem_commands_query_command.rb +113 -37
- data/test/test_gem_commands_sources_command.rb +101 -31
- data/test/test_gem_commands_specification_command.rb +4 -1
- data/test/test_gem_commands_stale_command.rb +39 -0
- data/test/test_gem_commands_update_command.rb +17 -27
- data/test/test_gem_config_file.rb +38 -1
- data/test/test_gem_dependency.rb +51 -0
- data/test/test_gem_dependency_installer.rb +133 -25
- data/test/test_gem_gem_path_searcher.rb +4 -1
- data/test/test_gem_indexer.rb +124 -19
- data/test/test_gem_installer.rb +32 -2
- data/test/test_gem_local_remote_options.rb +6 -5
- data/test/test_gem_remote_fetcher.rb +14 -9
- data/test/test_gem_server.rb +207 -21
- data/test/test_gem_source_index.rb +203 -63
- data/test/test_gem_source_info_cache.rb +8 -6
- data/test/test_gem_source_info_cache_entry.rb +11 -9
- data/test/test_gem_spec_fetcher.rb +303 -0
- data/test/test_gem_specification.rb +91 -7
- data/test/test_gem_uninstaller.rb +21 -0
- data/test/test_gem_version.rb +14 -5
- data/test/test_kernel.rb +1 -1
- metadata +10 -73
- metadata.gz.sig +0 -0
- data/lib/rubygems/indexer/abstract_index_builder.rb +0 -88
- data/lib/rubygems/indexer/latest_index_builder.rb +0 -35
- data/lib/rubygems/indexer/marshal_index_builder.rb +0 -17
- data/lib/rubygems/indexer/master_index_builder.rb +0 -54
- data/lib/rubygems/indexer/quick_index_builder.rb +0 -50
- data/test/gem_installer_test_case.rbc +0 -0
- data/test/gem_package_tar_test_case.rbc +0 -0
- data/test/gemutilities.rbc +0 -0
- data/test/mockgemui.rbc +0 -0
- data/test/simple_gem.rbc +0 -0
- data/test/test_config.rbc +0 -0
- data/test/test_gem.rbc +0 -0
- data/test/test_gem_builder.rbc +0 -0
- data/test/test_gem_command.rbc +0 -0
- data/test/test_gem_command_manager.rbc +0 -0
- data/test/test_gem_commands_build_command.rbc +0 -0
- data/test/test_gem_commands_cert_command.rbc +0 -0
- data/test/test_gem_commands_check_command.rbc +0 -0
- data/test/test_gem_commands_contents_command.rbc +0 -0
- data/test/test_gem_commands_dependency_command.rbc +0 -0
- data/test/test_gem_commands_environment_command.rbc +0 -0
- data/test/test_gem_commands_fetch_command.rbc +0 -0
- data/test/test_gem_commands_generate_index_command.rbc +0 -0
- data/test/test_gem_commands_install_command.rbc +0 -0
- data/test/test_gem_commands_mirror_command.rbc +0 -0
- data/test/test_gem_commands_pristine_command.rbc +0 -0
- data/test/test_gem_commands_query_command.rbc +0 -0
- data/test/test_gem_commands_server_command.rbc +0 -0
- data/test/test_gem_commands_sources_command.rbc +0 -0
- data/test/test_gem_commands_specification_command.rbc +0 -0
- data/test/test_gem_commands_unpack_command.rbc +0 -0
- data/test/test_gem_commands_update_command.rbc +0 -0
- data/test/test_gem_config_file.rbc +0 -0
- data/test/test_gem_dependency.rbc +0 -0
- data/test/test_gem_dependency_installer.rbc +0 -0
- data/test/test_gem_dependency_list.rbc +0 -0
- data/test/test_gem_digest.rbc +0 -0
- data/test/test_gem_doc_manager.rbc +0 -0
- data/test/test_gem_ext_configure_builder.rbc +0 -0
- data/test/test_gem_ext_ext_conf_builder.rbc +0 -0
- data/test/test_gem_ext_rake_builder.rbc +0 -0
- data/test/test_gem_format.rbc +0 -0
- data/test/test_gem_gem_path_searcher.rbc +0 -0
- data/test/test_gem_gem_runner.rbc +0 -0
- data/test/test_gem_indexer.rbc +0 -0
- data/test/test_gem_install_update_options.rbc +0 -0
- data/test/test_gem_installer.rbc +0 -0
- data/test/test_gem_local_remote_options.rbc +0 -0
- data/test/test_gem_outdated_command.rbc +0 -0
- data/test/test_gem_package_tar_header.rbc +0 -0
- data/test/test_gem_package_tar_input.rbc +0 -0
- data/test/test_gem_package_tar_output.rbc +0 -0
- data/test/test_gem_package_tar_reader.rbc +0 -0
- data/test/test_gem_package_tar_reader_entry.rbc +0 -0
- data/test/test_gem_package_tar_writer.rbc +0 -0
- data/test/test_gem_platform.rbc +0 -0
- data/test/test_gem_remote_fetcher.rbc +0 -0
- data/test/test_gem_requirement.rbc +0 -0
- data/test/test_gem_server.rbc +0 -0
- data/test/test_gem_source_index.rbc +0 -0
- data/test/test_gem_source_info_cache.rbc +0 -0
- data/test/test_gem_source_info_cache_entry.rbc +0 -0
- data/test/test_gem_specification.rbc +0 -0
- data/test/test_gem_stream_ui.rbc +0 -0
- data/test/test_gem_uninstaller.rbc +0 -0
- data/test/test_gem_validator.rbc +0 -0
- data/test/test_gem_version.rbc +0 -0
- data/test/test_gem_version_option.rbc +0 -0
- data/test/test_kernel.rbc +0 -0
@@ -23,6 +23,136 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
23
23
|
util_setup_fake_fetcher
|
24
24
|
end
|
25
25
|
|
26
|
+
def test_self_from_gems_in
|
27
|
+
spec_dir = File.join @gemhome, 'specifications'
|
28
|
+
|
29
|
+
FileUtils.rm_r spec_dir
|
30
|
+
|
31
|
+
FileUtils.mkdir_p spec_dir
|
32
|
+
|
33
|
+
a1 = quick_gem 'a', '1' do |spec| spec.author = 'author 1' end
|
34
|
+
|
35
|
+
spec_file = File.join spec_dir, "#{a1.full_name}.gemspec"
|
36
|
+
|
37
|
+
File.open spec_file, 'w' do |fp|
|
38
|
+
fp.write a1.to_ruby
|
39
|
+
end
|
40
|
+
|
41
|
+
si = Gem::SourceIndex.from_gems_in spec_dir
|
42
|
+
|
43
|
+
assert_equal [spec_dir], si.spec_dirs
|
44
|
+
assert_equal [a1.full_name], si.gems.keys
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_self_load_specification
|
48
|
+
spec_dir = File.join @gemhome, 'specifications'
|
49
|
+
|
50
|
+
FileUtils.rm_r spec_dir
|
51
|
+
|
52
|
+
FileUtils.mkdir_p spec_dir
|
53
|
+
|
54
|
+
a1 = quick_gem 'a', '1' do |spec| spec.author = 'author 1' end
|
55
|
+
|
56
|
+
spec_file = File.join spec_dir, "#{a1.full_name}.gemspec"
|
57
|
+
|
58
|
+
File.open spec_file, 'w' do |fp|
|
59
|
+
fp.write a1.to_ruby
|
60
|
+
end
|
61
|
+
|
62
|
+
spec = Gem::SourceIndex.load_specification spec_file
|
63
|
+
|
64
|
+
assert_equal a1.author, spec.author
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_self_load_specification_exception
|
68
|
+
spec_dir = File.join @gemhome, 'specifications'
|
69
|
+
|
70
|
+
FileUtils.mkdir_p spec_dir
|
71
|
+
|
72
|
+
spec_file = File.join spec_dir, 'a-1.gemspec'
|
73
|
+
|
74
|
+
File.open spec_file, 'w' do |fp|
|
75
|
+
fp.write 'raise Exception, "epic fail"'
|
76
|
+
end
|
77
|
+
|
78
|
+
use_ui @ui do
|
79
|
+
assert_equal nil, Gem::SourceIndex.load_specification(spec_file)
|
80
|
+
end
|
81
|
+
|
82
|
+
assert_equal '', @ui.output
|
83
|
+
|
84
|
+
expected = <<-EOF
|
85
|
+
WARNING: #<Exception: epic fail>
|
86
|
+
raise Exception, "epic fail"
|
87
|
+
WARNING: Invalid .gemspec format in '#{spec_file}'
|
88
|
+
EOF
|
89
|
+
|
90
|
+
assert_equal expected, @ui.error
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_self_load_specification_interrupt
|
94
|
+
spec_dir = File.join @gemhome, 'specifications'
|
95
|
+
|
96
|
+
FileUtils.mkdir_p spec_dir
|
97
|
+
|
98
|
+
spec_file = File.join spec_dir, 'a-1.gemspec'
|
99
|
+
|
100
|
+
File.open spec_file, 'w' do |fp|
|
101
|
+
fp.write 'raise Interrupt, "^C"'
|
102
|
+
end
|
103
|
+
|
104
|
+
use_ui @ui do
|
105
|
+
assert_raise Interrupt do
|
106
|
+
Gem::SourceIndex.load_specification(spec_file)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
assert_equal '', @ui.output
|
111
|
+
assert_equal '', @ui.error
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_self_load_specification_syntax_error
|
115
|
+
spec_dir = File.join @gemhome, 'specifications'
|
116
|
+
|
117
|
+
FileUtils.mkdir_p spec_dir
|
118
|
+
|
119
|
+
spec_file = File.join spec_dir, 'a-1.gemspec'
|
120
|
+
|
121
|
+
File.open spec_file, 'w' do |fp|
|
122
|
+
fp.write '1 +'
|
123
|
+
end
|
124
|
+
|
125
|
+
use_ui @ui do
|
126
|
+
assert_equal nil, Gem::SourceIndex.load_specification(spec_file)
|
127
|
+
end
|
128
|
+
|
129
|
+
assert_equal '', @ui.output
|
130
|
+
|
131
|
+
assert_match(/syntax error/, @ui.error)
|
132
|
+
assert_match(/1 \+/, @ui.error)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_self_load_specification_system_exit
|
136
|
+
spec_dir = File.join @gemhome, 'specifications'
|
137
|
+
|
138
|
+
FileUtils.mkdir_p spec_dir
|
139
|
+
|
140
|
+
spec_file = File.join spec_dir, 'a-1.gemspec'
|
141
|
+
|
142
|
+
File.open spec_file, 'w' do |fp|
|
143
|
+
fp.write 'raise SystemExit, "bye-bye"'
|
144
|
+
end
|
145
|
+
|
146
|
+
use_ui @ui do
|
147
|
+
assert_raise SystemExit do
|
148
|
+
Gem::SourceIndex.load_specification(spec_file)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
assert_equal '', @ui.output
|
153
|
+
assert_equal '', @ui.error
|
154
|
+
end
|
155
|
+
|
26
156
|
def test_create_from_directory
|
27
157
|
# TODO
|
28
158
|
end
|
@@ -43,16 +173,16 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
43
173
|
|
44
174
|
paths = @fetcher.paths
|
45
175
|
|
46
|
-
assert_equal "#{@gem_repo}
|
176
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
47
177
|
|
48
178
|
assert paths.empty?, paths.join(', ')
|
49
179
|
end
|
50
180
|
|
51
181
|
def test_fetch_bulk_index_error
|
52
|
-
@fetcher.data["#{@gem_repo}
|
53
|
-
@fetcher.data["#{@gem_repo}
|
54
|
-
@fetcher.data["#{@gem_repo}
|
55
|
-
@fetcher.data["#{@gem_repo}
|
182
|
+
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}.Z"] = proc { raise SocketError }
|
183
|
+
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}"] = proc { raise SocketError }
|
184
|
+
@fetcher.data["#{@gem_repo}yaml.Z"] = proc { raise SocketError }
|
185
|
+
@fetcher.data["#{@gem_repo}yaml"] = proc { raise SocketError }
|
56
186
|
|
57
187
|
e = assert_raise Gem::RemoteSourceException do
|
58
188
|
use_ui @ui do
|
@@ -62,10 +192,10 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
62
192
|
|
63
193
|
paths = @fetcher.paths
|
64
194
|
|
65
|
-
assert_equal "#{@gem_repo}
|
66
|
-
assert_equal "#{@gem_repo}
|
67
|
-
assert_equal "#{@gem_repo}
|
68
|
-
assert_equal "#{@gem_repo}
|
195
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
196
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}", paths.shift
|
197
|
+
assert_equal "#{@gem_repo}yaml.Z", paths.shift
|
198
|
+
assert_equal "#{@gem_repo}yaml", paths.shift
|
69
199
|
|
70
200
|
assert paths.empty?, paths.join(', ')
|
71
201
|
|
@@ -74,12 +204,12 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
74
204
|
end
|
75
205
|
|
76
206
|
def test_fetch_bulk_index_fallback
|
77
|
-
@fetcher.data["#{@gem_repo}
|
207
|
+
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}.Z"] =
|
78
208
|
proc { raise SocketError }
|
79
|
-
@fetcher.data["#{@gem_repo}
|
209
|
+
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}"] =
|
80
210
|
proc { raise SocketError }
|
81
|
-
@fetcher.data["#{@gem_repo}
|
82
|
-
@fetcher.data["#{@gem_repo}
|
211
|
+
@fetcher.data["#{@gem_repo}yaml.Z"] = proc { raise SocketError }
|
212
|
+
@fetcher.data["#{@gem_repo}yaml"] = @source_index.to_yaml
|
83
213
|
|
84
214
|
use_ui @ui do
|
85
215
|
fetched_index = @source_index.fetch_bulk_index @uri
|
@@ -90,10 +220,10 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
90
220
|
|
91
221
|
paths = @fetcher.paths
|
92
222
|
|
93
|
-
assert_equal "#{@gem_repo}
|
94
|
-
assert_equal "#{@gem_repo}
|
95
|
-
assert_equal "#{@gem_repo}
|
96
|
-
assert_equal "#{@gem_repo}
|
223
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
224
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}", paths.shift
|
225
|
+
assert_equal "#{@gem_repo}yaml.Z", paths.shift
|
226
|
+
assert_equal "#{@gem_repo}yaml", paths.shift
|
97
227
|
|
98
228
|
assert paths.empty?, paths.join(', ')
|
99
229
|
end
|
@@ -102,8 +232,8 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
102
232
|
marshal = @source_index.dump
|
103
233
|
marshal[0] = (Marshal::MAJOR_VERSION - 1).chr
|
104
234
|
|
105
|
-
@fetcher.data["#{@gem_repo}
|
106
|
-
@fetcher.data["#{@gem_repo}
|
235
|
+
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}"] = marshal
|
236
|
+
@fetcher.data["#{@gem_repo}yaml"] = @source_index.to_yaml
|
107
237
|
|
108
238
|
use_ui @ui do
|
109
239
|
fetched_index = @source_index.fetch_bulk_index @uri
|
@@ -114,10 +244,10 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
114
244
|
|
115
245
|
paths = @fetcher.paths
|
116
246
|
|
117
|
-
assert_equal "#{@gem_repo}
|
118
|
-
assert_equal "#{@gem_repo}
|
119
|
-
assert_equal "#{@gem_repo}
|
120
|
-
assert_equal "#{@gem_repo}
|
247
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
248
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}", paths.shift
|
249
|
+
assert_equal "#{@gem_repo}yaml.Z", paths.shift
|
250
|
+
assert_equal "#{@gem_repo}yaml", paths.shift
|
121
251
|
|
122
252
|
assert paths.empty?, paths.join(', ')
|
123
253
|
end
|
@@ -133,8 +263,8 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
133
263
|
|
134
264
|
paths = @fetcher.paths
|
135
265
|
|
136
|
-
assert_equal "#{@gem_repo}
|
137
|
-
assert_equal "#{@gem_repo}
|
266
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
267
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}", paths.shift
|
138
268
|
|
139
269
|
assert paths.empty?, paths.join(', ')
|
140
270
|
end
|
@@ -143,8 +273,8 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
143
273
|
index = util_zip @gem_names
|
144
274
|
latest_index = util_zip [@a2.full_name, @b2.full_name].join("\n")
|
145
275
|
|
146
|
-
@fetcher.data["#{@gem_repo}
|
147
|
-
@fetcher.data["#{@gem_repo}
|
276
|
+
@fetcher.data["#{@gem_repo}quick/index.rz"] = index
|
277
|
+
@fetcher.data["#{@gem_repo}quick/latest_index.rz"] = latest_index
|
148
278
|
|
149
279
|
quick_index = @source_index.fetch_quick_index @uri, false
|
150
280
|
assert_equal [@a2.full_name, @b2.full_name].sort,
|
@@ -152,7 +282,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
152
282
|
|
153
283
|
paths = @fetcher.paths
|
154
284
|
|
155
|
-
assert_equal "#{@gem_repo}
|
285
|
+
assert_equal "#{@gem_repo}quick/latest_index.rz", paths.shift
|
156
286
|
|
157
287
|
assert paths.empty?, paths.join(', ')
|
158
288
|
end
|
@@ -161,8 +291,8 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
161
291
|
index = util_zip @gem_names
|
162
292
|
latest_index = util_zip [@a2.full_name, @b2.full_name].join("\n")
|
163
293
|
|
164
|
-
@fetcher.data["#{@gem_repo}
|
165
|
-
@fetcher.data["#{@gem_repo}
|
294
|
+
@fetcher.data["#{@gem_repo}quick/index.rz"] = index
|
295
|
+
@fetcher.data["#{@gem_repo}quick/latest_index.rz"] = latest_index
|
166
296
|
|
167
297
|
quick_index = @source_index.fetch_quick_index @uri, true
|
168
298
|
assert_equal [@a1.full_name, @a2.full_name, @b2.full_name].sort,
|
@@ -170,13 +300,13 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
170
300
|
|
171
301
|
paths = @fetcher.paths
|
172
302
|
|
173
|
-
assert_equal "#{@gem_repo}
|
303
|
+
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
174
304
|
|
175
305
|
assert paths.empty?, paths.join(', ')
|
176
306
|
end
|
177
307
|
|
178
308
|
def test_fetch_quick_index_error
|
179
|
-
@fetcher.data["#{@gem_repo}
|
309
|
+
@fetcher.data["#{@gem_repo}quick/index.rz"] =
|
180
310
|
proc { raise Exception }
|
181
311
|
|
182
312
|
e = assert_raise Gem::OperationNotSupportedError do
|
@@ -187,7 +317,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
187
317
|
|
188
318
|
paths = @fetcher.paths
|
189
319
|
|
190
|
-
assert_equal "#{@gem_repo}
|
320
|
+
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
191
321
|
|
192
322
|
assert paths.empty?, paths.join(', ')
|
193
323
|
end
|
@@ -195,22 +325,22 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
195
325
|
def test_fetch_quick_index_fallback
|
196
326
|
index = util_zip @gem_names
|
197
327
|
|
198
|
-
@fetcher.data["#{@gem_repo}
|
328
|
+
@fetcher.data["#{@gem_repo}quick/index.rz"] = index
|
199
329
|
|
200
330
|
quick_index = @source_index.fetch_quick_index @uri, false
|
201
331
|
assert_equal @gem_names.split, quick_index.sort
|
202
332
|
|
203
333
|
paths = @fetcher.paths
|
204
334
|
|
205
|
-
assert_equal "#{@gem_repo}
|
206
|
-
assert_equal "#{@gem_repo}
|
335
|
+
assert_equal "#{@gem_repo}quick/latest_index.rz", paths.shift
|
336
|
+
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
207
337
|
|
208
338
|
assert paths.empty?, paths.join(', ')
|
209
339
|
end
|
210
340
|
|
211
341
|
def test_fetch_quick_index_subdir
|
212
342
|
latest_index = util_zip [@a2.full_name, @b2.full_name].join("\n")
|
213
|
-
repo = URI.parse "#{@gem_repo}
|
343
|
+
repo = URI.parse "#{@gem_repo}~nobody/mirror/"
|
214
344
|
|
215
345
|
@fetcher.data["#{repo}quick/latest_index.rz"] = latest_index
|
216
346
|
|
@@ -226,7 +356,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
226
356
|
end
|
227
357
|
|
228
358
|
def test_fetch_single_spec
|
229
|
-
a1_spec_url = "#{@gem_repo}
|
359
|
+
a1_spec_url = "#{@gem_repo}quick/Marshal.#{Gem.marshal_version}/#{@a1.full_name}.gemspec.rz"
|
230
360
|
@fetcher.data[a1_spec_url] = util_zip Marshal.dump(@a1)
|
231
361
|
|
232
362
|
spec = @source_index.send :fetch_single_spec, URI.parse(@gem_repo),
|
@@ -242,7 +372,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
242
372
|
end
|
243
373
|
|
244
374
|
def test_fetch_single_spec_subdir
|
245
|
-
repo = URI.parse "#{@gem_repo}
|
375
|
+
repo = URI.parse "#{@gem_repo}~nobody/mirror/"
|
246
376
|
|
247
377
|
a1_spec_url = "#{repo}quick/Marshal.#{Gem.marshal_version}/#{@a1.full_name}.gemspec.rz"
|
248
378
|
@fetcher.data[a1_spec_url] = util_zip Marshal.dump(@a1)
|
@@ -259,7 +389,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
259
389
|
end
|
260
390
|
|
261
391
|
def test_fetch_single_spec_yaml
|
262
|
-
a1_spec_url = "#{@gem_repo}
|
392
|
+
a1_spec_url = "#{@gem_repo}quick/#{@a1.full_name}.gemspec.rz"
|
263
393
|
@fetcher.data[a1_spec_url] = util_zip @a1.to_yaml
|
264
394
|
|
265
395
|
repo = URI.parse @gem_repo
|
@@ -270,14 +400,14 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
270
400
|
|
271
401
|
paths = @fetcher.paths
|
272
402
|
|
273
|
-
assert_equal "#{@gem_repo}
|
403
|
+
assert_equal "#{@gem_repo}quick/Marshal.#{Gem.marshal_version}/#{@a1.full_name}.gemspec.rz", paths.shift
|
274
404
|
assert_equal a1_spec_url, paths.shift
|
275
405
|
|
276
406
|
assert paths.empty?, paths.join(', ')
|
277
407
|
end
|
278
408
|
|
279
409
|
def test_fetch_single_spec_yaml_subdir
|
280
|
-
repo = URI.parse "#{@gem_repo}
|
410
|
+
repo = URI.parse "#{@gem_repo}~nobody/mirror/"
|
281
411
|
|
282
412
|
a1_spec_url = "#{repo}quick/#{@a1.full_name}.gemspec.rz"
|
283
413
|
@fetcher.data[a1_spec_url] = util_zip @a1.to_yaml
|
@@ -377,12 +507,12 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
377
507
|
end
|
378
508
|
|
379
509
|
def test_outdated
|
380
|
-
|
510
|
+
util_setup_spec_fetcher
|
381
511
|
|
382
512
|
assert_equal [], @source_index.outdated
|
383
513
|
|
384
514
|
updated = quick_gem @a2.name, (@a2.version.bump)
|
385
|
-
|
515
|
+
util_setup_spec_fetcher updated
|
386
516
|
|
387
517
|
assert_equal [updated.name], @source_index.outdated
|
388
518
|
|
@@ -390,7 +520,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
390
520
|
s.platform = Gem::Platform.new 'x86-other_platform1'
|
391
521
|
end
|
392
522
|
|
393
|
-
|
523
|
+
util_setup_spec_fetcher updated, updated_platform
|
394
524
|
|
395
525
|
assert_equal [updated_platform.name], @source_index.outdated
|
396
526
|
end
|
@@ -411,6 +541,16 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
411
541
|
assert source_index.gems.include?(@a1.full_name)
|
412
542
|
end
|
413
543
|
|
544
|
+
def test_refresh_bang_not_from_dir
|
545
|
+
source_index = Gem::SourceIndex.new
|
546
|
+
|
547
|
+
e = assert_raise RuntimeError do
|
548
|
+
source_index.refresh!
|
549
|
+
end
|
550
|
+
|
551
|
+
assert_equal 'source index not created from disk', e.message
|
552
|
+
end
|
553
|
+
|
414
554
|
def test_remove_extra
|
415
555
|
@source_index.add_spec @a1
|
416
556
|
@source_index.add_spec @a2
|
@@ -516,8 +656,8 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
516
656
|
|
517
657
|
paths = @fetcher.paths
|
518
658
|
|
519
|
-
assert_equal "#{@gem_repo}
|
520
|
-
assert_equal "#{@gem_repo}
|
659
|
+
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
660
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
521
661
|
|
522
662
|
assert paths.empty?, paths.join(', ')
|
523
663
|
end
|
@@ -528,7 +668,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
528
668
|
|
529
669
|
latest_names = [@a2, @a_evil9, @b2, @c1_2].map { |s| s.full_name }
|
530
670
|
latest_index = util_zip latest_names.join("\n")
|
531
|
-
@fetcher.data["#{@gem_repo}
|
671
|
+
@fetcher.data["#{@gem_repo}quick/latest_index.rz"] = latest_index
|
532
672
|
|
533
673
|
marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
|
534
674
|
"#{@b2.full_name}.gemspec.rz"
|
@@ -541,7 +681,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
541
681
|
end
|
542
682
|
|
543
683
|
paths = @fetcher.paths
|
544
|
-
assert_equal "#{@gem_repo}
|
684
|
+
assert_equal "#{@gem_repo}quick/latest_index.rz", paths.shift
|
545
685
|
assert_equal marshal_uri, paths.shift
|
546
686
|
|
547
687
|
assert paths.empty?, paths.join(', ')
|
@@ -554,7 +694,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
554
694
|
Gem.configuration = Gem::ConfigFile.new([])
|
555
695
|
|
556
696
|
quick_index = util_zip @all_gem_names.join("\n")
|
557
|
-
@fetcher.data["#{@gem_repo}
|
697
|
+
@fetcher.data["#{@gem_repo}quick/index.rz"] = quick_index
|
558
698
|
|
559
699
|
marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
|
560
700
|
"#{@b2.full_name}.gemspec.rz"
|
@@ -567,7 +707,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
567
707
|
end
|
568
708
|
|
569
709
|
paths = @fetcher.paths
|
570
|
-
assert_equal "#{@gem_repo}
|
710
|
+
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
571
711
|
assert_equal marshal_uri, paths.shift
|
572
712
|
|
573
713
|
assert paths.empty?, paths.join(', ')
|
@@ -580,12 +720,12 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
580
720
|
Gem.configuration = Gem::ConfigFile.new([])
|
581
721
|
|
582
722
|
quick_index = util_zip @all_gem_names.join("\n")
|
583
|
-
@fetcher.data["#{@gem_repo}
|
723
|
+
@fetcher.data["#{@gem_repo}quick/index.rz"] = quick_index
|
584
724
|
|
585
725
|
marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
|
586
726
|
"#{@b2.full_name}.gemspec.rz"
|
587
727
|
|
588
|
-
yaml_uri = "#{@gem_repo}
|
728
|
+
yaml_uri = "#{@gem_repo}quick/#{@b2.full_name}.gemspec.rz"
|
589
729
|
@fetcher.data[yaml_uri] = util_zip @b2.to_yaml
|
590
730
|
|
591
731
|
use_ui @ui do
|
@@ -595,7 +735,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
595
735
|
end
|
596
736
|
|
597
737
|
paths = @fetcher.paths
|
598
|
-
assert_equal "#{@gem_repo}
|
738
|
+
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
599
739
|
assert_equal marshal_uri, paths.shift
|
600
740
|
assert_equal yaml_uri, paths.shift
|
601
741
|
|
@@ -609,7 +749,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
609
749
|
Gem.configuration = Gem::ConfigFile.new([])
|
610
750
|
|
611
751
|
quick_index = util_zip @all_gem_names.join("\n")
|
612
|
-
@fetcher.data["#{@gem_repo}
|
752
|
+
@fetcher.data["#{@gem_repo}quick/index.rz"] = quick_index
|
613
753
|
|
614
754
|
marshal_uri = File.join @gem_repo, "quick", "Marshal.#{@marshal_version}",
|
615
755
|
"#{@b2.full_name}.gemspec.rz"
|
@@ -617,7 +757,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
617
757
|
marshal_data[0] = (Marshal::MAJOR_VERSION - 1).chr
|
618
758
|
@fetcher.data[marshal_uri] = util_zip marshal_data
|
619
759
|
|
620
|
-
yaml_uri = "#{@gem_repo}
|
760
|
+
yaml_uri = "#{@gem_repo}quick/#{@b2.full_name}.gemspec.rz"
|
621
761
|
@fetcher.data[yaml_uri] = util_zip @b2.to_yaml
|
622
762
|
|
623
763
|
use_ui @ui do
|
@@ -627,7 +767,7 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
627
767
|
end
|
628
768
|
|
629
769
|
paths = @fetcher.paths
|
630
|
-
assert_equal "#{@gem_repo}
|
770
|
+
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
631
771
|
assert_equal marshal_uri, paths.shift
|
632
772
|
assert_equal yaml_uri, paths.shift
|
633
773
|
|
@@ -637,14 +777,14 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
637
777
|
end
|
638
778
|
|
639
779
|
def test_update_subdir
|
640
|
-
@gem_repo = @gem_repo +
|
780
|
+
@gem_repo = @gem_repo + 'subdir/'
|
641
781
|
|
642
782
|
util_setup_bulk_fetch true
|
643
783
|
|
644
784
|
@source_index.gems.replace({})
|
645
785
|
assert_equal [], @source_index.gems.keys.sort
|
646
786
|
|
647
|
-
uri = @uri.to_s +
|
787
|
+
uri = @uri.to_s + 'subdir/'
|
648
788
|
|
649
789
|
use_ui @ui do
|
650
790
|
@source_index.update uri, true
|
@@ -656,8 +796,8 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
656
796
|
|
657
797
|
paths = @fetcher.paths
|
658
798
|
|
659
|
-
assert_equal "#{@gem_repo}
|
660
|
-
assert_equal "#{@gem_repo}
|
799
|
+
assert_equal "#{@gem_repo}quick/index.rz", paths.shift
|
800
|
+
assert_equal "#{@gem_repo}Marshal.#{@marshal_version}.Z", paths.shift
|
661
801
|
|
662
802
|
assert paths.empty?, paths.join(', ')
|
663
803
|
end
|
@@ -684,9 +824,9 @@ class TestGemSourceIndex < RubyGemTestCase
|
|
684
824
|
source_index = @source_index.dump
|
685
825
|
|
686
826
|
if compressed then
|
687
|
-
@fetcher.data["#{@gem_repo}
|
827
|
+
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}.Z"] = util_zip source_index
|
688
828
|
else
|
689
|
-
@fetcher.data["#{@gem_repo}
|
829
|
+
@fetcher.data["#{@gem_repo}Marshal.#{@marshal_version}"] = source_index
|
690
830
|
end
|
691
831
|
end
|
692
832
|
|