rubygems-update 2.7.11 → 3.0.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 (350) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +66 -0
  3. data/.travis.yml +22 -18
  4. data/CONTRIBUTING.md +141 -0
  5. data/History.txt +289 -19
  6. data/MAINTAINERS.txt +1 -0
  7. data/Manifest.txt +16 -11
  8. data/POLICIES.md +92 -0
  9. data/README.md +47 -26
  10. data/Rakefile +47 -207
  11. data/{UPGRADING.rdoc → UPGRADING.md} +31 -32
  12. data/appveyor.yml +20 -45
  13. data/bin/gem +1 -2
  14. data/bin/update_rubygems +2 -3
  15. data/bundler/CHANGELOG.md +54 -0
  16. data/bundler/bundler.gemspec +7 -1
  17. data/bundler/lib/bundler.rb +26 -8
  18. data/bundler/lib/bundler/build_metadata.rb +2 -2
  19. data/bundler/lib/bundler/cli.rb +63 -21
  20. data/bundler/lib/bundler/cli/add.rb +15 -5
  21. data/bundler/lib/bundler/cli/binstubs.rb +8 -2
  22. data/bundler/lib/bundler/cli/doctor.rb +47 -1
  23. data/bundler/lib/bundler/cli/install.rb +8 -5
  24. data/bundler/lib/bundler/cli/list.rb +41 -5
  25. data/bundler/lib/bundler/cli/outdated.rb +7 -1
  26. data/bundler/lib/bundler/cli/pristine.rb +4 -0
  27. data/bundler/lib/bundler/cli/remove.rb +18 -0
  28. data/bundler/lib/bundler/definition.rb +15 -16
  29. data/bundler/lib/bundler/dependency.rb +2 -2
  30. data/bundler/lib/bundler/dsl.rb +19 -3
  31. data/bundler/lib/bundler/feature_flag.rb +7 -0
  32. data/bundler/lib/bundler/gem_version_promoter.rb +4 -2
  33. data/bundler/lib/bundler/injector.rb +168 -9
  34. data/bundler/lib/bundler/installer.rb +29 -6
  35. data/bundler/lib/bundler/installer/parallel_installer.rb +5 -0
  36. data/bundler/lib/bundler/plugin.rb +10 -3
  37. data/bundler/lib/bundler/plugin/events.rb +61 -0
  38. data/bundler/lib/bundler/resolver.rb +2 -2
  39. data/bundler/lib/bundler/runtime.rb +8 -2
  40. data/bundler/lib/bundler/settings.rb +24 -3
  41. data/bundler/lib/bundler/settings/validator.rb +23 -0
  42. data/bundler/lib/bundler/shared_helpers.rb +19 -3
  43. data/bundler/lib/bundler/source.rb +9 -9
  44. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -0
  45. data/bundler/lib/bundler/version.rb +1 -1
  46. data/bundler/man/bundle-add.ronn +13 -2
  47. data/bundler/man/bundle-config.ronn +21 -0
  48. data/bundler/man/bundle-install.ronn +1 -1
  49. data/bundler/man/bundle-list.ronn +19 -1
  50. data/bundler/man/bundle-outdated.ronn +4 -0
  51. data/bundler/man/bundle-remove.ronn +23 -0
  52. data/bundler/man/bundle-update.ronn +1 -1
  53. data/lib/rubygems.rb +70 -96
  54. data/lib/rubygems/available_set.rb +1 -1
  55. data/lib/rubygems/basic_specification.rb +12 -12
  56. data/lib/rubygems/bundler_version_finder.rb +3 -3
  57. data/lib/rubygems/command.rb +22 -15
  58. data/lib/rubygems/command_manager.rb +20 -11
  59. data/lib/rubygems/commands/build_command.rb +27 -8
  60. data/lib/rubygems/commands/cert_command.rb +45 -24
  61. data/lib/rubygems/commands/check_command.rb +1 -1
  62. data/lib/rubygems/commands/cleanup_command.rb +14 -7
  63. data/lib/rubygems/commands/contents_command.rb +14 -15
  64. data/lib/rubygems/commands/dependency_command.rb +17 -17
  65. data/lib/rubygems/commands/environment_command.rb +20 -1
  66. data/lib/rubygems/commands/fetch_command.rb +2 -3
  67. data/lib/rubygems/commands/generate_index_command.rb +2 -3
  68. data/lib/rubygems/commands/help_command.rb +12 -13
  69. data/lib/rubygems/commands/info_command.rb +33 -0
  70. data/lib/rubygems/commands/install_command.rb +21 -17
  71. data/lib/rubygems/commands/list_command.rb +0 -1
  72. data/lib/rubygems/commands/lock_command.rb +3 -4
  73. data/lib/rubygems/commands/open_command.rb +16 -10
  74. data/lib/rubygems/commands/owner_command.rb +20 -11
  75. data/lib/rubygems/commands/pristine_command.rb +23 -16
  76. data/lib/rubygems/commands/push_command.rb +17 -8
  77. data/lib/rubygems/commands/query_command.rb +24 -24
  78. data/lib/rubygems/commands/rdoc_command.rb +3 -4
  79. data/lib/rubygems/commands/search_command.rb +0 -1
  80. data/lib/rubygems/commands/server_command.rb +1 -2
  81. data/lib/rubygems/commands/setup_command.rb +78 -38
  82. data/lib/rubygems/commands/signin_command.rb +2 -1
  83. data/lib/rubygems/commands/signout_command.rb +2 -2
  84. data/lib/rubygems/commands/sources_command.rb +11 -12
  85. data/lib/rubygems/commands/specification_command.rb +7 -7
  86. data/lib/rubygems/commands/uninstall_command.rb +41 -19
  87. data/lib/rubygems/commands/unpack_command.rb +16 -7
  88. data/lib/rubygems/commands/update_command.rb +28 -23
  89. data/lib/rubygems/commands/which_command.rb +4 -5
  90. data/lib/rubygems/commands/yank_command.rb +1 -2
  91. data/lib/rubygems/compatibility.rb +1 -21
  92. data/lib/rubygems/config_file.rb +36 -36
  93. data/lib/rubygems/core_ext/kernel_require.rb +6 -6
  94. data/lib/rubygems/core_ext/kernel_warn.rb +45 -0
  95. data/lib/rubygems/defaults.rb +31 -12
  96. data/lib/rubygems/dependency.rb +14 -14
  97. data/lib/rubygems/dependency_installer.rb +29 -31
  98. data/lib/rubygems/dependency_list.rb +8 -9
  99. data/lib/rubygems/deprecate.rb +2 -3
  100. data/lib/rubygems/doctor.rb +5 -6
  101. data/lib/rubygems/errors.rb +3 -3
  102. data/lib/rubygems/exceptions.rb +11 -4
  103. data/lib/rubygems/ext.rb +0 -1
  104. data/lib/rubygems/ext/build_error.rb +0 -1
  105. data/lib/rubygems/ext/builder.rb +50 -23
  106. data/lib/rubygems/ext/cmake_builder.rb +2 -2
  107. data/lib/rubygems/ext/configure_builder.rb +2 -3
  108. data/lib/rubygems/ext/ext_conf_builder.rb +8 -7
  109. data/lib/rubygems/ext/rake_builder.rb +16 -18
  110. data/lib/rubygems/gem_runner.rb +2 -2
  111. data/lib/rubygems/gemcutter_utilities.rb +40 -13
  112. data/lib/rubygems/indexer.rb +19 -12
  113. data/lib/rubygems/install_default_message.rb +0 -1
  114. data/lib/rubygems/install_message.rb +0 -1
  115. data/lib/rubygems/install_update_options.rb +2 -28
  116. data/lib/rubygems/installer.rb +95 -75
  117. data/lib/rubygems/installer_test_case.rb +0 -14
  118. data/lib/rubygems/local_remote_options.rb +5 -4
  119. data/lib/rubygems/mock_gem_ui.rb +3 -4
  120. data/lib/rubygems/name_tuple.rb +4 -4
  121. data/lib/rubygems/package.rb +90 -73
  122. data/lib/rubygems/package/digest_io.rb +3 -4
  123. data/lib/rubygems/package/file_source.rb +3 -4
  124. data/lib/rubygems/package/io_source.rb +1 -2
  125. data/lib/rubygems/package/old.rb +8 -16
  126. data/lib/rubygems/package/source.rb +0 -1
  127. data/lib/rubygems/package/tar_header.rb +2 -2
  128. data/lib/rubygems/package/tar_reader.rb +2 -4
  129. data/lib/rubygems/package/tar_reader/entry.rb +20 -4
  130. data/lib/rubygems/package/tar_test_case.rb +2 -8
  131. data/lib/rubygems/package/tar_writer.rb +13 -15
  132. data/lib/rubygems/package_task.rb +0 -1
  133. data/lib/rubygems/path_support.rb +16 -6
  134. data/lib/rubygems/platform.rb +4 -5
  135. data/lib/rubygems/psych_tree.rb +1 -1
  136. data/lib/rubygems/rdoc.rb +0 -311
  137. data/lib/rubygems/remote_fetcher.rb +34 -48
  138. data/lib/rubygems/request.rb +16 -15
  139. data/lib/rubygems/request/connection_pools.rb +24 -13
  140. data/lib/rubygems/request/http_pool.rb +3 -4
  141. data/lib/rubygems/request/https_pool.rb +1 -3
  142. data/lib/rubygems/request_set.rb +52 -25
  143. data/lib/rubygems/request_set/gem_dependency_api.rb +36 -40
  144. data/lib/rubygems/request_set/lockfile.rb +12 -12
  145. data/lib/rubygems/request_set/lockfile/parser.rb +18 -29
  146. data/lib/rubygems/request_set/lockfile/tokenizer.rb +9 -9
  147. data/lib/rubygems/requirement.rb +16 -16
  148. data/lib/rubygems/resolver.rb +10 -15
  149. data/lib/rubygems/resolver/activation_request.rb +6 -6
  150. data/lib/rubygems/resolver/api_set.rb +5 -6
  151. data/lib/rubygems/resolver/api_specification.rb +2 -3
  152. data/lib/rubygems/resolver/best_set.rb +5 -6
  153. data/lib/rubygems/resolver/composed_set.rb +5 -6
  154. data/lib/rubygems/resolver/conflict.rb +5 -5
  155. data/lib/rubygems/resolver/current_set.rb +1 -2
  156. data/lib/rubygems/resolver/dependency_request.rb +4 -4
  157. data/lib/rubygems/resolver/git_set.rb +5 -6
  158. data/lib/rubygems/resolver/git_specification.rb +4 -5
  159. data/lib/rubygems/resolver/index_set.rb +5 -6
  160. data/lib/rubygems/resolver/index_specification.rb +3 -4
  161. data/lib/rubygems/resolver/installed_specification.rb +3 -4
  162. data/lib/rubygems/resolver/installer_set.rb +12 -12
  163. data/lib/rubygems/resolver/local_specification.rb +1 -2
  164. data/lib/rubygems/resolver/lock_set.rb +5 -6
  165. data/lib/rubygems/resolver/lock_specification.rb +7 -8
  166. data/lib/rubygems/resolver/requirement_list.rb +1 -1
  167. data/lib/rubygems/resolver/set.rb +2 -2
  168. data/lib/rubygems/resolver/source_set.rb +4 -5
  169. data/lib/rubygems/resolver/spec_specification.rb +1 -2
  170. data/lib/rubygems/resolver/specification.rb +10 -7
  171. data/lib/rubygems/resolver/stats.rb +1 -1
  172. data/lib/rubygems/resolver/vendor_set.rb +4 -5
  173. data/lib/rubygems/resolver/vendor_specification.rb +2 -3
  174. data/lib/rubygems/safe_yaml.rb +18 -10
  175. data/lib/rubygems/security.rb +21 -22
  176. data/lib/rubygems/security/policies.rb +1 -2
  177. data/lib/rubygems/security/policy.rb +25 -25
  178. data/lib/rubygems/security/signer.rb +72 -24
  179. data/lib/rubygems/security/trust_dir.rb +10 -10
  180. data/lib/rubygems/server.rb +21 -21
  181. data/lib/rubygems/source.rb +16 -25
  182. data/lib/rubygems/source/git.rb +9 -10
  183. data/lib/rubygems/source/installed.rb +3 -4
  184. data/lib/rubygems/source/local.rb +7 -7
  185. data/lib/rubygems/source/lock.rb +4 -4
  186. data/lib/rubygems/source/specific_file.rb +5 -5
  187. data/lib/rubygems/source/vendor.rb +2 -3
  188. data/lib/rubygems/source_list.rb +2 -2
  189. data/lib/rubygems/source_local.rb +0 -1
  190. data/lib/rubygems/spec_fetcher.rb +5 -6
  191. data/lib/rubygems/specification.rb +199 -536
  192. data/lib/rubygems/specification_policy.rb +407 -0
  193. data/lib/rubygems/ssl_certs/{rubygems.org → index.rubygems.org}/GlobalSignRootCA.pem +0 -0
  194. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
  195. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
  196. data/lib/rubygems/stub_specification.rb +11 -15
  197. data/lib/rubygems/test_case.rb +141 -66
  198. data/lib/rubygems/test_utilities.rb +20 -35
  199. data/lib/rubygems/text.rb +6 -6
  200. data/lib/rubygems/uninstaller.rb +37 -26
  201. data/lib/rubygems/uri_formatter.rb +1 -2
  202. data/lib/rubygems/user_interaction.rb +38 -93
  203. data/lib/rubygems/util.rb +20 -14
  204. data/lib/rubygems/util/licenses.rb +27 -1
  205. data/lib/rubygems/util/list.rb +1 -1
  206. data/lib/rubygems/validator.rb +4 -5
  207. data/lib/rubygems/version.rb +15 -15
  208. data/lib/rubygems/version_option.rb +2 -3
  209. data/rubygems-update.gemspec +43 -0
  210. data/setup.rb +2 -8
  211. data/test/rubygems/rubygems_plugin.rb +0 -1
  212. data/test/rubygems/simple_gem.rb +1 -1
  213. data/test/rubygems/test_bundled_ca.rb +4 -7
  214. data/test/rubygems/test_config.rb +7 -2
  215. data/test/rubygems/test_gem.rb +161 -130
  216. data/test/rubygems/test_gem_command.rb +0 -1
  217. data/test/rubygems/test_gem_command_manager.rb +8 -3
  218. data/test/rubygems/test_gem_commands_build_command.rb +219 -15
  219. data/test/rubygems/test_gem_commands_cert_command.rb +69 -8
  220. data/test/rubygems/test_gem_commands_check_command.rb +1 -1
  221. data/test/rubygems/test_gem_commands_cleanup_command.rb +27 -1
  222. data/test/rubygems/test_gem_commands_contents_command.rb +1 -2
  223. data/test/rubygems/test_gem_commands_dependency_command.rb +33 -34
  224. data/test/rubygems/test_gem_commands_environment_command.rb +1 -0
  225. data/test/rubygems/test_gem_commands_fetch_command.rb +0 -1
  226. data/test/rubygems/test_gem_commands_generate_index_command.rb +0 -1
  227. data/test/rubygems/test_gem_commands_help_command.rb +7 -4
  228. data/test/rubygems/test_gem_commands_info_command.rb +44 -0
  229. data/test/rubygems/test_gem_commands_install_command.rb +79 -12
  230. data/test/rubygems/test_gem_commands_lock_command.rb +0 -1
  231. data/test/rubygems/test_gem_commands_open_command.rb +29 -0
  232. data/test/rubygems/test_gem_commands_outdated_command.rb +0 -1
  233. data/test/rubygems/test_gem_commands_owner_command.rb +93 -57
  234. data/test/rubygems/test_gem_commands_pristine_command.rb +65 -30
  235. data/test/rubygems/test_gem_commands_push_command.rb +39 -0
  236. data/test/rubygems/test_gem_commands_query_command.rb +102 -100
  237. data/test/rubygems/test_gem_commands_search_command.rb +0 -1
  238. data/test/rubygems/test_gem_commands_server_command.rb +0 -1
  239. data/test/rubygems/test_gem_commands_setup_command.rb +39 -8
  240. data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
  241. data/test/rubygems/test_gem_commands_sources_command.rb +0 -1
  242. data/test/rubygems/test_gem_commands_specification_command.rb +2 -3
  243. data/test/rubygems/test_gem_commands_stale_command.rb +3 -2
  244. data/test/rubygems/test_gem_commands_uninstall_command.rb +81 -7
  245. data/test/rubygems/test_gem_commands_unpack_command.rb +17 -1
  246. data/test/rubygems/test_gem_commands_update_command.rb +19 -2
  247. data/test/rubygems/test_gem_commands_which_command.rb +0 -1
  248. data/test/rubygems/test_gem_commands_yank_command.rb +0 -1
  249. data/test/rubygems/test_gem_config_file.rb +4 -2
  250. data/test/rubygems/test_gem_dependency.rb +0 -1
  251. data/test/rubygems/test_gem_dependency_installer.rb +8 -5
  252. data/test/rubygems/test_gem_dependency_list.rb +6 -7
  253. data/test/rubygems/test_gem_dependency_resolution_error.rb +0 -1
  254. data/test/rubygems/test_gem_doctor.rb +1 -2
  255. data/test/rubygems/test_gem_ext_builder.rb +10 -23
  256. data/test/rubygems/test_gem_ext_cmake_builder.rb +5 -4
  257. data/test/rubygems/test_gem_ext_configure_builder.rb +3 -3
  258. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +8 -9
  259. data/test/rubygems/test_gem_ext_rake_builder.rb +20 -5
  260. data/test/rubygems/test_gem_gem_runner.rb +0 -1
  261. data/test/rubygems/test_gem_gemcutter_utilities.rb +32 -6
  262. data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -1
  263. data/test/rubygems/test_gem_indexer.rb +1 -2
  264. data/test/rubygems/test_gem_install_update_options.rb +1 -20
  265. data/test/rubygems/test_gem_installer.rb +69 -203
  266. data/test/rubygems/test_gem_local_remote_options.rb +3 -3
  267. data/test/rubygems/test_gem_name_tuple.rb +0 -1
  268. data/test/rubygems/test_gem_package.rb +59 -50
  269. data/test/rubygems/test_gem_package_old.rb +0 -1
  270. data/test/rubygems/test_gem_package_tar_header.rb +1 -2
  271. data/test/rubygems/test_gem_package_tar_reader.rb +0 -1
  272. data/test/rubygems/test_gem_package_tar_reader_entry.rb +11 -0
  273. data/test/rubygems/test_gem_package_tar_writer.rb +40 -7
  274. data/test/rubygems/test_gem_package_task.rb +2 -2
  275. data/test/rubygems/test_gem_path_support.rb +28 -11
  276. data/test/rubygems/test_gem_platform.rb +4 -5
  277. data/test/rubygems/test_gem_rdoc.rb +1 -2
  278. data/test/rubygems/test_gem_remote_fetcher.rb +111 -130
  279. data/test/rubygems/test_gem_request.rb +5 -5
  280. data/test/rubygems/test_gem_request_connection_pools.rb +24 -3
  281. data/test/rubygems/test_gem_request_set.rb +5 -5
  282. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +2 -7
  283. data/test/rubygems/test_gem_request_set_lockfile.rb +1 -2
  284. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +4 -9
  285. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
  286. data/test/rubygems/test_gem_requirement.rb +18 -4
  287. data/test/rubygems/test_gem_resolver.rb +13 -17
  288. data/test/rubygems/test_gem_resolver_activation_request.rb +0 -1
  289. data/test/rubygems/test_gem_resolver_api_set.rb +0 -1
  290. data/test/rubygems/test_gem_resolver_api_specification.rb +0 -1
  291. data/test/rubygems/test_gem_resolver_best_set.rb +0 -1
  292. data/test/rubygems/test_gem_resolver_composed_set.rb +0 -1
  293. data/test/rubygems/test_gem_resolver_conflict.rb +0 -1
  294. data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -1
  295. data/test/rubygems/test_gem_resolver_git_set.rb +0 -1
  296. data/test/rubygems/test_gem_resolver_git_specification.rb +0 -1
  297. data/test/rubygems/test_gem_resolver_index_set.rb +0 -1
  298. data/test/rubygems/test_gem_resolver_index_specification.rb +0 -1
  299. data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -1
  300. data/test/rubygems/test_gem_resolver_installer_set.rb +2 -3
  301. data/test/rubygems/test_gem_resolver_local_specification.rb +0 -1
  302. data/test/rubygems/test_gem_resolver_lock_set.rb +0 -1
  303. data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -1
  304. data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -1
  305. data/test/rubygems/test_gem_resolver_specification.rb +1 -2
  306. data/test/rubygems/test_gem_resolver_vendor_set.rb +0 -1
  307. data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -1
  308. data/test/rubygems/test_gem_security.rb +1 -3
  309. data/test/rubygems/test_gem_security_policy.rb +4 -5
  310. data/test/rubygems/test_gem_security_signer.rb +4 -3
  311. data/test/rubygems/test_gem_security_trust_dir.rb +1 -2
  312. data/test/rubygems/test_gem_server.rb +4 -4
  313. data/test/rubygems/test_gem_source.rb +0 -13
  314. data/test/rubygems/test_gem_source_fetch_problem.rb +0 -1
  315. data/test/rubygems/test_gem_source_git.rb +0 -1
  316. data/test/rubygems/test_gem_source_installed.rb +0 -1
  317. data/test/rubygems/test_gem_source_lock.rb +0 -1
  318. data/test/rubygems/test_gem_source_vendor.rb +0 -1
  319. data/test/rubygems/test_gem_spec_fetcher.rb +0 -1
  320. data/test/rubygems/test_gem_specification.rb +334 -198
  321. data/test/rubygems/test_gem_stream_ui.rb +13 -30
  322. data/test/rubygems/test_gem_stub_specification.rb +0 -2
  323. data/test/rubygems/test_gem_text.rb +4 -5
  324. data/test/rubygems/test_gem_uninstaller.rb +21 -1
  325. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -1
  326. data/test/rubygems/test_gem_uri_formatter.rb +0 -1
  327. data/test/rubygems/test_gem_util.rb +6 -11
  328. data/test/rubygems/test_gem_validator.rb +0 -1
  329. data/test/rubygems/test_gem_version.rb +11 -11
  330. data/test/rubygems/test_gem_version_option.rb +0 -1
  331. data/test/rubygems/test_remote_fetch_error.rb +0 -1
  332. data/test/rubygems/test_require.rb +67 -52
  333. data/util/CL2notes +1 -2
  334. data/util/ci +15 -12
  335. data/util/create_certs.rb +6 -7
  336. data/util/create_encrypted_key.rb +0 -1
  337. data/util/patch_with_prs.rb +1 -1
  338. data/util/rubocop +8 -0
  339. data/util/update_bundled_ca_certificates.rb +15 -14
  340. data/util/update_changelog.rb +1 -1
  341. metadata +67 -59
  342. data/.autotest +0 -71
  343. data/.document +0 -5
  344. data/CONTRIBUTING.rdoc +0 -130
  345. data/CVE-2013-4287.txt +0 -35
  346. data/CVE-2013-4363.txt +0 -45
  347. data/CVE-2015-3900.txt +0 -40
  348. data/POLICIES.rdoc +0 -74
  349. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +0 -21
  350. data/test/rubygems/fix_openssl_warnings.rb +0 -13
@@ -15,6 +15,7 @@ require 'rubygems/deprecate'
15
15
  class Gem::DependencyInstaller
16
16
 
17
17
  include Gem::UserInteraction
18
+ extend Gem::Deprecate
18
19
 
19
20
  DEFAULT_OPTIONS = { # :nodoc:
20
21
  :env_shebang => false,
@@ -41,15 +42,6 @@ class Gem::DependencyInstaller
41
42
 
42
43
  attr_reader :errors
43
44
 
44
- ##
45
- #--
46
- # TODO remove, no longer used
47
-
48
- attr_reader :gems_to_install # :nodoc:
49
-
50
- extend Gem::Deprecate
51
- deprecate :gems_to_install, :none, 2016, 10
52
-
53
45
  ##
54
46
  # List of gems installed by #install in alphabetic order
55
47
 
@@ -74,7 +66,7 @@ class Gem::DependencyInstaller
74
66
  # :wrappers:: See Gem::Installer::new
75
67
  # :build_args:: See Gem::Installer::new
76
68
 
77
- def initialize options = {}
69
+ def initialize(options = {})
78
70
  @only_install_dir = !!options[:install_dir]
79
71
  @install_dir = options[:install_dir] || Gem.dir
80
72
  @build_root = options[:build_root]
@@ -97,6 +89,9 @@ class Gem::DependencyInstaller
97
89
  @build_args = options[:build_args]
98
90
  @build_docs_in_background = options[:build_docs_in_background]
99
91
  @install_as_default = options[:install_as_default]
92
+ @dir_mode = options[:dir_mode]
93
+ @data_mode = options[:data_mode]
94
+ @prog_mode = options[:prog_mode]
100
95
 
101
96
  # Indicates that we should not try to update any deps unless
102
97
  # we absolutely must.
@@ -115,7 +110,7 @@ class Gem::DependencyInstaller
115
110
  #--
116
111
  # TODO remove at RubyGems 4, no longer used
117
112
 
118
- def add_found_dependencies to_do, dependency_list # :nodoc:
113
+ def add_found_dependencies(to_do, dependency_list) # :nodoc:
119
114
  seen = {}
120
115
  dependencies = Hash.new { |h, name| h[name] = Gem::Dependency.new name }
121
116
 
@@ -169,8 +164,8 @@ class Gem::DependencyInstaller
169
164
  # Creates an AvailableSet to install from based on +dep_or_name+ and
170
165
  # +version+
171
166
 
172
- def available_set_for dep_or_name, version # :nodoc:
173
- if String === dep_or_name then
167
+ def available_set_for(dep_or_name, version) # :nodoc:
168
+ if String === dep_or_name
174
169
  find_spec_by_name_and_version dep_or_name, version, @prerelease
175
170
  else
176
171
  dep = dep_or_name.dup
@@ -203,7 +198,7 @@ class Gem::DependencyInstaller
203
198
  # sources. Gems are sorted with newer gems preferred over older gems, and
204
199
  # local gems preferred over remote gems.
205
200
 
206
- def find_gems_with_sources dep, best_only=false # :nodoc:
201
+ def find_gems_with_sources(dep, best_only=false) # :nodoc:
207
202
  set = Gem::AvailableSet.new
208
203
 
209
204
  if consider_local?
@@ -277,16 +272,16 @@ class Gem::DependencyInstaller
277
272
  # +version+. Returns an Array of specs and sources required for
278
273
  # installation of the gem.
279
274
 
280
- def find_spec_by_name_and_version gem_name,
275
+ def find_spec_by_name_and_version(gem_name,
281
276
  version = Gem::Requirement.default,
282
- prerelease = false
277
+ prerelease = false)
283
278
  set = Gem::AvailableSet.new
284
279
 
285
280
  if consider_local?
286
- if gem_name =~ /\.gem$/ and File.file? gem_name then
281
+ if gem_name =~ /\.gem$/ and File.file? gem_name
287
282
  src = Gem::Source::SpecificFile.new(gem_name)
288
283
  set.add src.spec, src
289
- elsif gem_name =~ /\.gem$/ then
284
+ elsif gem_name =~ /\.gem$/
290
285
  Dir[gem_name].each do |name|
291
286
  begin
292
287
  src = Gem::Source::SpecificFile.new name
@@ -346,7 +341,7 @@ class Gem::DependencyInstaller
346
341
  Gem::Specification.include?(spec)
347
342
  }
348
343
 
349
- unless dependency_list.ok? or @ignore_dependencies or @force then
344
+ unless dependency_list.ok? or @ignore_dependencies or @force
350
345
  reason = dependency_list.why_not_ok?.map { |k,v|
351
346
  "#{k} requires #{v.join(", ")}"
352
347
  }.join("; ")
@@ -357,7 +352,7 @@ class Gem::DependencyInstaller
357
352
  end
358
353
  deprecate :gather_dependencies, :none, 2018, 12
359
354
 
360
- def in_background what # :nodoc:
355
+ def in_background(what) # :nodoc:
361
356
  fork_happened = false
362
357
  if @build_docs_in_background and Process.respond_to?(:fork)
363
358
  begin
@@ -386,7 +381,7 @@ class Gem::DependencyInstaller
386
381
  # c-1.a, b-1 and a-1.a will be installed. b-1.a will need to be installed
387
382
  # separately.
388
383
 
389
- def install dep_or_name, version = Gem::Requirement.default
384
+ def install(dep_or_name, version = Gem::Requirement.default)
390
385
  request_set = resolve_dependencies dep_or_name, version
391
386
 
392
387
  @installed_gems = []
@@ -404,7 +399,10 @@ class Gem::DependencyInstaller
404
399
  :user_install => @user_install,
405
400
  :wrappers => @wrappers,
406
401
  :build_root => @build_root,
407
- :install_as_default => @install_as_default
402
+ :install_as_default => @install_as_default,
403
+ :dir_mode => @dir_mode,
404
+ :data_mode => @data_mode,
405
+ :prog_mode => @prog_mode,
408
406
  }
409
407
  options[:install_dir] = @install_dir if @only_install_dir
410
408
 
@@ -427,16 +425,16 @@ class Gem::DependencyInstaller
427
425
  end
428
426
 
429
427
  def install_development_deps # :nodoc:
430
- if @development and @dev_shallow then
428
+ if @development and @dev_shallow
431
429
  :shallow
432
- elsif @development then
430
+ elsif @development
433
431
  :all
434
432
  else
435
433
  :none
436
434
  end
437
435
  end
438
436
 
439
- def resolve_dependencies dep_or_name, version # :nodoc:
437
+ def resolve_dependencies(dep_or_name, version) # :nodoc:
440
438
  request_set = Gem::RequestSet.new
441
439
  request_set.development = @development
442
440
  request_set.development_shallow = @dev_shallow
@@ -448,11 +446,11 @@ class Gem::DependencyInstaller
448
446
  installer_set.ignore_installed = @only_install_dir
449
447
 
450
448
  if consider_local?
451
- if dep_or_name =~ /\.gem$/ and File.file? dep_or_name then
449
+ if dep_or_name =~ /\.gem$/ and File.file? dep_or_name
452
450
  src = Gem::Source::SpecificFile.new dep_or_name
453
451
  installer_set.add_local dep_or_name, src.spec, src
454
452
  version = src.spec.version if version == Gem::Requirement.default
455
- elsif dep_or_name =~ /\.gem$/ then
453
+ elsif dep_or_name =~ /\.gem$/
456
454
  Dir[dep_or_name].each do |name|
457
455
  begin
458
456
  src = Gem::Source::SpecificFile.new name
@@ -460,14 +458,14 @@ class Gem::DependencyInstaller
460
458
  rescue Gem::Package::FormatError
461
459
  end
462
460
  end
463
- # else This is a dependency. InstallerSet handles this case
461
+ # else This is a dependency. InstallerSet handles this case
464
462
  end
465
463
  end
466
464
 
467
465
  dependency =
468
- if spec = installer_set.local?(dep_or_name) then
466
+ if spec = installer_set.local?(dep_or_name)
469
467
  Gem::Dependency.new spec.name, version
470
- elsif String === dep_or_name then
468
+ elsif String === dep_or_name
471
469
  Gem::Dependency.new dep_or_name, version
472
470
  else
473
471
  dep_or_name
@@ -481,7 +479,7 @@ class Gem::DependencyInstaller
481
479
 
482
480
  request_set.always_install = installer_set.always_install
483
481
 
484
- if @ignore_dependencies then
482
+ if @ignore_dependencies
485
483
  installer_set.ignore_dependencies = true
486
484
  request_set.ignore_dependencies = true
487
485
  request_set.soft_missing = true
@@ -40,7 +40,7 @@ class Gem::DependencyList
40
40
  # Creates a new DependencyList. If +development+ is true, development
41
41
  # dependencies will be included.
42
42
 
43
- def initialize development = false
43
+ def initialize(development = false)
44
44
  @specs = []
45
45
 
46
46
  @development = development
@@ -79,8 +79,8 @@ class Gem::DependencyList
79
79
  seen = {}
80
80
 
81
81
  sorted.each do |spec|
82
- if index = seen[spec.name] then
83
- if result[index].version < spec.version then
82
+ if index = seen[spec.name]
83
+ if result[index].version < spec.version
84
84
  result[index] = spec
85
85
  end
86
86
  else
@@ -114,7 +114,7 @@ class Gem::DependencyList
114
114
  why_not_ok?(:quick).empty?
115
115
  end
116
116
 
117
- def why_not_ok? quick = false
117
+ def why_not_ok?(quick = false)
118
118
  unsatisfied = Hash.new { |h,k| h[k] = [] }
119
119
  each do |spec|
120
120
  spec.runtime_dependencies.each do |dep|
@@ -123,7 +123,7 @@ class Gem::DependencyList
123
123
  dep.requirement.satisfied_by? installed_spec.version
124
124
  }
125
125
 
126
- unless inst or @specs.find { |s| s.satisfies_requirement? dep } then
126
+ unless inst or @specs.find { |s| s.satisfies_requirement? dep }
127
127
  unsatisfied[spec.name] << dep
128
128
  return unsatisfied if quick
129
129
  end
@@ -172,7 +172,7 @@ class Gem::DependencyList
172
172
  # satisfy items in +dependencies+ (a hash of gem names to arrays of
173
173
  # dependencies).
174
174
 
175
- def remove_specs_unsatisfied_by dependencies
175
+ def remove_specs_unsatisfied_by(dependencies)
176
176
  specs.reject! { |spec|
177
177
  dep = dependencies[spec.name]
178
178
  dep and not dep.requirement.satisfied_by? spec.version
@@ -200,7 +200,7 @@ class Gem::DependencyList
200
200
  next if spec == other
201
201
 
202
202
  other.dependencies.each do |dep|
203
- if spec.satisfies_requirement? dep then
203
+ if spec.satisfies_requirement? dep
204
204
  result[spec] << other
205
205
  end
206
206
  end
@@ -222,7 +222,7 @@ class Gem::DependencyList
222
222
 
223
223
  dependencies.each do |dep|
224
224
  specs.each do |spec|
225
- if spec.satisfies_requirement? dep then
225
+ if spec.satisfies_requirement? dep
226
226
  yield spec
227
227
  break
228
228
  end
@@ -241,4 +241,3 @@ class Gem::DependencyList
241
241
  end
242
242
 
243
243
  end
244
-
@@ -27,7 +27,7 @@ module Gem::Deprecate
27
27
  @skip ||= false
28
28
  end
29
29
 
30
- def self.skip= v # :nodoc:
30
+ def self.skip=(v) # :nodoc:
31
31
  @skip = v
32
32
  end
33
33
 
@@ -47,7 +47,7 @@ module Gem::Deprecate
47
47
  # telling the user of +repl+ (unless +repl+ is :none) and the
48
48
  # year/month that it is planned to go away.
49
49
 
50
- def deprecate name, repl, year, month
50
+ def deprecate(name, repl, year, month)
51
51
  class_eval {
52
52
  old = "_deprecated_#{name}"
53
53
  alias_method old, name
@@ -68,4 +68,3 @@ module Gem::Deprecate
68
68
  module_function :deprecate, :skip_during
69
69
 
70
70
  end
71
-
@@ -26,7 +26,7 @@ class Gem::Doctor
26
26
  ['doc', ''],
27
27
  ['extensions', ''],
28
28
  ['gems', ''],
29
- ]
29
+ ].freeze
30
30
 
31
31
  missing =
32
32
  Gem::REPOSITORY_SUBDIRECTORIES.sort -
@@ -41,7 +41,7 @@ class Gem::Doctor
41
41
  #
42
42
  # If +dry_run+ is true no files or directories will be removed.
43
43
 
44
- def initialize gem_repository, dry_run = false
44
+ def initialize(gem_repository, dry_run = false)
45
45
  @gem_repository = gem_repository
46
46
  @dry_run = dry_run
47
47
 
@@ -73,7 +73,7 @@ class Gem::Doctor
73
73
 
74
74
  Gem.use_paths @gem_repository.to_s
75
75
 
76
- unless gem_repository? then
76
+ unless gem_repository?
77
77
  say 'This directory does not appear to be a RubyGems repository, ' +
78
78
  'skipping'
79
79
  say
@@ -99,7 +99,7 @@ class Gem::Doctor
99
99
  ##
100
100
  # Removes files in +sub_directory+ with +extension+
101
101
 
102
- def doctor_child sub_directory, extension # :nodoc:
102
+ def doctor_child(sub_directory, extension) # :nodoc:
103
103
  directory = File.join(@gem_repository, sub_directory)
104
104
 
105
105
  Dir.entries(directory).sort.each do |ent|
@@ -115,7 +115,7 @@ class Gem::Doctor
115
115
 
116
116
  type = File.directory?(child) ? 'directory' : 'file'
117
117
 
118
- action = if @dry_run then
118
+ action = if @dry_run
119
119
  'Extra'
120
120
  else
121
121
  FileUtils.rm_r(child)
@@ -129,4 +129,3 @@ class Gem::Doctor
129
129
  end
130
130
 
131
131
  end
132
-
@@ -25,7 +25,7 @@ module Gem
25
25
  # system. Instead of rescuing from this class, make sure to rescue from the
26
26
  # superclass Gem::LoadError to catch all types of load errors.
27
27
  class MissingSpecError < Gem::LoadError
28
- def initialize name, requirement
28
+ def initialize(name, requirement)
29
29
  @name = name
30
30
  @requirement = requirement
31
31
  end
@@ -50,7 +50,7 @@ module Gem
50
50
  class MissingSpecVersionError < MissingSpecError
51
51
  attr_reader :specs
52
52
 
53
- def initialize name, requirement, specs
53
+ def initialize(name, requirement, specs)
54
54
  super(name, requirement)
55
55
  @specs = specs
56
56
  end
@@ -81,7 +81,7 @@ module Gem
81
81
 
82
82
  attr_reader :target
83
83
 
84
- def initialize target, conflicts
84
+ def initialize(target, conflicts)
85
85
  @target = target
86
86
  @conflicts = conflicts
87
87
  @name = target.name
@@ -36,7 +36,7 @@ class Gem::DependencyResolutionError < Gem::DependencyError
36
36
 
37
37
  attr_reader :conflict
38
38
 
39
- def initialize conflict
39
+ def initialize(conflict)
40
40
  @conflict = conflict
41
41
  a, b = conflicting_dependencies
42
42
 
@@ -56,6 +56,13 @@ class Gem::GemNotInHomeException < Gem::Exception
56
56
  attr_accessor :spec
57
57
  end
58
58
 
59
+ ###
60
+ # Raised when removing a gem with the uninstall command fails
61
+
62
+ class Gem::UninstallError < Gem::Exception
63
+ attr_accessor :spec
64
+ end
65
+
59
66
  class Gem::DocumentError < Gem::Exception; end
60
67
 
61
68
  ##
@@ -70,7 +77,7 @@ class Gem::FilePermissionError < Gem::Exception
70
77
 
71
78
  attr_reader :directory
72
79
 
73
- def initialize directory
80
+ def initialize(directory)
74
81
  @directory = directory
75
82
 
76
83
  super "You don't have write permissions for the #{directory} directory."
@@ -130,7 +137,7 @@ class Gem::ImpossibleDependenciesError < Gem::Exception
130
137
  attr_reader :conflicts
131
138
  attr_reader :request
132
139
 
133
- def initialize request, conflicts
140
+ def initialize(request, conflicts)
134
141
  @request = request
135
142
  @conflicts = conflicts
136
143
 
@@ -242,7 +249,7 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
242
249
  # Creates a new UnsatisfiableDependencyError for the unsatisfiable
243
250
  # Gem::Resolver::DependencyRequest +dep+
244
251
 
245
- def initialize dep, platform_mismatch=nil
252
+ def initialize(dep, platform_mismatch=nil)
246
253
  if platform_mismatch and !platform_mismatch.empty?
247
254
  plats = platform_mismatch.map { |x| x.platform.to_s }.sort.uniq
248
255
  super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(', ')}"
@@ -16,4 +16,3 @@ require 'rubygems/ext/configure_builder'
16
16
  require 'rubygems/ext/ext_conf_builder'
17
17
  require 'rubygems/ext/rake_builder'
18
18
  require 'rubygems/ext/cmake_builder'
19
-
@@ -4,4 +4,3 @@
4
4
 
5
5
  class Gem::Ext::BuildError < Gem::InstallError
6
6
  end
7
-
@@ -6,7 +6,6 @@
6
6
  #++
7
7
 
8
8
  require 'rubygems/user_interaction'
9
- require 'thread'
10
9
 
11
10
  class Gem::Ext::Builder
12
11
 
@@ -28,18 +27,18 @@ class Gem::Ext::Builder
28
27
  end
29
28
 
30
29
  def self.make(dest_path, results)
31
- unless File.exist? 'Makefile' then
30
+ unless File.exist? 'Makefile'
32
31
  raise Gem::InstallError, 'Makefile not found'
33
32
  end
34
33
 
35
34
  # try to find make program from Ruby configure arguments first
36
35
  RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
37
36
  make_program = ENV['MAKE'] || ENV['make'] || $1
38
- unless make_program then
37
+ unless make_program
39
38
  make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
40
39
  end
41
40
 
42
- destdir = '"DESTDIR=%s"' % ENV['DESTDIR'] if RUBY_VERSION > '2.0'
41
+ destdir = '"DESTDIR=%s"' % ENV['DESTDIR']
43
42
 
44
43
  ['clean', '', 'install'].each do |target|
45
44
  # Pass DESTDIR via command line to override what's in MAKEFLAGS
@@ -57,6 +56,7 @@ class Gem::Ext::Builder
57
56
  end
58
57
 
59
58
  def self.redirector
59
+ warn "#{caller[0]}: Use IO.popen(..., err: [:child, :out])"
60
60
  '2>&1'
61
61
  end
62
62
 
@@ -64,28 +64,35 @@ class Gem::Ext::Builder
64
64
  verbose = Gem.configuration.really_verbose
65
65
 
66
66
  begin
67
- # TODO use Process.spawn when ruby 1.8 support is dropped.
68
67
  rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
69
68
  if verbose
70
69
  puts("current directory: #{Dir.pwd}")
71
- puts(command)
72
- system(command)
73
- else
74
- results << "current directory: #{Dir.pwd}"
75
- results << command
76
- results << `#{command} #{redirector}`
70
+ p(command)
77
71
  end
72
+ results << "current directory: #{Dir.pwd}"
73
+ results << (command.respond_to?(:shelljoin) ? command.shelljoin : command)
74
+
75
+ redirections = verbose ? {} : {err: [:child, :out]}
76
+ IO.popen(command, "r", redirections) do |io|
77
+ if verbose
78
+ IO.copy_stream(io, $stdout)
79
+ else
80
+ results << io.read
81
+ end
82
+ end
83
+ rescue => error
84
+ raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
78
85
  ensure
79
86
  ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
80
87
  end
81
88
 
82
- unless $?.success? then
89
+ unless $?.success?
83
90
  results << "Building has failed. See above output for more information on the failure." if verbose
84
91
 
85
92
  exit_reason =
86
- if $?.exited? then
93
+ if $?.exited?
87
94
  ", exit code #{$?.exitstatus}"
88
- elsif $?.signaled? then
95
+ elsif $?.signaled?
89
96
  ", uncaught signal #{$?.termsig}"
90
97
  end
91
98
 
@@ -98,7 +105,7 @@ class Gem::Ext::Builder
98
105
  # have build arguments, saved, set +build_args+ which is an ARGV-style
99
106
  # array.
100
107
 
101
- def initialize spec, build_args = spec.build_args
108
+ def initialize(spec, build_args = spec.build_args)
102
109
  @spec = spec
103
110
  @build_args = build_args
104
111
  @gem_dir = spec.full_gem_path
@@ -109,7 +116,7 @@ class Gem::Ext::Builder
109
116
  ##
110
117
  # Chooses the extension builder class for +extension+
111
118
 
112
- def builder_for extension # :nodoc:
119
+ def builder_for(extension) # :nodoc:
113
120
  case extension
114
121
  when /extconf/ then
115
122
  Gem::Ext::ExtConfBuilder
@@ -131,7 +138,7 @@ class Gem::Ext::Builder
131
138
  ##
132
139
  # Logs the build +output+ in +build_dir+, then raises Gem::Ext::BuildError.
133
140
 
134
- def build_error build_dir, output, backtrace = nil # :nodoc:
141
+ def build_error(build_dir, output, backtrace = nil) # :nodoc:
135
142
  gem_make_out = write_gem_make_out output
136
143
 
137
144
  message = <<-EOF
@@ -146,12 +153,24 @@ EOF
146
153
  raise Gem::Ext::BuildError, message, backtrace
147
154
  end
148
155
 
149
- def build_extension extension, dest_path # :nodoc:
156
+ def build_extension(extension, dest_path) # :nodoc:
150
157
  results = []
151
158
 
159
+ # FIXME: Determine if this line is necessary and, if so, why.
160
+ # Notes:
161
+ # 1. As far as I can tell, this method is only called by +build_extensions+.
162
+ # 2. The existence of this line implies +extension+ is, or previously was,
163
+ # sometimes +false+ or +nil+.
164
+ # 3. #1 and #2 combined suggests, but does not confirm, that
165
+ # +@specs.extensions+ sometimes contained +false+ or +nil+ values.
166
+ # 4. Nothing seems to explicitly handle +extension+ being empty,
167
+ # which makes me wonder both what it should do and what it does.
168
+ #
169
+ # - @duckinator
152
170
  extension ||= '' # I wish I knew why this line existed
171
+
153
172
  extension_dir =
154
- File.expand_path File.join @gem_dir, File.dirname(extension)
173
+ File.expand_path File.join(@gem_dir, File.dirname(extension))
155
174
  lib_dir = File.join @spec.full_gem_path, @spec.raw_require_paths.first
156
175
 
157
176
  builder = builder_for extension
@@ -160,11 +179,19 @@ EOF
160
179
  FileUtils.mkdir_p dest_path
161
180
 
162
181
  CHDIR_MUTEX.synchronize do
163
- Dir.chdir extension_dir do
164
- results = builder.build(extension, @gem_dir, dest_path,
182
+ pwd = Dir.getwd
183
+ Dir.chdir extension_dir
184
+ begin
185
+ results = builder.build(extension, dest_path,
165
186
  results, @build_args, lib_dir)
166
187
 
167
188
  verbose { results.join("\n") }
189
+ ensure
190
+ begin
191
+ Dir.chdir pwd
192
+ rescue SystemCallError
193
+ Dir.chdir dest_path
194
+ end
168
195
  end
169
196
  end
170
197
 
@@ -193,6 +220,7 @@ EOF
193
220
 
194
221
  FileUtils.rm_f @spec.gem_build_complete_path
195
222
 
223
+ # FIXME: action at a distance: @ran_rake modified deep in build_extension(). - @duckinator
196
224
  @ran_rake = false # only run rake once
197
225
 
198
226
  @spec.extensions.each do |extension|
@@ -207,7 +235,7 @@ EOF
207
235
  ##
208
236
  # Writes +output+ to gem_make.out in the extension install directory.
209
237
 
210
- def write_gem_make_out output # :nodoc:
238
+ def write_gem_make_out(output) # :nodoc:
211
239
  destination = File.join @spec.extension_dir, 'gem_make.out'
212
240
 
213
241
  FileUtils.mkdir_p @spec.extension_dir
@@ -218,4 +246,3 @@ EOF
218
246
  end
219
247
 
220
248
  end
221
-