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
@@ -44,8 +44,8 @@ requiring to see why it does not behave as you expect.
44
44
 
45
45
  spec = Gem::Specification.find_by_path arg
46
46
 
47
- if spec then
48
- if options[:search_gems_first] then
47
+ if spec
48
+ if options[:search_gems_first]
49
49
  dirs = spec.full_require_paths + $LOAD_PATH
50
50
  else
51
51
  dirs = $LOAD_PATH + spec.full_require_paths
@@ -55,7 +55,7 @@ requiring to see why it does not behave as you expect.
55
55
  # TODO: this is totally redundant and stupid
56
56
  paths = find_paths arg, dirs
57
57
 
58
- if paths.empty? then
58
+ if paths.empty?
59
59
  alert_error "Can't find Ruby library file or shared library #{arg}"
60
60
 
61
61
  found &&= false
@@ -73,7 +73,7 @@ requiring to see why it does not behave as you expect.
73
73
  dirs.each do |dir|
74
74
  Gem.suffixes.each do |ext|
75
75
  full_path = File.join dir, "#{package_name}#{ext}"
76
- if File.exist? full_path and not File.directory? full_path then
76
+ if File.exist? full_path and not File.directory? full_path
77
77
  result << full_path
78
78
  return result unless options[:show_all]
79
79
  end
@@ -88,4 +88,3 @@ requiring to see why it does not behave as you expect.
88
88
  end
89
89
 
90
90
  end
91
-
@@ -51,7 +51,7 @@ data you will need to change them immediately and yank your gem.
51
51
  version = get_version_from_requirements(options[:version])
52
52
  platform = get_platform_from_requirements(options)
53
53
 
54
- if version then
54
+ if version
55
55
  yank_gem(version, platform)
56
56
  else
57
57
  say "A version argument is required: #{usage}"
@@ -93,4 +93,3 @@ data you will need to change them immediately and yank your gem.
93
93
  end
94
94
 
95
95
  end
96
-
@@ -9,26 +9,6 @@
9
9
  # Ruby 1.9.x has introduced some things that are awkward, and we need to
10
10
  # support them, so we define some constants to use later.
11
11
  #++
12
- module Gem
13
- # Only MRI 1.9.2 has the custom prelude.
14
- GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/ and RUBY_ENGINE == "ruby"
15
- end
16
-
17
- # Gem::QuickLoader exists in the gem prelude code in ruby 1.9.2 itself.
18
- # We gotta get rid of it if it's there, before we do anything else.
19
- if Gem::GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
20
- Gem::QuickLoader.remove
21
-
22
- $LOADED_FEATURES.delete Gem::QuickLoader.path_to_full_rubygems_library
23
-
24
- if path = $LOADED_FEATURES.find {|n| n.end_with? '/rubygems.rb'} then
25
- raise LoadError, "another rubygems is already loaded from #{path}"
26
- end
27
-
28
- class << Gem
29
- remove_method :try_activate if Gem.respond_to?(:try_activate, true)
30
- end
31
- end
32
12
 
33
13
  module Gem
34
14
  RubyGemsVersion = VERSION
@@ -42,7 +22,7 @@ module Gem
42
22
  EXEEXT RUBY_SO_NAME arch bindir datadir libdir ruby_install_name
43
23
  ruby_version rubylibprefix sitedir sitelibdir vendordir vendorlibdir
44
24
  rubylibdir
45
- ]
25
+ ].freeze
46
26
 
47
27
  unless defined?(ConfigMap)
48
28
  ##
@@ -27,6 +27,7 @@ require 'rbconfig'
27
27
  # +:backtrace+:: See #backtrace
28
28
  # +:sources+:: Sets Gem::sources
29
29
  # +:verbose+:: See #verbose
30
+ # +:concurrent_downloads+:: See #concurrent_downloads
30
31
  #
31
32
  # gemrc files may exist in various locations and are read and merged in
32
33
  # the following order:
@@ -43,12 +44,14 @@ class Gem::ConfigFile
43
44
  DEFAULT_BULK_THRESHOLD = 1000
44
45
  DEFAULT_VERBOSITY = true
45
46
  DEFAULT_UPDATE_SOURCES = true
47
+ DEFAULT_CONCURRENT_DOWNLOADS = 8
48
+ DEFAULT_CERT_EXPIRATION_LENGTH_DAYS = 365
46
49
 
47
50
  ##
48
51
  # For Ruby packagers to set configuration defaults. Set in
49
52
  # rubygems/defaults/operating_system.rb
50
53
 
51
- OPERATING_SYSTEM_DEFAULTS = {}
54
+ OPERATING_SYSTEM_DEFAULTS = Gem.operating_system_defaults
52
55
 
53
56
  ##
54
57
  # For Ruby implementers to set configuration defaults. Set in
@@ -63,26 +66,7 @@ class Gem::ConfigFile
63
66
  require "etc"
64
67
  Etc.sysconfdir
65
68
  rescue LoadError, NoMethodError
66
- begin
67
- # TODO: remove after we drop 1.8.7 and 1.9.1
68
- require 'Win32API'
69
-
70
- CSIDL_COMMON_APPDATA = 0x0023
71
- path = 0.chr * 260
72
- if RUBY_VERSION > '1.9' then
73
- SHGetFolderPath = Win32API.new 'shell32', 'SHGetFolderPath', 'PLPLP',
74
- 'L', :stdcall
75
- SHGetFolderPath.call nil, CSIDL_COMMON_APPDATA, nil, 1, path
76
- else
77
- SHGetFolderPath = Win32API.new 'shell32', 'SHGetFolderPath', 'LLLLP',
78
- 'L'
79
- SHGetFolderPath.call 0, CSIDL_COMMON_APPDATA, 0, 1, path
80
- end
81
-
82
- path.strip
83
- rescue LoadError
84
- RbConfig::CONFIG["sysconfdir"] || "/etc"
85
- end
69
+ RbConfig::CONFIG["sysconfdir"] || "/etc"
86
70
  end
87
71
 
88
72
  # :startdoc:
@@ -123,6 +107,11 @@ class Gem::ConfigFile
123
107
 
124
108
  attr_accessor :verbose
125
109
 
110
+ ##
111
+ # Number of gem downloads that should be performed concurrently.
112
+
113
+ attr_accessor :concurrent_downloads
114
+
126
115
  ##
127
116
  # True if we want to update the SourceInfoCache every time, false otherwise
128
117
 
@@ -147,6 +136,11 @@ class Gem::ConfigFile
147
136
  # sources to look for gems
148
137
  attr_accessor :sources
149
138
 
139
+ ##
140
+ # Expiration length to sign a certificate
141
+
142
+ attr_accessor :cert_expiration_length_days
143
+
150
144
  ##
151
145
  # Path name of directory or file of openssl client certificate, used for remote https connection with client authentication
152
146
 
@@ -180,12 +174,12 @@ class Gem::ConfigFile
180
174
  arg_list = []
181
175
 
182
176
  args.each do |arg|
183
- if need_config_file_name then
177
+ if need_config_file_name
184
178
  @config_file_name = arg
185
179
  need_config_file_name = false
186
- elsif arg =~ /^--config-file=(.*)/ then
180
+ elsif arg =~ /^--config-file=(.*)/
187
181
  @config_file_name = $1
188
- elsif arg =~ /^--config-file$/ then
182
+ elsif arg =~ /^--config-file$/
189
183
  need_config_file_name = true
190
184
  else
191
185
  arg_list << arg
@@ -196,6 +190,8 @@ class Gem::ConfigFile
196
190
  @bulk_threshold = DEFAULT_BULK_THRESHOLD
197
191
  @verbose = DEFAULT_VERBOSITY
198
192
  @update_sources = DEFAULT_UPDATE_SOURCES
193
+ @concurrent_downloads = DEFAULT_CONCURRENT_DOWNLOADS
194
+ @cert_expiration_length_days = DEFAULT_CERT_EXPIRATION_LENGTH_DAYS
199
195
 
200
196
  operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS)
201
197
  platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
@@ -213,14 +209,15 @@ class Gem::ConfigFile
213
209
  end
214
210
 
215
211
  # HACK these override command-line args, which is bad
216
- @backtrace = @hash[:backtrace] if @hash.key? :backtrace
217
- @bulk_threshold = @hash[:bulk_threshold] if @hash.key? :bulk_threshold
218
- @home = @hash[:gemhome] if @hash.key? :gemhome
219
- @path = @hash[:gempath] if @hash.key? :gempath
220
- @update_sources = @hash[:update_sources] if @hash.key? :update_sources
221
- @verbose = @hash[:verbose] if @hash.key? :verbose
222
- @disable_default_gem_server = @hash[:disable_default_gem_server] if @hash.key? :disable_default_gem_server
223
- @sources = @hash[:sources] if @hash.key? :sources
212
+ @backtrace = @hash[:backtrace] if @hash.key? :backtrace
213
+ @bulk_threshold = @hash[:bulk_threshold] if @hash.key? :bulk_threshold
214
+ @home = @hash[:gemhome] if @hash.key? :gemhome
215
+ @path = @hash[:gempath] if @hash.key? :gempath
216
+ @update_sources = @hash[:update_sources] if @hash.key? :update_sources
217
+ @verbose = @hash[:verbose] if @hash.key? :verbose
218
+ @disable_default_gem_server = @hash[:disable_default_gem_server] if @hash.key? :disable_default_gem_server
219
+ @sources = @hash[:sources] if @hash.key? :sources
220
+ @cert_expiration_length_days = @hash[:cert_expiration_length_days] if @hash.key? :cert_expiration_length_days
224
221
 
225
222
  @ssl_verify_mode = @hash[:ssl_verify_mode] if @hash.key? :ssl_verify_mode
226
223
  @ssl_ca_cert = @hash[:ssl_ca_cert] if @hash.key? :ssl_ca_cert
@@ -284,13 +281,13 @@ if you believe they were disclosed to a third party.
284
281
  def load_api_keys
285
282
  check_credentials_permissions
286
283
 
287
- @api_keys = if File.exist? credentials_path then
284
+ @api_keys = if File.exist? credentials_path
288
285
  load_file(credentials_path)
289
286
  else
290
287
  @hash
291
288
  end
292
289
 
293
- if @api_keys.key? :rubygems_api_key then
290
+ if @api_keys.key? :rubygems_api_key
294
291
  @rubygems_api_key = @api_keys[:rubygems_api_key]
295
292
  @api_keys[:rubygems] = @api_keys.delete :rubygems_api_key unless
296
293
  @api_keys.key? :rubygems
@@ -309,7 +306,7 @@ if you believe they were disclosed to a third party.
309
306
  ##
310
307
  # Sets the RubyGems.org API key to +api_key+
311
308
 
312
- def rubygems_api_key= api_key
309
+ def rubygems_api_key=(api_key)
313
310
  set_api_key :rubygems_api_key, api_key
314
311
 
315
312
  @rubygems_api_key = api_key
@@ -318,7 +315,7 @@ if you believe they were disclosed to a third party.
318
315
  ##
319
316
  # Set a specific host's API key to +api_key+
320
317
 
321
- def set_api_key host, api_key
318
+ def set_api_key(host, api_key)
322
319
  check_credentials_permissions
323
320
 
324
321
  config = load_file(credentials_path).merge(host => api_key)
@@ -434,6 +431,9 @@ if you believe they were disclosed to a third party.
434
431
  yaml_hash[:update_sources] = @hash.fetch(:update_sources, DEFAULT_UPDATE_SOURCES)
435
432
  yaml_hash[:verbose] = @hash.fetch(:verbose, DEFAULT_VERBOSITY)
436
433
 
434
+ yaml_hash[:concurrent_downloads] =
435
+ @hash.fetch(:concurrent_downloads, DEFAULT_CONCURRENT_DOWNLOADS)
436
+
437
437
  yaml_hash[:ssl_verify_mode] =
438
438
  @hash[:ssl_verify_mode] if @hash.key? :ssl_verify_mode
439
439
 
@@ -31,7 +31,7 @@ module Kernel
31
31
  # The normal <tt>require</tt> functionality of returning false if
32
32
  # that file has already been loaded is preserved.
33
33
 
34
- def require path
34
+ def require(path)
35
35
  RUBYGEMS_ACTIVATION_MONITOR.enter
36
36
 
37
37
  path = path.to_path if path.respond_to? :to_path
@@ -49,7 +49,7 @@ module Kernel
49
49
  # If there are no unresolved deps, then we can use just try
50
50
  # normal require handle loading a gem from the rescue below.
51
51
 
52
- if Gem::Specification.unresolved_deps.empty? then
52
+ if Gem::Specification.unresolved_deps.empty?
53
53
  RUBYGEMS_ACTIVATION_MONITOR.exit
54
54
  return gem_original_require(path)
55
55
  end
@@ -79,7 +79,7 @@ module Kernel
79
79
  # requested, then find_in_unresolved_tree will find d.rb in d because
80
80
  # it's a dependency of c.
81
81
  #
82
- if found_specs.empty? then
82
+ if found_specs.empty?
83
83
  found_specs = Gem::Specification.find_in_unresolved_tree path
84
84
 
85
85
  found_specs.each do |found_spec|
@@ -94,7 +94,7 @@ module Kernel
94
94
  # versions of the same gem
95
95
  names = found_specs.map(&:name).uniq
96
96
 
97
- if names.size > 1 then
97
+ if names.size > 1
98
98
  RUBYGEMS_ACTIVATION_MONITOR.exit
99
99
  raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ', '}"
100
100
  end
@@ -103,7 +103,7 @@ module Kernel
103
103
  # at the highest version.
104
104
  valid = found_specs.find { |s| !s.has_conflicts? }
105
105
 
106
- unless valid then
106
+ unless valid
107
107
  le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate"
108
108
  le.name = names.first
109
109
  RUBYGEMS_ACTIVATION_MONITOR.exit
@@ -120,7 +120,7 @@ module Kernel
120
120
 
121
121
  begin
122
122
  if load_error.message.start_with?("Could not find") or
123
- (load_error.message.end_with?(path) and Gem.try_activate(path)) then
123
+ (load_error.message.end_with?(path) and Gem.try_activate(path))
124
124
  require_again = true
125
125
  end
126
126
  ensure
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ # `uplevel` keyword argument of Kernel#warn is available since ruby 2.5.
4
+ if RUBY_VERSION >= "2.5"
5
+
6
+ module Kernel
7
+ path = "#{__dir__}/" # Frames to be skipped start with this path.
8
+
9
+ # Suppress "method redefined" warning
10
+ original_warn = instance_method(:warn)
11
+ Module.new {define_method(:warn, original_warn)}
12
+
13
+ original_warn = method(:warn)
14
+
15
+ module_function define_method(:warn) {|*messages, uplevel: nil|
16
+ unless uplevel
17
+ return original_warn.call(*messages)
18
+ end
19
+
20
+ # Ensure `uplevel` fits a `long`
21
+ uplevel, = [uplevel].pack("l!").unpack("l!")
22
+
23
+ if uplevel >= 0
24
+ start = 0
25
+ while uplevel >= 0
26
+ loc, = caller_locations(start, 1)
27
+ unless loc
28
+ # No more backtrace
29
+ start += uplevel
30
+ break
31
+ end
32
+
33
+ start += 1
34
+
35
+ unless loc.path.start_with?(path)
36
+ # Non-rubygems frames
37
+ uplevel -= 1
38
+ end
39
+ end
40
+ uplevel = start
41
+ end
42
+ original_warn.call(*messages, uplevel: uplevel)
43
+ }
44
+ end
45
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Gem
3
- DEFAULT_HOST = "https://rubygems.org"
3
+ DEFAULT_HOST = "https://rubygems.org".freeze
4
4
 
5
5
  @post_install_hooks ||= []
6
6
  @done_installing_hooks ||= []
@@ -28,17 +28,17 @@ module Gem
28
28
  # specified in the environment
29
29
 
30
30
  def self.default_dir
31
- path = if defined? RUBY_FRAMEWORK_VERSION then
31
+ path = if defined? RUBY_FRAMEWORK_VERSION
32
32
  [
33
33
  File.dirname(RbConfig::CONFIG['sitedir']),
34
34
  'Gems',
35
35
  RbConfig::CONFIG['ruby_version']
36
36
  ]
37
- elsif RbConfig::CONFIG['rubylibprefix'] then
37
+ elsif RbConfig::CONFIG['rubylibprefix']
38
38
  [
39
- RbConfig::CONFIG['rubylibprefix'],
40
- 'gems',
41
- RbConfig::CONFIG['ruby_version']
39
+ RbConfig::CONFIG['rubylibprefix'],
40
+ 'gems',
41
+ RbConfig::CONFIG['ruby_version']
42
42
  ]
43
43
  else
44
44
  [
@@ -59,7 +59,7 @@ module Gem
59
59
  # By default, the binary extensions are located side by side with their
60
60
  # Ruby counterparts, therefore nil is returned
61
61
 
62
- def self.default_ext_dir_for base_dir
62
+ def self.default_ext_dir_for(base_dir)
63
63
  nil
64
64
  end
65
65
 
@@ -103,7 +103,7 @@ module Gem
103
103
  def self.default_exec_format
104
104
  exec_format = RbConfig::CONFIG['ruby_install_name'].sub('ruby', '%s') rescue '%s'
105
105
 
106
- unless exec_format =~ /%s/ then
106
+ unless exec_format =~ /%s/
107
107
  raise Gem::Exception,
108
108
  "[BUG] invalid exec_format #{exec_format.inspect}, no %s"
109
109
  end
@@ -115,7 +115,7 @@ module Gem
115
115
  # The default directory for binaries
116
116
 
117
117
  def self.default_bindir
118
- if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
118
+ if defined? RUBY_FRAMEWORK_VERSION # mac framework support
119
119
  '/usr/bin'
120
120
  else # generic install
121
121
  RbConfig::CONFIG['bindir']
@@ -126,7 +126,7 @@ module Gem
126
126
  # A wrapper around RUBY_ENGINE const that may not be defined
127
127
 
128
128
  def self.ruby_engine
129
- if defined? RUBY_ENGINE then
129
+ if defined? RUBY_ENGINE
130
130
  RUBY_ENGINE
131
131
  else
132
132
  'ruby'
@@ -165,7 +165,7 @@ module Gem
165
165
  # Directory where vendor gems are installed.
166
166
 
167
167
  def self.vendor_dir # :nodoc:
168
- if vendor_dir = ENV['GEM_VENDOR'] then
168
+ if vendor_dir = ENV['GEM_VENDOR']
169
169
  return vendor_dir.dup
170
170
  end
171
171
 
@@ -176,7 +176,26 @@ module Gem
176
176
  end
177
177
 
178
178
  ##
179
- # Default options for gem commands.
179
+ # Default options for gem commands for Ruby packagers.
180
+ #
181
+ # The options here should be structured as an array of string "gem"
182
+ # command names as keys and a string of the default options as values.
183
+ #
184
+ # Example:
185
+ #
186
+ # def self.operating_system_defaults
187
+ # {
188
+ # 'install' => '--no-rdoc --no-ri --env-shebang',
189
+ # 'update' => '--no-rdoc --no-ri --env-shebang'
190
+ # }
191
+ # end
192
+
193
+ def self.operating_system_defaults
194
+ {}
195
+ end
196
+
197
+ ##
198
+ # Default options for gem commands for Ruby implementers.
180
199
  #
181
200
  # The options here should be structured as an array of string "gem"
182
201
  # command names as keys and a string of the default options as values.
@@ -19,7 +19,7 @@ class Gem::Dependency
19
19
  TYPES = [
20
20
  :development,
21
21
  :runtime,
22
- ]
22
+ ].freeze
23
23
 
24
24
  ##
25
25
  # Dependency name or regular expression.
@@ -36,7 +36,7 @@ class Gem::Dependency
36
36
  # argument can optionally be the dependency type, which defaults to
37
37
  # <tt>:runtime</tt>.
38
38
 
39
- def initialize name, *requirements
39
+ def initialize(name, *requirements)
40
40
  case name
41
41
  when String then # ok
42
42
  when Regexp then
@@ -76,7 +76,7 @@ class Gem::Dependency
76
76
  end
77
77
 
78
78
  def inspect # :nodoc:
79
- if prerelease? then
79
+ if prerelease?
80
80
  "<%s type=%p name=%p requirements=%p prerelease=ok>" %
81
81
  [self.class, self.type, self.name, requirement.to_s]
82
82
  else
@@ -100,7 +100,7 @@ class Gem::Dependency
100
100
  @requirement.none?
101
101
  end
102
102
 
103
- def pretty_print q # :nodoc:
103
+ def pretty_print(q) # :nodoc:
104
104
  q.group 1, 'Gem::Dependency.new(', ')' do
105
105
  q.pp name
106
106
  q.text ','
@@ -152,7 +152,7 @@ class Gem::Dependency
152
152
  end
153
153
 
154
154
  def to_s # :nodoc:
155
- if type != :runtime then
155
+ if type != :runtime
156
156
  "#{name} (#{requirement}, #{type})"
157
157
  else
158
158
  "#{name} (#{requirement})"
@@ -170,7 +170,7 @@ class Gem::Dependency
170
170
  @type == :runtime || !@type
171
171
  end
172
172
 
173
- def == other # :nodoc:
173
+ def ==(other) # :nodoc:
174
174
  Gem::Dependency === other &&
175
175
  self.name == other.name &&
176
176
  self.type == other.type &&
@@ -180,7 +180,7 @@ class Gem::Dependency
180
180
  ##
181
181
  # Dependencies are ordered by name.
182
182
 
183
- def <=> other
183
+ def <=>(other)
184
184
  self.name <=> other.name
185
185
  end
186
186
 
@@ -190,7 +190,7 @@ class Gem::Dependency
190
190
  # other has only an equal version requirement that satisfies this
191
191
  # dependency.
192
192
 
193
- def =~ other
193
+ def =~(other)
194
194
  unless Gem::Dependency === other
195
195
  return unless other.respond_to?(:name) && other.respond_to?(:version)
196
196
  other = Gem::Dependency.new other.name, other.version
@@ -222,7 +222,7 @@ class Gem::Dependency
222
222
  # NOTE: Unlike #matches_spec? this method does not return true when the
223
223
  # version is a prerelease version unless this is a prerelease dependency.
224
224
 
225
- def match? obj, version=nil, allow_prerelease=false
225
+ def match?(obj, version=nil, allow_prerelease=false)
226
226
  if !version
227
227
  name = obj.name
228
228
  version = obj.version
@@ -249,7 +249,7 @@ class Gem::Dependency
249
249
  # returns true when +spec+ is a prerelease version even if this dependency
250
250
  # is not a prerelease dependency.
251
251
 
252
- def matches_spec? spec
252
+ def matches_spec?(spec)
253
253
  return false unless name === spec.name
254
254
  return true if requirement.none?
255
255
 
@@ -259,8 +259,8 @@ class Gem::Dependency
259
259
  ##
260
260
  # Merges the requirements of +other+ into this dependency
261
261
 
262
- def merge other
263
- unless name == other.name then
262
+ def merge(other)
263
+ unless name == other.name
264
264
  raise ArgumentError,
265
265
  "#{self} and #{other} have different names"
266
266
  end
@@ -275,7 +275,7 @@ class Gem::Dependency
275
275
  self.class.new name, self_req.as_list.concat(other_req.as_list)
276
276
  end
277
277
 
278
- def matching_specs platform_only = false
278
+ def matching_specs(platform_only = false)
279
279
  env_req = Gem.env_requirement(name)
280
280
  matches = Gem::Specification.stubs_for(name).find_all { |spec|
281
281
  requirement.satisfied_by?(spec.version) && env_req.satisfied_by?(spec.version)
@@ -304,7 +304,7 @@ class Gem::Dependency
304
304
 
305
305
  # TODO: check Gem.activated_spec[self.name] in case matches falls outside
306
306
 
307
- if matches.empty? then
307
+ if matches.empty?
308
308
  specs = Gem::Specification.stubs_for name
309
309
 
310
310
  if specs.empty?