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.

Files changed (152) hide show
  1. data.tar.gz.sig +0 -0
  2. data/ChangeLog +267 -1
  3. data/Rakefile +13 -7
  4. data/doc/release_notes/rel_1_2_0.rdoc +105 -0
  5. data/lib/rubygems.rb +82 -14
  6. data/lib/rubygems/command.rb +1 -1
  7. data/lib/rubygems/command_manager.rb +3 -2
  8. data/lib/rubygems/commands/cert_command.rb +1 -1
  9. data/lib/rubygems/commands/dependency_command.rb +57 -19
  10. data/lib/rubygems/commands/environment_command.rb +2 -0
  11. data/lib/rubygems/commands/fetch_command.rb +3 -1
  12. data/lib/rubygems/commands/install_command.rb +3 -3
  13. data/lib/rubygems/commands/list_command.rb +30 -28
  14. data/lib/rubygems/commands/lock_command.rb +1 -1
  15. data/lib/rubygems/commands/outdated_command.rb +5 -2
  16. data/lib/rubygems/commands/pristine_command.rb +3 -44
  17. data/lib/rubygems/commands/query_command.rb +80 -21
  18. data/lib/rubygems/commands/sources_command.rb +56 -28
  19. data/lib/rubygems/commands/specification_command.rb +4 -3
  20. data/lib/rubygems/commands/stale_command.rb +27 -0
  21. data/lib/rubygems/commands/update_command.rb +35 -22
  22. data/lib/rubygems/config_file.rb +29 -12
  23. data/lib/rubygems/custom_require.rb +1 -1
  24. data/lib/rubygems/defaults.rb +1 -1
  25. data/lib/rubygems/dependency.rb +63 -9
  26. data/lib/rubygems/dependency_installer.rb +60 -23
  27. data/lib/rubygems/dependency_list.rb +1 -1
  28. data/lib/rubygems/doc_manager.rb +5 -5
  29. data/lib/rubygems/gem_openssl.rb +1 -1
  30. data/lib/rubygems/indexer.rb +269 -84
  31. data/lib/rubygems/install_update_options.rb +6 -0
  32. data/lib/rubygems/installer.rb +35 -12
  33. data/lib/rubygems/local_remote_options.rb +26 -5
  34. data/lib/rubygems/platform.rb +15 -1
  35. data/lib/rubygems/remote_fetcher.rb +158 -90
  36. data/lib/rubygems/requirement.rb +16 -12
  37. data/lib/rubygems/rubygems_version.rb +1 -1
  38. data/lib/rubygems/security.rb +2 -2
  39. data/lib/rubygems/server.rb +239 -110
  40. data/lib/rubygems/source_index.rb +44 -18
  41. data/lib/rubygems/source_info_cache.rb +1 -1
  42. data/lib/rubygems/spec_fetcher.rb +251 -0
  43. data/lib/rubygems/specification.rb +120 -38
  44. data/lib/rubygems/test_utilities.rb +120 -0
  45. data/lib/rubygems/uninstaller.rb +11 -10
  46. data/lib/rubygems/user_interaction.rb +149 -74
  47. data/lib/rubygems/validator.rb +3 -3
  48. data/lib/rubygems/version.rb +23 -21
  49. data/setup.rb +105 -100
  50. data/test/gemutilities.rb +63 -86
  51. data/test/test_config.rb +0 -5
  52. data/test/test_gem.rb +22 -2
  53. data/test/test_gem_command_manager.rb +1 -1
  54. data/test/test_gem_commands_dependency_command.rb +125 -6
  55. data/test/test_gem_commands_environment_command.rb +1 -0
  56. data/test/test_gem_commands_fetch_command.rb +24 -4
  57. data/test/test_gem_commands_install_command.rb +6 -8
  58. data/test/{test_gem_outdated_command.rb → test_gem_commands_outdated_command.rb} +5 -2
  59. data/test/test_gem_commands_pristine_command.rb +13 -4
  60. data/test/test_gem_commands_query_command.rb +113 -37
  61. data/test/test_gem_commands_sources_command.rb +101 -31
  62. data/test/test_gem_commands_specification_command.rb +4 -1
  63. data/test/test_gem_commands_stale_command.rb +39 -0
  64. data/test/test_gem_commands_update_command.rb +17 -27
  65. data/test/test_gem_config_file.rb +38 -1
  66. data/test/test_gem_dependency.rb +51 -0
  67. data/test/test_gem_dependency_installer.rb +133 -25
  68. data/test/test_gem_gem_path_searcher.rb +4 -1
  69. data/test/test_gem_indexer.rb +124 -19
  70. data/test/test_gem_installer.rb +32 -2
  71. data/test/test_gem_local_remote_options.rb +6 -5
  72. data/test/test_gem_remote_fetcher.rb +14 -9
  73. data/test/test_gem_server.rb +207 -21
  74. data/test/test_gem_source_index.rb +203 -63
  75. data/test/test_gem_source_info_cache.rb +8 -6
  76. data/test/test_gem_source_info_cache_entry.rb +11 -9
  77. data/test/test_gem_spec_fetcher.rb +303 -0
  78. data/test/test_gem_specification.rb +91 -7
  79. data/test/test_gem_uninstaller.rb +21 -0
  80. data/test/test_gem_version.rb +14 -5
  81. data/test/test_kernel.rb +1 -1
  82. metadata +10 -73
  83. metadata.gz.sig +0 -0
  84. data/lib/rubygems/indexer/abstract_index_builder.rb +0 -88
  85. data/lib/rubygems/indexer/latest_index_builder.rb +0 -35
  86. data/lib/rubygems/indexer/marshal_index_builder.rb +0 -17
  87. data/lib/rubygems/indexer/master_index_builder.rb +0 -54
  88. data/lib/rubygems/indexer/quick_index_builder.rb +0 -50
  89. data/test/gem_installer_test_case.rbc +0 -0
  90. data/test/gem_package_tar_test_case.rbc +0 -0
  91. data/test/gemutilities.rbc +0 -0
  92. data/test/mockgemui.rbc +0 -0
  93. data/test/simple_gem.rbc +0 -0
  94. data/test/test_config.rbc +0 -0
  95. data/test/test_gem.rbc +0 -0
  96. data/test/test_gem_builder.rbc +0 -0
  97. data/test/test_gem_command.rbc +0 -0
  98. data/test/test_gem_command_manager.rbc +0 -0
  99. data/test/test_gem_commands_build_command.rbc +0 -0
  100. data/test/test_gem_commands_cert_command.rbc +0 -0
  101. data/test/test_gem_commands_check_command.rbc +0 -0
  102. data/test/test_gem_commands_contents_command.rbc +0 -0
  103. data/test/test_gem_commands_dependency_command.rbc +0 -0
  104. data/test/test_gem_commands_environment_command.rbc +0 -0
  105. data/test/test_gem_commands_fetch_command.rbc +0 -0
  106. data/test/test_gem_commands_generate_index_command.rbc +0 -0
  107. data/test/test_gem_commands_install_command.rbc +0 -0
  108. data/test/test_gem_commands_mirror_command.rbc +0 -0
  109. data/test/test_gem_commands_pristine_command.rbc +0 -0
  110. data/test/test_gem_commands_query_command.rbc +0 -0
  111. data/test/test_gem_commands_server_command.rbc +0 -0
  112. data/test/test_gem_commands_sources_command.rbc +0 -0
  113. data/test/test_gem_commands_specification_command.rbc +0 -0
  114. data/test/test_gem_commands_unpack_command.rbc +0 -0
  115. data/test/test_gem_commands_update_command.rbc +0 -0
  116. data/test/test_gem_config_file.rbc +0 -0
  117. data/test/test_gem_dependency.rbc +0 -0
  118. data/test/test_gem_dependency_installer.rbc +0 -0
  119. data/test/test_gem_dependency_list.rbc +0 -0
  120. data/test/test_gem_digest.rbc +0 -0
  121. data/test/test_gem_doc_manager.rbc +0 -0
  122. data/test/test_gem_ext_configure_builder.rbc +0 -0
  123. data/test/test_gem_ext_ext_conf_builder.rbc +0 -0
  124. data/test/test_gem_ext_rake_builder.rbc +0 -0
  125. data/test/test_gem_format.rbc +0 -0
  126. data/test/test_gem_gem_path_searcher.rbc +0 -0
  127. data/test/test_gem_gem_runner.rbc +0 -0
  128. data/test/test_gem_indexer.rbc +0 -0
  129. data/test/test_gem_install_update_options.rbc +0 -0
  130. data/test/test_gem_installer.rbc +0 -0
  131. data/test/test_gem_local_remote_options.rbc +0 -0
  132. data/test/test_gem_outdated_command.rbc +0 -0
  133. data/test/test_gem_package_tar_header.rbc +0 -0
  134. data/test/test_gem_package_tar_input.rbc +0 -0
  135. data/test/test_gem_package_tar_output.rbc +0 -0
  136. data/test/test_gem_package_tar_reader.rbc +0 -0
  137. data/test/test_gem_package_tar_reader_entry.rbc +0 -0
  138. data/test/test_gem_package_tar_writer.rbc +0 -0
  139. data/test/test_gem_platform.rbc +0 -0
  140. data/test/test_gem_remote_fetcher.rbc +0 -0
  141. data/test/test_gem_requirement.rbc +0 -0
  142. data/test/test_gem_server.rbc +0 -0
  143. data/test/test_gem_source_index.rbc +0 -0
  144. data/test/test_gem_source_info_cache.rbc +0 -0
  145. data/test/test_gem_source_info_cache_entry.rbc +0 -0
  146. data/test/test_gem_specification.rbc +0 -0
  147. data/test/test_gem_stream_ui.rbc +0 -0
  148. data/test/test_gem_uninstaller.rbc +0 -0
  149. data/test/test_gem_validator.rbc +0 -0
  150. data/test/test_gem_version.rbc +0 -0
  151. data/test/test_gem_version_option.rbc +0 -0
  152. data/test/test_kernel.rbc +0 -0
@@ -15,6 +15,12 @@ class TestGemUninstaller < GemInstallerTestCase
15
15
  end
16
16
  end
17
17
 
18
+ def test_initialize_expand_path
19
+ uninstaller = Gem::Uninstaller.new nil, :install_dir => '/foo//bar'
20
+
21
+ assert_match %r|/foo/bar$|, uninstaller.instance_variable_get(:@gem_home)
22
+ end
23
+
18
24
  def test_remove_executables_force_keep
19
25
  uninstaller = Gem::Uninstaller.new nil, :executables => false
20
26
 
@@ -39,5 +45,20 @@ class TestGemUninstaller < GemInstallerTestCase
39
45
  assert_equal false, File.exist?(File.join(@gemhome, 'bin', 'executable'))
40
46
  end
41
47
 
48
+ def test_path_ok_eh
49
+ uninstaller = Gem::Uninstaller.new nil
50
+
51
+ assert_equal true, uninstaller.path_ok?(@spec)
52
+ end
53
+
54
+ def test_path_ok_eh_legacy
55
+ uninstaller = Gem::Uninstaller.new nil
56
+
57
+ @spec.loaded_from.gsub! @spec.full_name, '\&-legacy'
58
+ @spec.platform = 'legacy'
59
+
60
+ assert_equal true, uninstaller.path_ok?(@spec)
61
+ end
62
+
42
63
  end
43
64
 
@@ -71,10 +71,14 @@ class TestGemVersion < RubyGemTestCase
71
71
  end
72
72
 
73
73
  def test_eql_eh
74
- v = Gem::Version.new("1.2")
74
+ v1_2 = Gem::Version.new '1.2'
75
+ v1_2_0 = Gem::Version.new '1.2.0'
76
+
77
+ assert_equal true, v1_2.eql?(@v1_2)
78
+ assert_equal true, @v1_2.eql?(v1_2)
75
79
 
76
- assert_equal true, v.eql?(@v1_2)
77
- assert_equal true, @v1_2.eql?(v)
80
+ assert_equal false, v1_2_0.eql?(@v1_2)
81
+ assert_equal false, @v1_2.eql?(v1_2_0)
78
82
 
79
83
  assert_equal false, @v1_2.eql?(@v1_3)
80
84
  assert_equal false, @v1_3.eql?(@v1_2)
@@ -91,8 +95,13 @@ class TestGemVersion < RubyGemTestCase
91
95
  end
92
96
 
93
97
  def test_hash
94
- v = Gem::Version.new("1.2")
95
- assert_equal v.hash, @v1_2.hash
98
+ v1_2 = Gem::Version.new "1.2"
99
+ v1_2_0 = Gem::Version.new "1.2.0"
100
+
101
+ assert_equal v1_2.hash, @v1_2.hash
102
+
103
+ assert_not_equal v1_2_0.hash, @v1_2.hash
104
+
96
105
  assert_not_equal @v1_2.hash, @v1_3.hash
97
106
  end
98
107
 
@@ -52,7 +52,7 @@ class TestKernel < RubyGemTestCase
52
52
  gem 'a', '= 2'
53
53
  end
54
54
 
55
- assert_match(/activate a \(= 2\)/, ex.message)
55
+ assert_match(/activate a \(= 2, runtime\)/, ex.message)
56
56
  assert_match(/activated a-1/, ex.message)
57
57
 
58
58
  assert $:.any? { |p| %r{a-1/lib} =~ p }
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.1.1
4
+ version: 1.2.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-04-10 00:00:00 -07:00
35
+ date: 2008-06-23 00:00:00 -07:00
36
36
  default_executable:
37
37
  dependencies: []
38
38
 
@@ -78,6 +78,7 @@ files:
78
78
  - doc/release_notes/rel_1_0_1.rdoc
79
79
  - doc/release_notes/rel_1_1_0.rdoc
80
80
  - doc/release_notes/rel_1_1_1.rdoc
81
+ - doc/release_notes/rel_1_2_0.rdoc
81
82
  - lib/rbconfig/datadir.rb
82
83
  - lib/rubygems/builder.rb
83
84
  - lib/rubygems/command.rb
@@ -104,6 +105,7 @@ files:
104
105
  - lib/rubygems/commands/server_command.rb
105
106
  - lib/rubygems/commands/sources_command.rb
106
107
  - lib/rubygems/commands/specification_command.rb
108
+ - lib/rubygems/commands/stale_command.rb
107
109
  - lib/rubygems/commands/uninstall_command.rb
108
110
  - lib/rubygems/commands/unpack_command.rb
109
111
  - lib/rubygems/commands/update_command.rb
@@ -129,11 +131,6 @@ files:
129
131
  - lib/rubygems/gem_openssl.rb
130
132
  - lib/rubygems/gem_path_searcher.rb
131
133
  - lib/rubygems/gem_runner.rb
132
- - lib/rubygems/indexer/abstract_index_builder.rb
133
- - lib/rubygems/indexer/latest_index_builder.rb
134
- - lib/rubygems/indexer/marshal_index_builder.rb
135
- - lib/rubygems/indexer/master_index_builder.rb
136
- - lib/rubygems/indexer/quick_index_builder.rb
137
134
  - lib/rubygems/indexer.rb
138
135
  - lib/rubygems/install_update_options.rb
139
136
  - lib/rubygems/installer.rb
@@ -157,7 +154,9 @@ files:
157
154
  - lib/rubygems/source_index.rb
158
155
  - lib/rubygems/source_info_cache.rb
159
156
  - lib/rubygems/source_info_cache_entry.rb
157
+ - lib/rubygems/spec_fetcher.rb
160
158
  - lib/rubygems/specification.rb
159
+ - lib/rubygems/test_utilities.rb
161
160
  - lib/rubygems/timer.rb
162
161
  - lib/rubygems/uninstaller.rb
163
162
  - lib/rubygems/user_interaction.rb
@@ -184,136 +183,74 @@ files:
184
183
  - test/fake_certlib/openssl.rb
185
184
  - test/functional.rb
186
185
  - test/gem_installer_test_case.rb
187
- - test/gem_installer_test_case.rbc
188
186
  - test/gem_package_tar_test_case.rb
189
- - test/gem_package_tar_test_case.rbc
190
187
  - test/gemutilities.rb
191
- - test/gemutilities.rbc
192
188
  - test/insure_session.rb
193
189
  - test/mockgemui.rb
194
- - test/mockgemui.rbc
195
190
  - test/private_key.pem
196
191
  - test/public_cert.pem
197
192
  - test/simple_gem.rb
198
- - test/simple_gem.rbc
199
193
  - test/test_config.rb
200
- - test/test_config.rbc
201
194
  - test/test_gem.rb
202
- - test/test_gem.rbc
203
195
  - test/test_gem_builder.rb
204
- - test/test_gem_builder.rbc
205
196
  - test/test_gem_command.rb
206
- - test/test_gem_command.rbc
207
197
  - test/test_gem_command_manager.rb
208
- - test/test_gem_command_manager.rbc
209
198
  - test/test_gem_commands_build_command.rb
210
- - test/test_gem_commands_build_command.rbc
211
199
  - test/test_gem_commands_cert_command.rb
212
- - test/test_gem_commands_cert_command.rbc
213
200
  - test/test_gem_commands_check_command.rb
214
- - test/test_gem_commands_check_command.rbc
215
201
  - test/test_gem_commands_contents_command.rb
216
- - test/test_gem_commands_contents_command.rbc
217
202
  - test/test_gem_commands_dependency_command.rb
218
- - test/test_gem_commands_dependency_command.rbc
219
203
  - test/test_gem_commands_environment_command.rb
220
- - test/test_gem_commands_environment_command.rbc
221
204
  - test/test_gem_commands_fetch_command.rb
222
- - test/test_gem_commands_fetch_command.rbc
223
205
  - test/test_gem_commands_generate_index_command.rb
224
- - test/test_gem_commands_generate_index_command.rbc
225
206
  - test/test_gem_commands_install_command.rb
226
- - test/test_gem_commands_install_command.rbc
227
207
  - test/test_gem_commands_mirror_command.rb
228
- - test/test_gem_commands_mirror_command.rbc
208
+ - test/test_gem_commands_outdated_command.rb
229
209
  - test/test_gem_commands_pristine_command.rb
230
- - test/test_gem_commands_pristine_command.rbc
231
210
  - test/test_gem_commands_query_command.rb
232
- - test/test_gem_commands_query_command.rbc
233
211
  - test/test_gem_commands_server_command.rb
234
- - test/test_gem_commands_server_command.rbc
235
212
  - test/test_gem_commands_sources_command.rb
236
- - test/test_gem_commands_sources_command.rbc
237
213
  - test/test_gem_commands_specification_command.rb
238
- - test/test_gem_commands_specification_command.rbc
214
+ - test/test_gem_commands_stale_command.rb
239
215
  - test/test_gem_commands_unpack_command.rb
240
- - test/test_gem_commands_unpack_command.rbc
241
216
  - test/test_gem_commands_update_command.rb
242
- - test/test_gem_commands_update_command.rbc
243
217
  - test/test_gem_config_file.rb
244
- - test/test_gem_config_file.rbc
245
218
  - test/test_gem_dependency.rb
246
- - test/test_gem_dependency.rbc
247
219
  - test/test_gem_dependency_installer.rb
248
- - test/test_gem_dependency_installer.rbc
249
220
  - test/test_gem_dependency_list.rb
250
- - test/test_gem_dependency_list.rbc
251
221
  - test/test_gem_digest.rb
252
- - test/test_gem_digest.rbc
253
222
  - test/test_gem_doc_manager.rb
254
- - test/test_gem_doc_manager.rbc
255
223
  - test/test_gem_ext_configure_builder.rb
256
- - test/test_gem_ext_configure_builder.rbc
257
224
  - test/test_gem_ext_ext_conf_builder.rb
258
- - test/test_gem_ext_ext_conf_builder.rbc
259
225
  - test/test_gem_ext_rake_builder.rb
260
- - test/test_gem_ext_rake_builder.rbc
261
226
  - test/test_gem_format.rb
262
- - test/test_gem_format.rbc
263
227
  - test/test_gem_gem_path_searcher.rb
264
- - test/test_gem_gem_path_searcher.rbc
265
228
  - test/test_gem_gem_runner.rb
266
- - test/test_gem_gem_runner.rbc
267
229
  - test/test_gem_indexer.rb
268
- - test/test_gem_indexer.rbc
269
230
  - test/test_gem_install_update_options.rb
270
- - test/test_gem_install_update_options.rbc
271
231
  - test/test_gem_installer.rb
272
- - test/test_gem_installer.rbc
273
232
  - test/test_gem_local_remote_options.rb
274
- - test/test_gem_local_remote_options.rbc
275
- - test/test_gem_outdated_command.rb
276
- - test/test_gem_outdated_command.rbc
277
233
  - test/test_gem_package_tar_header.rb
278
- - test/test_gem_package_tar_header.rbc
279
234
  - test/test_gem_package_tar_input.rb
280
- - test/test_gem_package_tar_input.rbc
281
235
  - test/test_gem_package_tar_output.rb
282
- - test/test_gem_package_tar_output.rbc
283
236
  - test/test_gem_package_tar_reader.rb
284
- - test/test_gem_package_tar_reader.rbc
285
237
  - test/test_gem_package_tar_reader_entry.rb
286
- - test/test_gem_package_tar_reader_entry.rbc
287
238
  - test/test_gem_package_tar_writer.rb
288
- - test/test_gem_package_tar_writer.rbc
289
239
  - test/test_gem_platform.rb
290
- - test/test_gem_platform.rbc
291
240
  - test/test_gem_remote_fetcher.rb
292
- - test/test_gem_remote_fetcher.rbc
293
241
  - test/test_gem_requirement.rb
294
- - test/test_gem_requirement.rbc
295
242
  - test/test_gem_server.rb
296
- - test/test_gem_server.rbc
297
243
  - test/test_gem_source_index.rb
298
- - test/test_gem_source_index.rbc
299
244
  - test/test_gem_source_info_cache.rb
300
- - test/test_gem_source_info_cache.rbc
301
245
  - test/test_gem_source_info_cache_entry.rb
302
- - test/test_gem_source_info_cache_entry.rbc
246
+ - test/test_gem_spec_fetcher.rb
303
247
  - test/test_gem_specification.rb
304
- - test/test_gem_specification.rbc
305
248
  - test/test_gem_stream_ui.rb
306
- - test/test_gem_stream_ui.rbc
307
249
  - test/test_gem_uninstaller.rb
308
- - test/test_gem_uninstaller.rbc
309
250
  - test/test_gem_validator.rb
310
- - test/test_gem_validator.rbc
311
251
  - test/test_gem_version.rb
312
- - test/test_gem_version.rbc
313
252
  - test/test_gem_version_option.rb
314
- - test/test_gem_version_option.rbc
315
253
  - test/test_kernel.rb
316
- - test/test_kernel.rbc
317
254
  has_rdoc: false
318
255
  homepage: http://rubygems.rubyforge.org
319
256
  post_install_message:
@@ -336,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
336
273
  requirements: []
337
274
 
338
275
  rubyforge_project: rubygems
339
- rubygems_version: 1.1.0
276
+ rubygems_version: 1.2.0
340
277
  signing_key:
341
278
  specification_version: 2
342
279
  summary: RubyGems Update GEM
metadata.gz.sig CHANGED
Binary file
@@ -1,88 +0,0 @@
1
- require 'zlib'
2
-
3
- require 'rubygems/indexer'
4
-
5
- # Abstract base class for building gem indicies. Uses the template pattern
6
- # with subclass specialization in the +begin_index+, +end_index+ and +cleanup+
7
- # methods.
8
- class Gem::Indexer::AbstractIndexBuilder
9
-
10
- # Directory to put index files in
11
- attr_reader :directory
12
-
13
- # File name of the generated index
14
- attr_reader :filename
15
-
16
- # List of written files/directories to move into production
17
- attr_reader :files
18
-
19
- def initialize(filename, directory)
20
- @filename = filename
21
- @directory = directory
22
- @files = []
23
- end
24
-
25
- ##
26
- # Build a Gem index. Yields to block to handle the details of the
27
- # actual building. Calls +begin_index+, +end_index+ and +cleanup+ at
28
- # appropriate times to customize basic operations.
29
-
30
- def build
31
- FileUtils.mkdir_p @directory unless File.exist? @directory
32
- raise "not a directory: #{@directory}" unless File.directory? @directory
33
-
34
- file_path = File.join @directory, @filename
35
-
36
- @files << @filename
37
-
38
- File.open file_path, "wb" do |file|
39
- @file = file
40
- start_index
41
- yield
42
- end_index
43
- end
44
-
45
- cleanup
46
- ensure
47
- @file = nil
48
- end
49
-
50
- ##
51
- # Compress the given file.
52
-
53
- def compress(filename, ext="rz")
54
- data = open filename, 'rb' do |fp| fp.read end
55
-
56
- zipped = zip data
57
-
58
- File.open "#{filename}.#{ext}", "wb" do |file|
59
- file.write zipped
60
- end
61
- end
62
-
63
- # Called immediately before the yield in build. The index file is open and
64
- # available as @file.
65
- def start_index
66
- end
67
-
68
- # Called immediately after the yield in build. The index file is still open
69
- # and available as @file.
70
- def end_index
71
- end
72
-
73
- # Called from within builder after the index file has been closed.
74
- def cleanup
75
- end
76
-
77
- # Return an uncompressed version of a compressed string.
78
- def unzip(string)
79
- Zlib::Inflate.inflate(string)
80
- end
81
-
82
- # Return a compressed version of the given string.
83
- def zip(string)
84
- Zlib::Deflate.deflate(string)
85
- end
86
-
87
- end
88
-
@@ -1,35 +0,0 @@
1
- require 'rubygems/indexer'
2
-
3
- ##
4
- # Construct the latest Gem index file.
5
-
6
- class Gem::Indexer::LatestIndexBuilder < Gem::Indexer::AbstractIndexBuilder
7
-
8
- def start_index
9
- super
10
-
11
- @index = Gem::SourceIndex.new
12
- end
13
-
14
- def end_index
15
- super
16
-
17
- latest = @index.latest_specs.sort.map { |spec| spec.original_name }
18
-
19
- @file.write latest.join("\n")
20
- end
21
-
22
- def cleanup
23
- super
24
-
25
- compress @file.path
26
-
27
- @files.delete 'latest_index' # HACK installed via QuickIndexBuilder :/
28
- end
29
-
30
- def add(spec)
31
- @index.add_spec(spec)
32
- end
33
-
34
- end
35
-
@@ -1,17 +0,0 @@
1
- require 'rubygems/indexer'
2
-
3
- # Construct the master Gem index file.
4
- class Gem::Indexer::MarshalIndexBuilder < Gem::Indexer::MasterIndexBuilder
5
- def end_index
6
- gems = {}
7
- index = Gem::SourceIndex.new
8
-
9
- @index.each do |name, gemspec|
10
- gems[gemspec.original_name] = gemspec
11
- end
12
-
13
- index.instance_variable_get(:@gems).replace gems
14
-
15
- @file.write index.dump
16
- end
17
- end
@@ -1,54 +0,0 @@
1
- require 'rubygems/indexer'
2
-
3
- ##
4
- # Construct the master Gem index file.
5
-
6
- class Gem::Indexer::MasterIndexBuilder < Gem::Indexer::AbstractIndexBuilder
7
-
8
- def start_index
9
- super
10
- @index = Gem::SourceIndex.new
11
- end
12
-
13
- def end_index
14
- super
15
-
16
- @file.puts "--- !ruby/object:#{@index.class}"
17
- @file.puts "gems:"
18
-
19
- gems = @index.sort_by { |name, gemspec| gemspec.sort_obj }
20
- gems.each do |name, gemspec|
21
- yaml = gemspec.to_yaml.gsub(/^/, ' ')
22
- yaml = yaml.sub(/\A ---/, '') # there's a needed extra ' ' here
23
- @file.print " #{gemspec.original_name}:"
24
- @file.puts yaml
25
- end
26
- end
27
-
28
- def cleanup
29
- super
30
-
31
- index_file_name = File.join @directory, @filename
32
-
33
- compress index_file_name, "Z"
34
- paranoid index_file_name, "#{index_file_name}.Z"
35
-
36
- @files << "#{@filename}.Z"
37
- end
38
-
39
- def add(spec)
40
- @index.add_spec(spec)
41
- end
42
-
43
- private
44
-
45
- def paranoid(path, compressed_path)
46
- data = Gem.read_binary path
47
- compressed_data = Gem.read_binary compressed_path
48
-
49
- if data != unzip(compressed_data) then
50
- raise "Compressed file #{compressed_path} does not match uncompressed file #{path}"
51
- end
52
- end
53
-
54
- end