rubygems-update 1.8.30 → 2.0.0.preview2

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 (241) hide show
  1. checksums.yaml +6 -6
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +3 -0
  4. data/.autotest +6 -3
  5. data/History.txt +137 -63
  6. data/LICENSE.txt +1 -5
  7. data/Manifest.txt +69 -32
  8. data/README.rdoc +11 -9
  9. data/Rakefile +24 -38
  10. data/bin/gem +0 -9
  11. data/bin/update_rubygems +1 -0
  12. data/lib/rubygems.rb +193 -405
  13. data/lib/rubygems/available_set.rb +95 -0
  14. data/lib/rubygems/command.rb +88 -45
  15. data/lib/rubygems/command_manager.rb +67 -40
  16. data/lib/rubygems/commands/build_command.rb +5 -23
  17. data/lib/rubygems/commands/cert_command.rb +199 -57
  18. data/lib/rubygems/commands/check_command.rb +14 -39
  19. data/lib/rubygems/commands/cleanup_command.rb +9 -1
  20. data/lib/rubygems/commands/contents_command.rb +30 -12
  21. data/lib/rubygems/commands/dependency_command.rb +3 -8
  22. data/lib/rubygems/commands/environment_command.rb +13 -8
  23. data/lib/rubygems/commands/fetch_command.rb +3 -16
  24. data/lib/rubygems/commands/generate_index_command.rb +7 -47
  25. data/lib/rubygems/commands/help_command.rb +1 -1
  26. data/lib/rubygems/commands/install_command.rb +69 -36
  27. data/lib/rubygems/commands/list_command.rb +6 -4
  28. data/lib/rubygems/commands/lock_command.rb +1 -1
  29. data/lib/rubygems/commands/mirror_command.rb +17 -0
  30. data/lib/rubygems/commands/outdated_command.rb +6 -3
  31. data/lib/rubygems/commands/owner_command.rb +13 -5
  32. data/lib/rubygems/commands/pristine_command.rb +19 -4
  33. data/lib/rubygems/commands/push_command.rb +12 -1
  34. data/lib/rubygems/commands/query_command.rb +43 -27
  35. data/lib/rubygems/commands/rdoc_command.rb +23 -28
  36. data/lib/rubygems/commands/search_command.rb +4 -18
  37. data/lib/rubygems/commands/server_command.rb +1 -1
  38. data/lib/rubygems/commands/setup_command.rb +124 -38
  39. data/lib/rubygems/commands/sources_command.rb +16 -16
  40. data/lib/rubygems/commands/specification_command.rb +11 -13
  41. data/lib/rubygems/commands/uninstall_command.rb +24 -7
  42. data/lib/rubygems/commands/unpack_command.rb +7 -3
  43. data/lib/rubygems/commands/update_command.rb +22 -36
  44. data/lib/rubygems/commands/yank_command.rb +98 -0
  45. data/lib/rubygems/compatibility.rb +51 -0
  46. data/lib/rubygems/config_file.rb +82 -54
  47. data/lib/rubygems/core_ext/kernel_gem.rb +53 -0
  48. data/lib/rubygems/core_ext/kernel_require.rb +119 -0
  49. data/lib/rubygems/defaults.rb +10 -21
  50. data/lib/rubygems/dependency.rb +61 -10
  51. data/lib/rubygems/dependency_installer.rb +157 -69
  52. data/lib/rubygems/dependency_list.rb +11 -19
  53. data/lib/rubygems/dependency_resolver.rb +562 -0
  54. data/lib/rubygems/deprecate.rb +40 -40
  55. data/lib/rubygems/errors.rb +77 -24
  56. data/lib/rubygems/exceptions.rb +25 -7
  57. data/lib/rubygems/ext/builder.rb +20 -23
  58. data/lib/rubygems/ext/configure_builder.rb +2 -2
  59. data/lib/rubygems/ext/ext_conf_builder.rb +5 -45
  60. data/lib/rubygems/ext/rake_builder.rb +2 -2
  61. data/lib/rubygems/gem_runner.rb +3 -16
  62. data/lib/rubygems/gemcutter_utilities.rb +22 -7
  63. data/lib/rubygems/indexer.rb +6 -159
  64. data/lib/rubygems/install_message.rb +12 -0
  65. data/lib/rubygems/install_update_options.rb +56 -18
  66. data/lib/rubygems/installer.rb +244 -134
  67. data/lib/rubygems/installer_test_case.rb +71 -19
  68. data/lib/rubygems/mock_gem_ui.rb +17 -0
  69. data/lib/rubygems/name_tuple.rb +110 -0
  70. data/lib/rubygems/package.rb +514 -43
  71. data/lib/rubygems/package/digest_io.rb +64 -0
  72. data/lib/rubygems/package/old.rb +147 -0
  73. data/lib/rubygems/package/tar_header.rb +18 -55
  74. data/lib/rubygems/package/tar_reader.rb +20 -3
  75. data/lib/rubygems/package/tar_writer.rb +63 -7
  76. data/lib/rubygems/package_task.rb +3 -4
  77. data/lib/rubygems/path_support.rb +14 -7
  78. data/lib/rubygems/platform.rb +19 -26
  79. data/lib/rubygems/rdoc.rb +316 -0
  80. data/lib/rubygems/remote_fetcher.rb +117 -54
  81. data/lib/rubygems/request_set.rb +182 -0
  82. data/lib/rubygems/requirement.rb +63 -26
  83. data/lib/rubygems/security.rb +295 -555
  84. data/lib/rubygems/security/policies.rb +115 -0
  85. data/lib/rubygems/security/policy.rb +227 -0
  86. data/lib/rubygems/security/signer.rb +136 -0
  87. data/lib/rubygems/security/trust_dir.rb +104 -0
  88. data/lib/rubygems/server.rb +45 -55
  89. data/lib/rubygems/source.rb +144 -0
  90. data/lib/rubygems/source_list.rb +87 -0
  91. data/lib/rubygems/source_local.rb +92 -0
  92. data/lib/rubygems/source_specific_file.rb +28 -0
  93. data/lib/rubygems/spec_fetcher.rb +116 -184
  94. data/lib/rubygems/specification.rb +731 -335
  95. data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +88 -30
  96. data/lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem +90 -0
  97. data/lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem +57 -0
  98. data/lib/rubygems/syck_hack.rb +2 -0
  99. data/lib/rubygems/test_case.rb +199 -109
  100. data/lib/rubygems/test_utilities.rb +25 -5
  101. data/lib/rubygems/uninstaller.rb +62 -20
  102. data/lib/rubygems/user_interaction.rb +10 -0
  103. data/lib/rubygems/validator.rb +33 -40
  104. data/lib/rubygems/version.rb +19 -8
  105. data/setup.rb +8 -1
  106. data/test/rubygems/alternate_cert.pem +9 -0
  107. data/test/rubygems/alternate_cert_32.pem +9 -0
  108. data/test/rubygems/alternate_key.pem +9 -0
  109. data/test/rubygems/bad_rake.rb +1 -0
  110. data/test/rubygems/child_cert.pem +9 -0
  111. data/test/rubygems/child_cert_32.pem +9 -0
  112. data/test/rubygems/child_key.pem +9 -0
  113. data/test/rubygems/data/null-type.gemspec.rz +0 -0
  114. data/test/rubygems/expired_cert.pem +9 -0
  115. data/test/rubygems/future_cert.pem +9 -0
  116. data/test/rubygems/future_cert_32.pem +9 -0
  117. data/test/rubygems/good_rake.rb +1 -0
  118. data/test/rubygems/grandchild_cert.pem +9 -0
  119. data/test/rubygems/grandchild_cert_32.pem +9 -0
  120. data/test/rubygems/grandchild_key.pem +9 -0
  121. data/test/rubygems/invalid_issuer_cert.pem +9 -0
  122. data/test/rubygems/invalid_issuer_cert_32.pem +9 -0
  123. data/test/rubygems/invalid_key.pem +9 -0
  124. data/test/rubygems/invalid_signer_cert.pem +9 -0
  125. data/test/rubygems/invalid_signer_cert_32.pem +9 -0
  126. data/test/rubygems/invalidchild_cert.pem +9 -0
  127. data/test/rubygems/invalidchild_cert_32.pem +9 -0
  128. data/test/rubygems/invalidchild_key.pem +9 -0
  129. data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
  130. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
  131. data/test/rubygems/private_key.pem +7 -25
  132. data/test/rubygems/public_cert.pem +8 -18
  133. data/test/rubygems/public_cert_32.pem +10 -0
  134. data/test/rubygems/public_key.pem +4 -0
  135. data/test/rubygems/rubygems/commands/crash_command.rb +1 -1
  136. data/test/rubygems/test_config.rb +4 -6
  137. data/test/rubygems/test_deprecate.rb +76 -0
  138. data/test/rubygems/test_gem.rb +318 -83
  139. data/test/rubygems/test_gem_available_set.rb +106 -0
  140. data/test/rubygems/test_gem_command.rb +10 -0
  141. data/test/rubygems/test_gem_command_manager.rb +55 -9
  142. data/test/rubygems/test_gem_commands_build_command.rb +11 -19
  143. data/test/rubygems/test_gem_commands_cert_command.rb +441 -42
  144. data/test/rubygems/test_gem_commands_cleanup_command.rb +29 -1
  145. data/test/rubygems/test_gem_commands_contents_command.rb +23 -0
  146. data/test/rubygems/test_gem_commands_dependency_command.rb +5 -0
  147. data/test/rubygems/test_gem_commands_fetch_command.rb +19 -20
  148. data/test/rubygems/test_gem_commands_generate_index_command.rb +2 -83
  149. data/test/rubygems/test_gem_commands_help_command.rb +2 -1
  150. data/test/rubygems/test_gem_commands_install_command.rb +647 -48
  151. data/test/rubygems/test_gem_commands_mirror.rb +32 -0
  152. data/test/rubygems/test_gem_commands_owner_command.rb +4 -8
  153. data/test/rubygems/test_gem_commands_pristine_command.rb +99 -4
  154. data/test/rubygems/test_gem_commands_push_command.rb +62 -8
  155. data/test/rubygems/test_gem_commands_query_command.rb +51 -0
  156. data/test/rubygems/test_gem_commands_search_command.rb +25 -0
  157. data/test/rubygems/test_gem_commands_setup_command.rb +45 -0
  158. data/test/rubygems/test_gem_commands_sources_command.rb +21 -6
  159. data/test/rubygems/test_gem_commands_specification_command.rb +33 -1
  160. data/test/rubygems/test_gem_commands_uninstall_command.rb +91 -31
  161. data/test/rubygems/test_gem_commands_unpack_command.rb +3 -3
  162. data/test/rubygems/test_gem_commands_update_command.rb +56 -38
  163. data/test/rubygems/test_gem_commands_which_command.rb +4 -4
  164. data/test/rubygems/test_gem_commands_yank_command.rb +97 -0
  165. data/test/rubygems/test_gem_config_file.rb +66 -21
  166. data/test/rubygems/test_gem_dependency.rb +46 -0
  167. data/test/rubygems/test_gem_dependency_installer.rb +228 -18
  168. data/test/rubygems/test_gem_dependency_list.rb +0 -9
  169. data/test/rubygems/test_gem_dependency_resolver.rb +327 -0
  170. data/test/rubygems/test_gem_ext_configure_builder.rb +4 -4
  171. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -49
  172. data/test/rubygems/test_gem_ext_rake_builder.rb +13 -13
  173. data/test/rubygems/test_gem_gem_runner.rb +27 -5
  174. data/test/rubygems/test_gem_gemcutter_utilities.rb +19 -0
  175. data/test/rubygems/test_gem_indexer.rb +14 -227
  176. data/test/rubygems/test_gem_install_update_options.rb +83 -3
  177. data/test/rubygems/test_gem_installer.rb +211 -236
  178. data/test/rubygems/test_gem_local_remote_options.rb +8 -2
  179. data/test/rubygems/test_gem_name_tuple.rb +15 -0
  180. data/test/rubygems/test_gem_package.rb +547 -0
  181. data/test/rubygems/test_gem_package_old.rb +37 -0
  182. data/test/rubygems/test_gem_package_tar_reader.rb +32 -0
  183. data/test/rubygems/test_gem_package_tar_writer.rb +84 -1
  184. data/test/rubygems/test_gem_path_support.rb +4 -30
  185. data/test/rubygems/test_gem_platform.rb +3 -6
  186. data/test/rubygems/test_gem_rdoc.rb +245 -0
  187. data/test/rubygems/test_gem_remote_fetcher.rb +51 -5
  188. data/test/rubygems/test_gem_request_set.rb +70 -0
  189. data/test/rubygems/test_gem_requirement.rb +53 -24
  190. data/test/rubygems/test_gem_security.rb +189 -43
  191. data/test/rubygems/test_gem_security_policy.rb +376 -0
  192. data/test/rubygems/test_gem_security_signer.rb +184 -0
  193. data/test/rubygems/test_gem_security_trust_dir.rb +94 -0
  194. data/test/rubygems/test_gem_server.rb +31 -36
  195. data/test/rubygems/test_gem_silent_ui.rb +2 -2
  196. data/test/rubygems/test_gem_source.rb +188 -0
  197. data/test/rubygems/test_gem_source_list.rb +87 -0
  198. data/test/rubygems/test_gem_source_local.rb +83 -0
  199. data/test/rubygems/test_gem_source_specific_file.rb +33 -0
  200. data/test/rubygems/test_gem_spec_fetcher.rb +91 -255
  201. data/test/rubygems/test_gem_specification.rb +293 -39
  202. data/test/rubygems/test_gem_uninstaller.rb +136 -13
  203. data/test/rubygems/test_gem_validator.rb +14 -41
  204. data/test/rubygems/test_gem_version.rb +15 -21
  205. data/test/rubygems/test_require.rb +193 -0
  206. data/test/rubygems/wrong_key_cert.pem +9 -0
  207. data/test/rubygems/wrong_key_cert_32.pem +9 -0
  208. metadata +171 -83
  209. metadata.gz.sig +1 -0
  210. data/CVE-2013-4287.txt +0 -36
  211. data/CVE-2013-4363.txt +0 -45
  212. data/ci_build.sh +0 -27
  213. data/cruise_config.rb +0 -32
  214. data/lib/rbconfig/datadir.rb +0 -13
  215. data/lib/rubygems/builder.rb +0 -99
  216. data/lib/rubygems/custom_require.rb +0 -69
  217. data/lib/rubygems/doc_manager.rb +0 -243
  218. data/lib/rubygems/format.rb +0 -82
  219. data/lib/rubygems/gem_openssl.rb +0 -90
  220. data/lib/rubygems/gem_path_searcher.rb +0 -172
  221. data/lib/rubygems/old_format.rb +0 -153
  222. data/lib/rubygems/package/f_sync_dir.rb +0 -23
  223. data/lib/rubygems/package/tar_input.rb +0 -234
  224. data/lib/rubygems/package/tar_output.rb +0 -146
  225. data/lib/rubygems/require_paths_builder.rb +0 -18
  226. data/lib/rubygems/source_index.rb +0 -406
  227. data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
  228. data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
  229. data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
  230. data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
  231. data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
  232. data/test/rubygems/test_bundled_ca.rb +0 -59
  233. data/test/rubygems/test_gem_builder.rb +0 -44
  234. data/test/rubygems/test_gem_doc_manager.rb +0 -32
  235. data/test/rubygems/test_gem_ext_builder.rb +0 -58
  236. data/test/rubygems/test_gem_format.rb +0 -88
  237. data/test/rubygems/test_gem_gem_path_searcher.rb +0 -94
  238. data/test/rubygems/test_gem_package_tar_input.rb +0 -129
  239. data/test/rubygems/test_gem_package_tar_output.rb +0 -101
  240. data/test/rubygems/test_gem_source_index.rb +0 -250
  241. data/util/update_bundled_ca_certificates.rb +0 -103
@@ -0,0 +1,37 @@
1
+ require 'rubygems/test_case'
2
+ require 'rubygems/simple_gem'
3
+
4
+ class TestGemPackageOld < Gem::TestCase
5
+
6
+ def setup
7
+ super
8
+
9
+ open 'old_format.gem', 'wb' do |io|
10
+ io.write SIMPLE_GEM
11
+ end
12
+
13
+ @package = Gem::Package::Old.new 'old_format.gem'
14
+ @destination = File.join @tempdir, 'extract'
15
+ end
16
+
17
+ def test_contents
18
+ assert_equal %w[lib/foo.rb lib/test.rb lib/test/wow.rb], @package.contents
19
+ end
20
+
21
+ def test_extract_files
22
+ @package.extract_files @destination
23
+
24
+ extracted = File.join @destination, 'lib/foo.rb'
25
+ assert_path_exists extracted
26
+
27
+ mask = 0100644 & (~File.umask)
28
+
29
+ assert_equal mask, File.stat(extracted).mode unless win_platform?
30
+ end
31
+
32
+ def test_spec
33
+ assert_equal 'testing', @package.spec.name
34
+ end
35
+
36
+ end
37
+
@@ -42,5 +42,37 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
42
42
  end
43
43
  end
44
44
 
45
+ def test_seek
46
+ tar = tar_dir_header "foo", "bar", 0
47
+ tar << tar_file_header("bar", "baz", 0, 0)
48
+
49
+ io = TempIO.new tar
50
+
51
+ Gem::Package::TarReader.new io do |tar_reader|
52
+ tar_reader.seek 'baz/bar' do |entry|
53
+ assert_kind_of Gem::Package::TarReader::Entry, entry
54
+
55
+ assert_equal 'baz/bar', entry.full_name
56
+ end
57
+
58
+ assert_equal 0, io.pos
59
+ end
60
+ end
61
+
62
+ def test_seek_missing
63
+ tar = tar_dir_header "foo", "bar", 0
64
+ tar << tar_file_header("bar", "baz", 0, 0)
65
+
66
+ io = TempIO.new tar
67
+
68
+ Gem::Package::TarReader.new io do |tar_reader|
69
+ tar_reader.seek 'nonexistent' do |entry|
70
+ flunk 'entry missing but entry-found block was run'
71
+ end
72
+
73
+ assert_equal 0, io.pos
74
+ end
75
+ end
76
+
45
77
  end
46
78
 
@@ -1,7 +1,7 @@
1
1
  require 'rubygems/package/tar_test_case'
2
2
  require 'rubygems/package/tar_writer'
3
3
 
4
- class TestTarWriter < Gem::Package::TarTestCase
4
+ class TestGemPackageTarWriter < Gem::Package::TarTestCase
5
5
 
6
6
  def setup
7
7
  super
@@ -26,6 +26,89 @@ class TestTarWriter < Gem::Package::TarTestCase
26
26
  assert_equal 1024, @io.pos
27
27
  end
28
28
 
29
+ def test_add_file_digest
30
+ digest_algorithms = OpenSSL::Digest::SHA1, OpenSSL::Digest::SHA512
31
+
32
+ digests = @tar_writer.add_file_digest 'x', 0644, digest_algorithms do |io|
33
+ io.write 'a' * 10
34
+ end
35
+
36
+ assert_equal '3495ff69d34671d1e15b33a63c1379fdedd3a32a',
37
+ digests['SHA1'].hexdigest
38
+ assert_equal '4714870aff6c97ca09d135834fdb58a6389a50c1' \
39
+ '1fef8ec4afef466fb60a23ac6b7a9c92658f14df' \
40
+ '4993d6b40a4e4d8424196afc347e97640d68de61' \
41
+ 'e1cf14b0',
42
+ digests['SHA512'].hexdigest
43
+
44
+ assert_headers_equal(tar_file_header('x', '', 0644, 10),
45
+ @io.string[0, 512])
46
+ assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
47
+ assert_equal 1024, @io.pos
48
+ end
49
+
50
+ def test_add_file_digest_multiple
51
+ digest_algorithms = [OpenSSL::Digest::SHA1, OpenSSL::Digest::SHA512]
52
+
53
+ digests = @tar_writer.add_file_digest 'x', 0644, digest_algorithms do |io|
54
+ io.write 'a' * 10
55
+ end
56
+
57
+ assert_equal '3495ff69d34671d1e15b33a63c1379fdedd3a32a',
58
+ digests['SHA1'].hexdigest
59
+ assert_equal '4714870aff6c97ca09d135834fdb58a6389a50c1' \
60
+ '1fef8ec4afef466fb60a23ac6b7a9c92658f14df' \
61
+ '4993d6b40a4e4d8424196afc347e97640d68de61' \
62
+ 'e1cf14b0',
63
+ digests['SHA512'].hexdigest
64
+
65
+ assert_headers_equal(tar_file_header('x', '', 0644, 10),
66
+ @io.string[0, 512])
67
+ assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
68
+ assert_equal 1024, @io.pos
69
+ end
70
+
71
+ def test_add_file_signer
72
+ signer = Gem::Security::Signer.new PRIVATE_KEY, [PUBLIC_CERT]
73
+
74
+ @tar_writer.add_file_signed 'x', 0644, signer do |io|
75
+ io.write 'a' * 10
76
+ end
77
+
78
+ assert_headers_equal(tar_file_header('x', '', 0644, 10),
79
+ @io.string[0, 512])
80
+ assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
81
+
82
+ digest = signer.digest_algorithm.new
83
+ digest.update 'a' * 10
84
+
85
+ signature = signer.sign digest.digest
86
+
87
+ assert_headers_equal(tar_file_header('x.sig', '', 0444, signature.length),
88
+ @io.string[1024, 512])
89
+ assert_equal "#{signature}#{"\0" * (512 - signature.length)}",
90
+ @io.string[1536, 512]
91
+
92
+ assert_equal 2048, @io.pos
93
+ end
94
+
95
+ def test_add_file_signer_empty
96
+ signer = Gem::Security::Signer.new nil, nil
97
+
98
+ @tar_writer.add_file_signed 'x', 0644, signer do |io|
99
+ io.write 'a' * 10
100
+ end
101
+
102
+ assert_headers_equal(tar_file_header('x', '', 0644, 10),
103
+ @io.string[0, 512])
104
+ assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
105
+
106
+ digest = signer.digest_algorithm.new
107
+ digest.update 'a' * 10
108
+
109
+ assert_equal 1024, @io.pos
110
+ end
111
+
29
112
  def test_add_file_simple
30
113
  @tar_writer.add_file_simple 'x', 0644, 10 do |io| io.write "a" * 10 end
31
114
 
@@ -22,10 +22,10 @@ class TestGemPathSupport < Gem::TestCase
22
22
  def test_initialize_home
23
23
  ps = Gem::PathSupport.new "GEM_HOME" => "#{@tempdir}/foo"
24
24
 
25
- expected = File.join(@tempdir, "foo")
26
- assert_equal expected, ps.home
25
+ assert_equal File.join(@tempdir, "foo"), ps.home
27
26
 
28
- assert_equal [expected, *util_path], ps.path
27
+ expected = util_path + [File.join(@tempdir, 'foo')]
28
+ assert_equal expected, ps.path
29
29
  end
30
30
 
31
31
  if defined?(File::ALT_SEPARATOR) and File::ALT_SEPARATOR
@@ -43,9 +43,9 @@ class TestGemPathSupport < Gem::TestCase
43
43
  assert_equal ENV["GEM_HOME"], ps.home
44
44
 
45
45
  expected = [
46
- ENV["GEM_HOME"],
47
46
  File.join(@tempdir, 'foo'),
48
47
  File.join(@tempdir, 'bar'),
48
+ ENV["GEM_HOME"],
49
49
  ]
50
50
 
51
51
  assert_equal expected, ps.path
@@ -61,32 +61,6 @@ class TestGemPathSupport < Gem::TestCase
61
61
  assert_equal expected, ps.path
62
62
  end
63
63
 
64
- def test_path_equals
65
- ps = Gem::PathSupport.new
66
-
67
- ps.send :path=, ['a', 'b']
68
-
69
- assert_equal [@tempdir, 'a', 'b'], ps.path
70
- end
71
-
72
- def test_path_equals_empty
73
- ps = Gem::PathSupport.new
74
-
75
- ps.send :path=, nil
76
-
77
- assert_equal [@tempdir, 'something'], ps.path
78
- end
79
-
80
- def test_path_equals_empty_no_GEM_PATH
81
- ENV.delete 'GEM_PATH'
82
-
83
- ps = Gem::PathSupport.new
84
-
85
- ps.send :path=, nil
86
-
87
- assert_equal [@tempdir, *Gem.default_path], ps.path
88
- end
89
-
90
64
  def util_path
91
65
  ENV["GEM_PATH"].split(File::PATH_SEPARATOR)
92
66
  end
@@ -51,6 +51,8 @@ class TestGemPlatform < Gem::TestCase
51
51
  'i386-freebsd5' => ['x86', 'freebsd', '5'],
52
52
  'i386-freebsd6' => ['x86', 'freebsd', '6'],
53
53
  'i386-freebsd7' => ['x86', 'freebsd', '7'],
54
+ 'i386-freebsd' => ['x86', 'freebsd', nil],
55
+ 'universal-freebsd' => ['universal', 'freebsd', nil],
54
56
  'i386-java1.5' => ['x86', 'java', '1.5'],
55
57
  'x86-java1.6' => ['x86', 'java', '1.6'],
56
58
  'i386-java1.6' => ['x86', 'java', '1.6'],
@@ -75,6 +77,7 @@ class TestGemPlatform < Gem::TestCase
75
77
  'x86_64-linux' => ['x86_64', 'linux', nil],
76
78
  'x86_64-openbsd3.9' => ['x86_64', 'openbsd', '3.9'],
77
79
  'x86_64-openbsd4.0' => ['x86_64', 'openbsd', '4.0'],
80
+ 'x86_64-openbsd' => ['x86_64', 'openbsd', nil],
78
81
  }
79
82
 
80
83
  test_cases.each do |arch, expected|
@@ -136,12 +139,6 @@ class TestGemPlatform < Gem::TestCase
136
139
  assert_equal '1', platform.version
137
140
  end
138
141
 
139
- def test_empty
140
- platform = Gem::Platform.new 'cpu-other_platform1'
141
- assert_respond_to platform, :empty?
142
- assert_equal false, Gem::Deprecate.skip_during { platform.empty? }
143
- end
144
-
145
142
  def test_to_s
146
143
  if win_platform? then
147
144
  assert_equal 'x86-mswin32-60', Gem::Platform.local.to_s
@@ -0,0 +1,245 @@
1
+ require 'rubygems/test_case'
2
+ require 'rubygems'
3
+ require 'rubygems/rdoc'
4
+
5
+ class TestGemRDoc < Gem::TestCase
6
+
7
+ def setup
8
+ super
9
+
10
+ @a = quick_spec 'a'
11
+
12
+ @rdoc = Gem::RDoc.new @a
13
+
14
+ begin
15
+ Gem::RDoc.load_rdoc
16
+ rescue Gem::DocumentError => e
17
+ skip e.message
18
+ end
19
+
20
+ Gem.configuration[:rdoc] = nil
21
+ end
22
+
23
+ ##
24
+ # RDoc 4 ships with its own Gem::RDoc which overrides this one which is
25
+ # shipped for backwards compatibility.
26
+
27
+ def rdoc_3?
28
+ Gem::Requirement.new('~> 3.0').satisfied_by? @rdoc.class.rdoc_version
29
+ end
30
+
31
+ def rdoc_3_8_or_better?
32
+ Gem::Requirement.new('>= 3.8').satisfied_by? @rdoc.class.rdoc_version
33
+ end
34
+
35
+ def test_initialize
36
+ assert @rdoc.generate_rdoc
37
+ assert @rdoc.generate_ri
38
+
39
+ rdoc = Gem::RDoc.new @a, false, false
40
+
41
+ refute rdoc.generate_rdoc
42
+ refute rdoc.generate_ri
43
+ end
44
+
45
+ def test_delete_legacy_args
46
+ args = %w[
47
+ --inline-source
48
+ --one-file
49
+ --promiscuous
50
+ -p
51
+ ]
52
+
53
+ @rdoc.delete_legacy_args args
54
+
55
+ assert_empty args
56
+ end
57
+
58
+ def test_document
59
+ skip 'RDoc 3 required' unless rdoc_3?
60
+
61
+ options = RDoc::Options.new
62
+ options.files = []
63
+
64
+ @rdoc.instance_variable_set :@rdoc, @rdoc.new_rdoc
65
+ @rdoc.instance_variable_set :@file_info, []
66
+
67
+ @rdoc.document 'darkfish', options, @a.doc_dir('rdoc')
68
+
69
+ assert @rdoc.rdoc_installed?
70
+ end
71
+
72
+ def test_generate
73
+ skip 'RDoc 3 required' unless rdoc_3?
74
+
75
+ FileUtils.mkdir_p @a.doc_dir
76
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
77
+
78
+ @rdoc.generate
79
+
80
+ assert @rdoc.rdoc_installed?
81
+ assert @rdoc.ri_installed?
82
+
83
+ rdoc = @rdoc.instance_variable_get :@rdoc
84
+
85
+ refute rdoc.options.hyperlink_all
86
+ end
87
+
88
+ def test_generate_configuration_rdoc_array
89
+ skip 'RDoc 3 required' unless rdoc_3?
90
+
91
+ Gem.configuration[:rdoc] = %w[-A]
92
+
93
+ FileUtils.mkdir_p @a.doc_dir
94
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
95
+
96
+ @rdoc.generate
97
+
98
+ rdoc = @rdoc.instance_variable_get :@rdoc
99
+
100
+ assert rdoc.options.hyperlink_all
101
+ end
102
+
103
+ def test_generate_configuration_rdoc_string
104
+ skip 'RDoc 3 required' unless rdoc_3?
105
+
106
+ Gem.configuration[:rdoc] = '-A'
107
+
108
+ FileUtils.mkdir_p @a.doc_dir
109
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
110
+
111
+ @rdoc.generate
112
+
113
+ rdoc = @rdoc.instance_variable_get :@rdoc
114
+
115
+ assert rdoc.options.hyperlink_all
116
+ end
117
+
118
+ def test_generate_disabled
119
+ @rdoc.generate_rdoc = false
120
+ @rdoc.generate_ri = false
121
+
122
+ @rdoc.generate
123
+
124
+ refute @rdoc.rdoc_installed?
125
+ refute @rdoc.ri_installed?
126
+ end
127
+
128
+ def test_generate_force
129
+ skip 'RDoc 3 required' unless rdoc_3?
130
+
131
+ FileUtils.mkdir_p @a.doc_dir 'ri'
132
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
133
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
134
+
135
+ @rdoc.force = true
136
+
137
+ @rdoc.generate
138
+
139
+ assert_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
140
+ assert_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
141
+ end
142
+
143
+ def test_generate_no_overwrite
144
+ skip 'RDoc 3 required' unless rdoc_3?
145
+
146
+ FileUtils.mkdir_p @a.doc_dir 'ri'
147
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
148
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
149
+
150
+ @rdoc.generate
151
+
152
+ refute_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
153
+ refute_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
154
+ end
155
+
156
+ def test_generate_legacy
157
+ skip 'RDoc < 3.8 required' if rdoc_3_8_or_better?
158
+
159
+ FileUtils.mkdir_p @a.doc_dir
160
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
161
+
162
+ @rdoc.generate_legacy
163
+
164
+ assert @rdoc.rdoc_installed?
165
+ assert @rdoc.ri_installed?
166
+ end
167
+
168
+ def test_legacy_rdoc
169
+ skip 'RDoc < 3.8 required' if rdoc_3_8_or_better?
170
+
171
+ FileUtils.mkdir_p @a.doc_dir
172
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
173
+
174
+ @rdoc.legacy_rdoc '--op', @a.doc_dir('rdoc')
175
+
176
+ assert @rdoc.rdoc_installed?
177
+ end
178
+
179
+ def test_new_rdoc
180
+ assert_kind_of RDoc::RDoc, @rdoc.new_rdoc
181
+ end
182
+
183
+ def test_rdoc_installed?
184
+ refute @rdoc.rdoc_installed?
185
+
186
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
187
+
188
+ assert @rdoc.rdoc_installed?
189
+ end
190
+
191
+ def test_remove
192
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
193
+ FileUtils.mkdir_p @a.doc_dir 'ri'
194
+
195
+ @rdoc.remove
196
+
197
+ refute @rdoc.rdoc_installed?
198
+ refute @rdoc.ri_installed?
199
+
200
+ assert_path_exists @a.doc_dir
201
+ end
202
+
203
+ def test_remove_unwritable
204
+ skip 'chmod not supported' if Gem.win_platform?
205
+ FileUtils.mkdir_p @a.base_dir
206
+ FileUtils.chmod 0, @a.base_dir
207
+
208
+ e = assert_raises Gem::FilePermissionError do
209
+ @rdoc.remove
210
+ end
211
+
212
+ assert_equal @a.base_dir, e.directory
213
+ ensure
214
+ FileUtils.chmod(0755, @a.base_dir) if File.directory?(@a.base_dir)
215
+ end
216
+
217
+ def test_ri_installed?
218
+ refute @rdoc.ri_installed?
219
+
220
+ FileUtils.mkdir_p @a.doc_dir 'ri'
221
+
222
+ assert @rdoc.ri_installed?
223
+ end
224
+
225
+ def test_setup
226
+ @rdoc.setup
227
+
228
+ assert_path_exists @a.doc_dir
229
+ end
230
+
231
+ def test_setup_unwritable
232
+ skip 'chmod not supported' if Gem.win_platform?
233
+ FileUtils.mkdir_p @a.doc_dir
234
+ FileUtils.chmod 0, @a.doc_dir
235
+
236
+ e = assert_raises Gem::FilePermissionError do
237
+ @rdoc.setup
238
+ end
239
+
240
+ assert_equal @a.doc_dir, e.directory
241
+ ensure
242
+ FileUtils.chmod(0755, @a.doc_dir) if File.directory?(@a.doc_dir)
243
+ end
244
+
245
+ end