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 @@
1
+ �Me2�,�:���46�)���n?�s$�e����ȍ������M�oX~����Ǿ�.Jf�O����1�yu?�"�^���|���kP�j�
@@ -1,36 +0,0 @@
1
- = Algorithmic complexity vulnerability in RubyGems 2.0.7 and older
2
-
3
- RubyGems validates versions with a regular expression that is vulnerable to
4
- denial of service due to a backtracking regular expression. For specially
5
- crafted RubyGems versions attackers can cause denial of service through CPU
6
- consumption.
7
-
8
- RubyGems versions 2.0.7 and older, 2.1.0.rc.1 and 2.1.0.rc.2 are vulnerable.
9
-
10
- Ruby versions 1.9.0 through 2.0.0p247 are vulnerable as they contain embedded
11
- versions of RubyGems.
12
-
13
- It does not appear to be possible to exploit this vulnerability by installing a
14
- gem for RubyGems 1.8.x or 2.0.x. Vulnerable uses of RubyGems API include
15
- packaging a gem (through `gem build`, Gem::Package or Gem::PackageTask),
16
- sending user input to Gem::Version.new, Gem::Version.correct? or use of the
17
- Gem::Version::VERSION_PATTERN or Gem::Version::ANCHORED_VERSION_PATTERN
18
- constants.
19
-
20
- Notably, users of bundler that install gems from git are vulnerable if a
21
- malicious author changes the gemspec to an invalid version.
22
-
23
- The vulnerability can be fixed by changing the first grouping to an atomic
24
- grouping in Gem::Version::VERSION_PATTERN in lib/rubygems/version.rb. For
25
- RubyGems 2.0.x:
26
-
27
- - VERSION_PATTERN = '[0-9]+(\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:
28
- + VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:
29
-
30
- For RubyGems 1.8.x:
31
-
32
- - VERSION_PATTERN = '[0-9]+(\.[0-9a-zA-Z]+)*' # :nodoc:
33
- + VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*' # :nodoc:
34
-
35
- This vulnerability was discovered by Damir Sharipov <dammer2k@gmail.com>
36
-
@@ -1,45 +0,0 @@
1
- = Algorithmic complexity vulnerability in RubyGems 2.1.4 and older
2
-
3
- The patch for CVE-2013-4287 was insufficiently verified so the combined
4
- regular expression for verifying gem version remains vulnerable following
5
- CVE-2013-4287.
6
-
7
- RubyGems validates versions with a regular expression that is vulnerable to
8
- denial of service due to backtracking. For specially crafted RubyGems
9
- versions attackers can cause denial of service through CPU consumption.
10
-
11
- RubyGems versions 2.1.4 and older are vulnerable.
12
-
13
- Ruby versions 1.9.0 through 2.0.0p247 are vulnerable as they contain embedded
14
- versions of RubyGems.
15
-
16
- It does not appear to be possible to exploit this vulnerability by installing a
17
- gem for RubyGems 1.8.x or newer. Vulnerable uses of RubyGems API include
18
- packaging a gem (through `gem build`, Gem::Package or Gem::PackageTask),
19
- sending user input to Gem::Version.new, Gem::Version.correct? or use of the
20
- Gem::Version::VERSION_PATTERN or Gem::Version::ANCHORED_VERSION_PATTERN
21
- constants.
22
-
23
- Notably, users of bundler that install gems from git are vulnerable if a
24
- malicious author changes the gemspec to an invalid version.
25
-
26
- The vulnerability can be fixed by changing the "*" repetition to a "?"
27
- repetition in Gem::Version::ANCHORED_VERSION_PATTERN in
28
- lib/rubygems/version.rb. For RubyGems 2.1.x:
29
-
30
- - ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})*\s*\z/ # :nodoc:
31
- + ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
32
-
33
- For RubyGems 2.0.x:
34
-
35
- - ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})*\s*\z/ # :nodoc:
36
- + ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
37
-
38
- For RubyGems 1.8.x:
39
-
40
- - ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})*\s*\z/ # :nodoc:
41
- + ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
42
-
43
-
44
- This vulnerability was discovered by Alexander Cherepanov <cherepan@mccme.ru>
45
-
@@ -1,27 +0,0 @@
1
- # You must ensure that rake, hoe, and minitest are already installed in specified RVM interpreter
2
- export rvm_install_on_use_flag=1
3
- export rvm_gemset_create_on_use_flag=1
4
- rvm use $1
5
- . "$HOME/.rvm/environments/ruby-$1" # There seems to be a bug where 'rvm use' from within a script doesn't override default interpreter, so we have to manually source the rvm environment file for the proper interpreter
6
-
7
- # TODO: How can you make Hoe's check_extra_deps not use sudo?
8
- #rake check_extra_deps default
9
- # install gems manually for now
10
- gem install 'rake' --no-ri --no-rdoc
11
- gem install 'hoe' --no-ri --no-rdoc
12
- gem install 'builder' -v '~> 2.1' --no-ri --no-rdoc
13
- gem install 'hoe-seattlerb' -v '~> 1.2' --no-ri --no-rdoc
14
- gem install 'minitest' -v '~> 1.4' --no-ri --no-rdoc
15
- gem install 'session' -v '~> 2.4' --no-ri --no-rdoc
16
- gem install 'rubyforge' --no-ri --no-rdoc
17
-
18
- echo "----------------------------"
19
- echo "Build environment:"
20
- cat /etc/issue
21
- uname -a
22
- ruby -v
23
- gem env
24
- gem list
25
- echo "----------------------------"
26
-
27
- rake default
@@ -1,32 +0,0 @@
1
- # Project-specific configuration for CruiseControl.rb
2
- require 'socket'
3
-
4
- Project.configure do |project|
5
- # To add a build for a new interpreter (from ccrb root):
6
- # ./cruise add RubyGems-x_y_z-pxxx -s git -r git://github.com/rubygems/rubygems.git
7
- interpreter = Regexp.new(/RubyGems-(.*)$/i).match(project.name)[1]
8
- interpreter.gsub!('_','.')
9
-
10
- # only send notifications from the official ci box
11
- if Socket.gethostname =~ /cibuilder.pivotallabs.com/
12
- # explicitly enable dev list notification only for interpreters which should be green
13
- interpreters_with_enabled_notification = [
14
- '1.8.7-p330',
15
- '1.9.1-p378',
16
- '1.9.2-p136'
17
- ]
18
- if interpreters_with_enabled_notification.include?(interpreter)
19
- project.email_notifier.emails = ['rubygems-developers@rubyforge.org']
20
- end
21
-
22
- # Always notify the following for all interpreters:
23
- project.email_notifier.emails.concat([
24
- 'thewoolleyman+rubygems-ci@gmail.com'
25
- ])
26
- end
27
-
28
- project.build_command = "./ci_build.sh '#{interpreter}@rubygems'"
29
-
30
- project.email_notifier.from = 'thewoolleyman+rubygems-ci@gmail.com'
31
- project.scheduler.polling_interval = 5.minutes
32
- end
@@ -1,13 +0,0 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
- # N.B. This file is used by Config.datadir in rubygems.rb, and must not be
8
- # removed before that require is removed. I require to avoid warning more than
9
- # once.
10
-
11
- warn 'rbconfig/datadir.rb and {Rb}Config.datadir is being deprecated from '\
12
- 'RubyGems. It will be removed completely on or after June 2011. If you '\
13
- 'wish to rely on a datadir, please use Gem.datadir.'
@@ -1,99 +0,0 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
- require 'rubygems'
8
- require 'rubygems/user_interaction'
9
-
10
- Gem.load_yaml
11
-
12
- require 'rubygems/package'
13
-
14
- ##
15
- # The Builder class processes RubyGem specification files
16
- # to produce a .gem file.
17
-
18
- class Gem::Builder
19
-
20
- include Gem::UserInteraction
21
-
22
- ##
23
- # Constructs a builder instance for the provided specification
24
- #
25
- # spec:: [Gem::Specification] The specification instance
26
-
27
- def initialize(spec)
28
- @spec = spec
29
- end
30
-
31
- ##
32
- # Builds the gem from the specification. Returns the name of the file
33
- # written.
34
-
35
- def build(skip_validation=false)
36
- @spec.mark_version
37
- @spec.validate unless skip_validation
38
- @signer = sign
39
- write_package
40
- say success if Gem.configuration.verbose
41
- File.basename @spec.cache_file
42
- end
43
-
44
- def success
45
- <<-EOM
46
- Successfully built RubyGem
47
- Name: #{@spec.name}
48
- Version: #{@spec.version}
49
- File: #{File.basename @spec.cache_file}
50
- EOM
51
- end
52
-
53
- private
54
-
55
- ##
56
- # If the signing key was specified, then load the file, and swap to the
57
- # public key (TODO: we should probably just omit the signing key in favor of
58
- # the signing certificate, but that's for the future, also the signature
59
- # algorithm should be configurable)
60
-
61
- def sign
62
- signer = nil
63
-
64
- if @spec.respond_to?(:signing_key) and @spec.signing_key then
65
- require 'rubygems/security'
66
-
67
- signer = Gem::Security::Signer.new @spec.signing_key, @spec.cert_chain
68
- @spec.signing_key = nil
69
- @spec.cert_chain = signer.cert_chain.map { |cert| cert.to_s }
70
- end
71
-
72
- signer
73
- end
74
-
75
- def write_package
76
- file_name = File.basename @spec.cache_file
77
- open file_name, 'wb' do |gem_io|
78
- Gem::Package.open gem_io, 'w', @signer do |pkg|
79
- yaml = @spec.to_yaml
80
- pkg.metadata = yaml
81
-
82
- @spec.files.each do |file|
83
- next if File.directory?(file)
84
- next if file == file_name # Don't add gem onto itself
85
-
86
- stat = File.stat(file)
87
- mode = stat.mode & 0777
88
- size = stat.size
89
-
90
- pkg.add_file_simple file, mode, size do |tar_io|
91
- tar_io.write open(file, "rb") { |f| f.read }
92
- end
93
- end
94
- end
95
- end
96
- end
97
-
98
- end
99
-
@@ -1,69 +0,0 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
- module Kernel
8
-
9
- if defined?(gem_original_require) then
10
- # Ruby ships with a custom_require, override its require
11
- remove_method :require
12
- else
13
- ##
14
- # The Kernel#require from before RubyGems was loaded.
15
-
16
- alias gem_original_require require
17
- private :gem_original_require
18
- end
19
-
20
- ##
21
- # When RubyGems is required, Kernel#require is replaced with our own which
22
- # is capable of loading gems on demand.
23
- #
24
- # When you call <tt>require 'x'</tt>, this is what happens:
25
- # * If the file can be loaded from the existing Ruby loadpath, it
26
- # is.
27
- # * Otherwise, installed gems are searched for a file that matches.
28
- # If it's found in gem 'y', that gem is activated (added to the
29
- # loadpath).
30
- #
31
- # The normal <tt>require</tt> functionality of returning false if
32
- # that file has already been loaded is preserved.
33
-
34
- def require path
35
- if Gem.unresolved_deps.empty? then
36
- gem_original_require path
37
- else
38
- spec = Gem::Specification.find { |s|
39
- s.activated? and s.contains_requirable_file? path
40
- }
41
-
42
- unless spec then
43
- found_specs = Gem::Specification.find_in_unresolved path
44
- unless found_specs.empty? then
45
- found_specs = [found_specs.last]
46
- else
47
- found_specs = Gem::Specification.find_in_unresolved_tree path
48
- end
49
-
50
- found_specs.each do |found_spec|
51
- found_spec.activate
52
- end
53
- end
54
-
55
- return gem_original_require path
56
- end
57
- rescue LoadError => load_error
58
- if load_error.message.start_with?("Could not find") or
59
- (load_error.message.end_with?(path) and Gem.try_activate(path)) then
60
- return gem_original_require(path)
61
- end
62
-
63
- raise load_error
64
- end
65
-
66
- private :require
67
-
68
- end
69
-
@@ -1,243 +0,0 @@
1
- #--
2
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3
- # All rights reserved.
4
- # See LICENSE.txt for permissions.
5
- #++
6
-
7
- require 'rubygems'
8
-
9
- ##
10
- # The documentation manager generates RDoc and RI for RubyGems.
11
-
12
- class Gem::DocManager
13
-
14
- include Gem::UserInteraction
15
-
16
- @configured_args = []
17
-
18
- def self.configured_args
19
- @configured_args ||= []
20
- end
21
-
22
- def self.configured_args=(args)
23
- case args
24
- when Array
25
- @configured_args = args
26
- when String
27
- @configured_args = args.split
28
- end
29
- end
30
-
31
- ##
32
- # Load RDoc from a gem if it is available, otherwise from Ruby's stdlib
33
-
34
- def self.load_rdoc
35
- begin
36
- gem 'rdoc'
37
- rescue Gem::LoadError
38
- # use built-in RDoc
39
- end
40
-
41
- begin
42
- require 'rdoc/rdoc'
43
-
44
- @rdoc_version = if defined? RDoc::VERSION then
45
- Gem::Version.new RDoc::VERSION
46
- else
47
- Gem::Version.new '1.0.1' # HACK parsing is hard
48
- end
49
-
50
- rescue LoadError => e
51
- raise Gem::DocumentError,
52
- "ERROR: RDoc documentation generator not installed: #{e}"
53
- end
54
- end
55
-
56
- def self.rdoc_version
57
- @rdoc_version
58
- end
59
-
60
- ##
61
- # Updates the RI cache for RDoc 2 if it is installed
62
-
63
- def self.update_ri_cache
64
- load_rdoc rescue return
65
-
66
- return unless defined? RDoc::VERSION # RDoc 1 does not have VERSION
67
-
68
- require 'rdoc/ri/driver'
69
-
70
- options = {
71
- :use_cache => true,
72
- :use_system => true,
73
- :use_site => true,
74
- :use_home => true,
75
- :use_gems => true,
76
- :formatter => RDoc::RI::Formatter,
77
- }
78
-
79
- RDoc::RI::Driver.new(options).class_cache
80
- end
81
-
82
- ##
83
- # Create a document manager for +spec+. +rdoc_args+ contains arguments for
84
- # RDoc (template etc.) as a String.
85
-
86
- def initialize(spec, rdoc_args="")
87
- require 'fileutils'
88
- @spec = spec
89
- @doc_dir = spec.doc_dir
90
- @rdoc_args = rdoc_args.nil? ? [] : rdoc_args.split
91
- end
92
-
93
- ##
94
- # Is the RDoc documentation installed?
95
-
96
- def rdoc_installed?
97
- File.exist?(File.join(@doc_dir, "rdoc"))
98
- end
99
-
100
- ##
101
- # Is the RI documentation installed?
102
-
103
- def ri_installed?
104
- File.exist?(File.join(@doc_dir, "ri"))
105
- end
106
-
107
- ##
108
- # Generate the RI documents for this gem spec.
109
- #
110
- # Note that if both RI and RDoc documents are generated from the same
111
- # process, the RI docs should be done first (a likely bug in RDoc will cause
112
- # RI docs generation to fail if run after RDoc).
113
-
114
- def generate_ri
115
- setup_rdoc
116
- install_ri # RDoc bug, ri goes first
117
-
118
- FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
119
- end
120
-
121
- ##
122
- # Generate the RDoc documents for this gem spec.
123
- #
124
- # Note that if both RI and RDoc documents are generated from the same
125
- # process, the RI docs should be done first (a likely bug in RDoc will cause
126
- # RI docs generation to fail if run after RDoc).
127
-
128
- def generate_rdoc
129
- setup_rdoc
130
- install_rdoc
131
-
132
- FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
133
- end
134
-
135
- ##
136
- # Generate and install RDoc into the documentation directory
137
-
138
- def install_rdoc
139
- rdoc_dir = File.join @doc_dir, 'rdoc'
140
-
141
- FileUtils.rm_rf rdoc_dir
142
-
143
- say "Installing RDoc documentation for #{@spec.full_name}..."
144
- run_rdoc '--op', rdoc_dir
145
- end
146
-
147
- ##
148
- # Generate and install RI into the documentation directory
149
-
150
- def install_ri
151
- ri_dir = File.join @doc_dir, 'ri'
152
-
153
- FileUtils.rm_rf ri_dir
154
-
155
- say "Installing ri documentation for #{@spec.full_name}..."
156
- run_rdoc '--ri', '--op', ri_dir
157
- end
158
-
159
- ##
160
- # Run RDoc with +args+, which is an ARGV style argument list
161
-
162
- def run_rdoc(*args)
163
- args << @spec.rdoc_options
164
- args << self.class.configured_args
165
- args << @spec.require_paths.clone
166
- args << @spec.extra_rdoc_files
167
- args << '--title' << "#{@spec.full_name} Documentation"
168
- args << '--quiet'
169
- args = args.flatten.map do |arg| arg.to_s end
170
-
171
- if self.class.rdoc_version >= Gem::Version.new('2.4.0') then
172
- args.delete '--inline-source'
173
- args.delete '--promiscuous'
174
- args.delete '-p'
175
- args.delete '--one-file'
176
- # HACK more
177
- end
178
-
179
- debug_args = args.dup
180
-
181
- r = RDoc::RDoc.new
182
-
183
- old_pwd = Dir.pwd
184
- Dir.chdir @spec.full_gem_path
185
-
186
- say "rdoc #{args.join ' '}" if Gem.configuration.really_verbose
187
-
188
- begin
189
- r.document args
190
- rescue Errno::EACCES => e
191
- dirname = File.dirname e.message.split("-")[1].strip
192
- raise Gem::FilePermissionError.new(dirname)
193
- rescue Interrupt => e
194
- raise e
195
- rescue Exception => ex
196
- alert_error "While generating documentation for #{@spec.full_name}"
197
- ui.errs.puts "... MESSAGE: #{ex}"
198
- ui.errs.puts "... RDOC args: #{debug_args.join(' ')}"
199
- ui.errs.puts "\t#{ex.backtrace.join "\n\t"}" if
200
- Gem.configuration.backtrace
201
- terminate_interaction 1
202
- ensure
203
- Dir.chdir old_pwd
204
- end
205
- end
206
-
207
- def setup_rdoc
208
- if File.exist?(@doc_dir) && !File.writable?(@doc_dir) then
209
- raise Gem::FilePermissionError.new(@doc_dir)
210
- end
211
-
212
- FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
213
-
214
- self.class.load_rdoc
215
- end
216
-
217
- ##
218
- # Remove RDoc and RI documentation
219
-
220
- def uninstall_doc
221
- base_dir = @spec.base_dir
222
- raise Gem::FilePermissionError.new base_dir unless File.writable? base_dir
223
-
224
- # TODO: ok... that's twice... ugh
225
- old_name = [
226
- @spec.name, @spec.version, @spec.original_platform].join '-'
227
-
228
- doc_dir = @spec.doc_dir
229
- unless File.directory? doc_dir then
230
- doc_dir = File.join File.dirname(doc_dir), old_name
231
- end
232
-
233
- ri_dir = @spec.ri_dir
234
- unless File.directory? ri_dir then
235
- ri_dir = File.join File.dirname(ri_dir), old_name
236
- end
237
-
238
- FileUtils.rm_rf doc_dir
239
- FileUtils.rm_rf ri_dir
240
- end
241
-
242
- end
243
-