rubygems-update 3.0.6 → 3.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (628) hide show
  1. checksums.yaml +4 -4
  2. data/{History.txt → CHANGELOG.md} +1100 -436
  3. data/CODE_OF_CONDUCT.md +55 -19
  4. data/CONTRIBUTING.md +37 -10
  5. data/MAINTAINERS.txt +1 -6
  6. data/Manifest.txt +104 -64
  7. data/POLICIES.md +6 -12
  8. data/README.md +6 -6
  9. data/Rakefile +121 -111
  10. data/bin/gem +0 -6
  11. data/bin/update_rubygems +2 -2
  12. data/bundler/CHANGELOG.md +1788 -1251
  13. data/bundler/LICENSE.md +18 -19
  14. data/bundler/README.md +9 -10
  15. data/bundler/UPGRADING.md +215 -0
  16. data/bundler/bundler.gemspec +9 -26
  17. data/bundler/exe/bundle +22 -3
  18. data/bundler/lib/bundler.rb +233 -94
  19. data/bundler/lib/bundler/build_metadata.rb +5 -13
  20. data/bundler/lib/bundler/capistrano.rb +4 -4
  21. data/bundler/lib/bundler/cli.rb +221 -148
  22. data/bundler/lib/bundler/cli/add.rb +28 -16
  23. data/bundler/lib/bundler/cli/binstubs.rb +6 -2
  24. data/bundler/lib/bundler/cli/cache.rb +24 -17
  25. data/bundler/lib/bundler/cli/clean.rb +1 -1
  26. data/bundler/lib/bundler/cli/common.rb +25 -12
  27. data/bundler/lib/bundler/cli/config.rb +161 -86
  28. data/bundler/lib/bundler/cli/console.rb +1 -1
  29. data/bundler/lib/bundler/cli/doctor.rb +5 -5
  30. data/bundler/lib/bundler/cli/exec.rb +8 -20
  31. data/bundler/lib/bundler/cli/fund.rb +36 -0
  32. data/bundler/lib/bundler/cli/gem.rb +125 -32
  33. data/bundler/lib/bundler/cli/info.rb +29 -6
  34. data/bundler/lib/bundler/cli/init.rb +2 -2
  35. data/bundler/lib/bundler/cli/inject.rb +1 -1
  36. data/bundler/lib/bundler/cli/install.rb +27 -23
  37. data/bundler/lib/bundler/cli/issue.rb +5 -5
  38. data/bundler/lib/bundler/cli/list.rb +12 -10
  39. data/bundler/lib/bundler/cli/open.rb +10 -6
  40. data/bundler/lib/bundler/cli/outdated.rb +134 -109
  41. data/bundler/lib/bundler/cli/plugin.rb +19 -2
  42. data/bundler/lib/bundler/cli/pristine.rb +6 -1
  43. data/bundler/lib/bundler/cli/show.rb +2 -2
  44. data/bundler/lib/bundler/cli/update.rb +34 -12
  45. data/bundler/lib/bundler/compact_index_client.rb +26 -10
  46. data/bundler/lib/bundler/compact_index_client/cache.rb +6 -14
  47. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  48. data/bundler/lib/bundler/compact_index_client/updater.rb +8 -20
  49. data/bundler/lib/bundler/current_ruby.rb +9 -7
  50. data/bundler/lib/bundler/definition.rb +133 -132
  51. data/bundler/lib/bundler/dep_proxy.rb +16 -9
  52. data/bundler/lib/bundler/dependency.rb +19 -14
  53. data/bundler/lib/bundler/deployment.rb +1 -1
  54. data/bundler/lib/bundler/dsl.rb +54 -71
  55. data/bundler/lib/bundler/endpoint_specification.rb +1 -1
  56. data/bundler/lib/bundler/env.rb +9 -14
  57. data/bundler/lib/bundler/environment_preserver.rb +26 -3
  58. data/bundler/lib/bundler/errors.rb +1 -0
  59. data/bundler/lib/bundler/feature_flag.rb +19 -34
  60. data/bundler/lib/bundler/fetcher.rb +19 -16
  61. data/bundler/lib/bundler/fetcher/base.rb +1 -1
  62. data/bundler/lib/bundler/fetcher/compact_index.rb +27 -13
  63. data/bundler/lib/bundler/fetcher/dependency.rb +1 -1
  64. data/bundler/lib/bundler/fetcher/downloader.rb +6 -3
  65. data/bundler/lib/bundler/fetcher/index.rb +8 -7
  66. data/bundler/lib/bundler/friendly_errors.rb +27 -19
  67. data/bundler/lib/bundler/gem_helper.rb +68 -37
  68. data/bundler/lib/bundler/gem_helpers.rb +38 -29
  69. data/bundler/lib/bundler/gem_tasks.rb +1 -1
  70. data/bundler/lib/bundler/gem_version_promoter.rb +5 -5
  71. data/bundler/lib/bundler/graph.rb +3 -3
  72. data/bundler/lib/bundler/index.rb +12 -7
  73. data/bundler/lib/bundler/injector.rb +32 -12
  74. data/bundler/lib/bundler/inline.rb +41 -30
  75. data/bundler/lib/bundler/installer.rb +41 -60
  76. data/bundler/lib/bundler/installer/gem_installer.rb +8 -4
  77. data/bundler/lib/bundler/installer/parallel_installer.rb +20 -26
  78. data/bundler/lib/bundler/installer/standalone.rb +18 -4
  79. data/bundler/lib/bundler/lazy_specification.rb +41 -27
  80. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  81. data/bundler/lib/bundler/lockfile_parser.rb +16 -33
  82. data/bundler/lib/bundler/{ssl_certs → man}/.document +0 -0
  83. data/bundler/lib/bundler/man/bundle-add.1 +66 -0
  84. data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
  85. data/bundler/lib/bundler/man/bundle-binstubs.1 +42 -0
  86. data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
  87. data/bundler/lib/bundler/man/bundle-cache.1 +55 -0
  88. data/bundler/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
  89. data/bundler/lib/bundler/man/bundle-check.1 +31 -0
  90. data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  91. data/bundler/lib/bundler/man/bundle-clean.1 +24 -0
  92. data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
  93. data/bundler/lib/bundler/man/bundle-config.1 +488 -0
  94. data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +59 -67
  95. data/bundler/lib/bundler/man/bundle-doctor.1 +44 -0
  96. data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  97. data/bundler/lib/bundler/man/bundle-exec.1 +165 -0
  98. data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
  99. data/bundler/lib/bundler/man/bundle-gem.1 +102 -0
  100. data/bundler/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +30 -7
  101. data/bundler/lib/bundler/man/bundle-info.1 +20 -0
  102. data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  103. data/bundler/lib/bundler/man/bundle-init.1 +25 -0
  104. data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
  105. data/bundler/lib/bundler/man/bundle-inject.1 +33 -0
  106. data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
  107. data/bundler/lib/bundler/man/bundle-install.1 +338 -0
  108. data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
  109. data/bundler/lib/bundler/man/bundle-list.1 +50 -0
  110. data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  111. data/bundler/lib/bundler/man/bundle-lock.1 +84 -0
  112. data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  113. data/bundler/lib/bundler/man/bundle-open.1 +32 -0
  114. data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
  115. data/bundler/lib/bundler/man/bundle-outdated.1 +155 -0
  116. data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
  117. data/bundler/lib/bundler/man/bundle-platform.1 +61 -0
  118. data/bundler/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
  119. data/bundler/lib/bundler/man/bundle-pristine.1 +34 -0
  120. data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  121. data/bundler/lib/bundler/man/bundle-remove.1 +31 -0
  122. data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  123. data/bundler/lib/bundler/man/bundle-show.1 +23 -0
  124. data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
  125. data/bundler/lib/bundler/man/bundle-update.1 +394 -0
  126. data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +3 -3
  127. data/bundler/lib/bundler/man/bundle-viz.1 +39 -0
  128. data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
  129. data/bundler/lib/bundler/man/bundle.1 +136 -0
  130. data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +2 -2
  131. data/bundler/lib/bundler/man/gemfile.5 +686 -0
  132. data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +16 -20
  133. data/bundler/lib/bundler/man/index.txt +25 -0
  134. data/bundler/lib/bundler/match_platform.rb +1 -1
  135. data/bundler/lib/bundler/mirror.rb +5 -5
  136. data/bundler/lib/bundler/plugin.rb +75 -36
  137. data/bundler/lib/bundler/plugin/api.rb +1 -1
  138. data/bundler/lib/bundler/plugin/api/source.rb +12 -7
  139. data/bundler/lib/bundler/plugin/dsl.rb +1 -1
  140. data/bundler/lib/bundler/plugin/index.rb +24 -4
  141. data/bundler/lib/bundler/plugin/installer.rb +33 -22
  142. data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -1
  143. data/bundler/lib/bundler/plugin/source_list.rb +5 -1
  144. data/bundler/lib/bundler/psyched_yaml.rb +0 -15
  145. data/bundler/lib/bundler/remote_specification.rb +5 -4
  146. data/bundler/lib/bundler/resolver.rb +191 -87
  147. data/bundler/lib/bundler/resolver/spec_group.rb +76 -48
  148. data/bundler/lib/bundler/retry.rb +3 -3
  149. data/bundler/lib/bundler/ruby_version.rb +5 -20
  150. data/bundler/lib/bundler/rubygems_ext.rb +76 -72
  151. data/bundler/lib/bundler/rubygems_gem_installer.rb +47 -13
  152. data/bundler/lib/bundler/rubygems_integration.rb +159 -444
  153. data/bundler/lib/bundler/runtime.rb +6 -23
  154. data/bundler/lib/bundler/settings.rb +67 -93
  155. data/bundler/lib/bundler/setup.rb +11 -12
  156. data/bundler/lib/bundler/shared_helpers.rb +54 -80
  157. data/bundler/lib/bundler/similarity_detector.rb +3 -3
  158. data/bundler/lib/bundler/source.rb +12 -6
  159. data/bundler/lib/bundler/source/git.rb +47 -38
  160. data/bundler/lib/bundler/source/git/git_proxy.rb +101 -102
  161. data/bundler/lib/bundler/source/metadata.rb +7 -6
  162. data/bundler/lib/bundler/source/path.rb +20 -11
  163. data/bundler/lib/bundler/source/path/installer.rb +10 -10
  164. data/bundler/lib/bundler/source/rubygems.rb +56 -29
  165. data/bundler/lib/bundler/source/rubygems/remote.rb +3 -4
  166. data/bundler/lib/bundler/source_list.rb +32 -30
  167. data/bundler/lib/bundler/spec_set.rb +37 -25
  168. data/bundler/lib/bundler/stub_specification.rb +40 -34
  169. data/bundler/lib/bundler/templates/Executable.bundler +23 -14
  170. data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  171. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  172. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +16 -2
  173. data/bundler/lib/bundler/templates/newgem/README.md.tt +7 -5
  174. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +19 -5
  175. data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
  176. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
  177. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
  178. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +18 -0
  179. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  180. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  181. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  182. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +18 -31
  183. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  184. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  185. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  186. data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
  187. data/bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
  188. data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  189. data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  190. data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -1
  191. data/bundler/lib/bundler/ui.rb +3 -3
  192. data/bundler/lib/bundler/ui/rg_proxy.rb +1 -1
  193. data/bundler/lib/bundler/ui/shell.rb +7 -11
  194. data/bundler/lib/bundler/uri_credentials_filter.rb +10 -4
  195. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
  196. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
  197. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
  198. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
  199. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
  200. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
  201. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  202. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +36 -4
  203. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  204. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  205. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  206. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  207. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
  208. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  209. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
  210. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
  211. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
  212. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  213. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
  214. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
  215. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
  216. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
  217. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
  218. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
  219. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
  220. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +16 -9
  221. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
  222. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
  223. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
  224. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
  225. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +20 -9
  226. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
  227. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
  228. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
  229. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
  230. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
  231. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
  232. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
  233. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
  234. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
  235. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  236. data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
  237. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
  238. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
  239. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +21 -5
  240. data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
  241. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
  242. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
  243. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +65 -8
  244. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
  245. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
  246. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
  247. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  248. data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
  249. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  250. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  251. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  252. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  253. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  254. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  255. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  256. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  257. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  258. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  259. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  260. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  261. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  262. data/bundler/lib/bundler/vendored_fileutils.rb +1 -6
  263. data/bundler/lib/bundler/vendored_molinillo.rb +1 -1
  264. data/bundler/lib/bundler/vendored_persistent.rb +7 -12
  265. data/bundler/lib/bundler/vendored_thor.rb +2 -2
  266. data/bundler/lib/bundler/vendored_tmpdir.rb +4 -0
  267. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  268. data/bundler/lib/bundler/version.rb +1 -20
  269. data/bundler/lib/bundler/version_ranges.rb +51 -5
  270. data/bundler/lib/bundler/vlad.rb +2 -2
  271. data/bundler/lib/bundler/worker.rb +2 -4
  272. data/bundler/lib/bundler/yaml_serializer.rb +3 -4
  273. data/lib/rubygems.rb +198 -222
  274. data/lib/rubygems/available_set.rb +4 -5
  275. data/lib/rubygems/basic_specification.rb +32 -19
  276. data/lib/rubygems/bundler_version_finder.rb +19 -9
  277. data/lib/rubygems/command.rb +73 -21
  278. data/lib/rubygems/command_manager.rb +5 -12
  279. data/lib/rubygems/commands/build_command.rb +51 -18
  280. data/lib/rubygems/commands/cert_command.rb +2 -11
  281. data/lib/rubygems/commands/check_command.rb +0 -2
  282. data/lib/rubygems/commands/cleanup_command.rb +17 -13
  283. data/lib/rubygems/commands/contents_command.rb +7 -9
  284. data/lib/rubygems/commands/dependency_command.rb +9 -10
  285. data/lib/rubygems/commands/environment_command.rb +1 -6
  286. data/lib/rubygems/commands/fetch_command.rb +2 -4
  287. data/lib/rubygems/commands/generate_index_command.rb +3 -2
  288. data/lib/rubygems/commands/help_command.rb +4 -4
  289. data/lib/rubygems/commands/info_command.rb +9 -4
  290. data/lib/rubygems/commands/install_command.rb +12 -54
  291. data/lib/rubygems/commands/list_command.rb +8 -7
  292. data/lib/rubygems/commands/lock_command.rb +3 -5
  293. data/lib/rubygems/commands/mirror_command.rb +0 -1
  294. data/lib/rubygems/commands/open_command.rb +1 -4
  295. data/lib/rubygems/commands/outdated_command.rb +0 -1
  296. data/lib/rubygems/commands/owner_command.rb +10 -10
  297. data/lib/rubygems/commands/pristine_command.rb +13 -9
  298. data/lib/rubygems/commands/push_command.rb +12 -51
  299. data/lib/rubygems/commands/query_command.rb +14 -330
  300. data/lib/rubygems/commands/rdoc_command.rb +0 -1
  301. data/lib/rubygems/commands/search_command.rb +7 -7
  302. data/lib/rubygems/commands/server_command.rb +3 -1
  303. data/lib/rubygems/commands/setup_command.rb +143 -101
  304. data/lib/rubygems/commands/signin_command.rb +0 -1
  305. data/lib/rubygems/commands/signout_command.rb +0 -2
  306. data/lib/rubygems/commands/sources_command.rb +22 -6
  307. data/lib/rubygems/commands/specification_command.rb +8 -3
  308. data/lib/rubygems/commands/stale_command.rb +1 -1
  309. data/lib/rubygems/commands/uninstall_command.rb +2 -3
  310. data/lib/rubygems/commands/unpack_command.rb +3 -32
  311. data/lib/rubygems/commands/update_command.rb +73 -28
  312. data/lib/rubygems/commands/which_command.rb +0 -1
  313. data/lib/rubygems/commands/yank_command.rb +10 -7
  314. data/lib/rubygems/compatibility.rb +4 -4
  315. data/lib/rubygems/config_file.rb +48 -27
  316. data/lib/rubygems/core_ext/kernel_gem.rb +7 -6
  317. data/lib/rubygems/core_ext/kernel_require.rb +44 -6
  318. data/lib/rubygems/core_ext/kernel_warn.rb +22 -13
  319. data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
  320. data/lib/rubygems/defaults.rb +110 -23
  321. data/lib/rubygems/dependency.rb +28 -14
  322. data/lib/rubygems/dependency_installer.rb +11 -166
  323. data/lib/rubygems/dependency_list.rb +17 -18
  324. data/lib/rubygems/deprecate.rb +51 -6
  325. data/lib/rubygems/doctor.rb +4 -4
  326. data/lib/rubygems/errors.rb +5 -7
  327. data/lib/rubygems/exceptions.rb +2 -24
  328. data/lib/rubygems/ext.rb +6 -6
  329. data/lib/rubygems/ext/build_error.rb +2 -0
  330. data/lib/rubygems/ext/builder.rb +45 -82
  331. data/lib/rubygems/ext/cmake_builder.rb +6 -7
  332. data/lib/rubygems/ext/configure_builder.rb +5 -8
  333. data/lib/rubygems/ext/ext_conf_builder.rb +27 -23
  334. data/lib/rubygems/ext/rake_builder.rb +4 -6
  335. data/lib/rubygems/gem_runner.rb +3 -10
  336. data/lib/rubygems/gemcutter_utilities.rb +111 -37
  337. data/lib/rubygems/indexer.rb +9 -26
  338. data/lib/rubygems/install_update_options.rb +7 -7
  339. data/lib/rubygems/installer.rb +91 -98
  340. data/lib/rubygems/installer_test_case.rb +104 -42
  341. data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
  342. data/lib/rubygems/local_remote_options.rb +1 -1
  343. data/lib/rubygems/mock_gem_ui.rb +1 -4
  344. data/lib/rubygems/name_tuple.rb +4 -7
  345. data/lib/rubygems/openssl.rb +7 -0
  346. data/lib/rubygems/package.rb +49 -32
  347. data/lib/rubygems/package/digest_io.rb +0 -2
  348. data/lib/rubygems/package/file_source.rb +0 -2
  349. data/lib/rubygems/package/io_source.rb +0 -2
  350. data/lib/rubygems/package/old.rb +1 -3
  351. data/lib/rubygems/package/tar_header.rb +4 -6
  352. data/lib/rubygems/package/tar_reader.rb +15 -12
  353. data/lib/rubygems/package/tar_reader/entry.rb +0 -3
  354. data/lib/rubygems/package/tar_test_case.rb +2 -4
  355. data/lib/rubygems/package/tar_writer.rb +6 -16
  356. data/lib/rubygems/package_task.rb +1 -7
  357. data/lib/rubygems/path_support.rb +2 -2
  358. data/lib/rubygems/platform.rb +22 -16
  359. data/lib/rubygems/query_utils.rb +353 -0
  360. data/lib/rubygems/rdoc.rb +0 -12
  361. data/lib/rubygems/remote_fetcher.rb +33 -59
  362. data/lib/rubygems/request.rb +11 -14
  363. data/lib/rubygems/request/connection_pools.rb +3 -7
  364. data/lib/rubygems/request/http_pool.rb +0 -1
  365. data/lib/rubygems/request_set.rb +10 -23
  366. data/lib/rubygems/request_set/gem_dependency_api.rb +9 -11
  367. data/lib/rubygems/request_set/lockfile.rb +13 -12
  368. data/lib/rubygems/request_set/lockfile/parser.rb +2 -2
  369. data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
  370. data/lib/rubygems/requirement.rb +36 -35
  371. data/lib/rubygems/resolver.rb +20 -16
  372. data/lib/rubygems/resolver/activation_request.rb +27 -51
  373. data/lib/rubygems/resolver/api_set.rb +31 -24
  374. data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
  375. data/lib/rubygems/resolver/api_specification.rb +24 -10
  376. data/lib/rubygems/resolver/best_set.rb +4 -6
  377. data/lib/rubygems/resolver/composed_set.rb +3 -5
  378. data/lib/rubygems/resolver/conflict.rb +2 -9
  379. data/lib/rubygems/resolver/current_set.rb +0 -2
  380. data/lib/rubygems/resolver/dependency_request.rb +1 -3
  381. data/lib/rubygems/resolver/git_set.rb +0 -2
  382. data/lib/rubygems/resolver/git_specification.rb +0 -2
  383. data/lib/rubygems/resolver/index_set.rb +1 -3
  384. data/lib/rubygems/resolver/index_specification.rb +32 -2
  385. data/lib/rubygems/resolver/installed_specification.rb +0 -2
  386. data/lib/rubygems/resolver/installer_set.rb +63 -16
  387. data/lib/rubygems/resolver/local_specification.rb +0 -2
  388. data/lib/rubygems/resolver/lock_set.rb +3 -5
  389. data/lib/rubygems/resolver/lock_specification.rb +2 -4
  390. data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
  391. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  392. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +8 -0
  393. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +39 -6
  394. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  395. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
  396. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
  397. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
  398. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
  399. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
  400. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
  401. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
  402. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +51 -12
  403. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +76 -8
  404. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  405. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +12 -0
  406. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
  407. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +510 -165
  408. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
  409. data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
  410. data/lib/rubygems/resolver/requirement_list.rb +0 -1
  411. data/lib/rubygems/resolver/set.rb +0 -2
  412. data/lib/rubygems/resolver/source_set.rb +0 -2
  413. data/lib/rubygems/resolver/spec_specification.rb +14 -2
  414. data/lib/rubygems/resolver/specification.rb +13 -2
  415. data/lib/rubygems/resolver/vendor_set.rb +0 -2
  416. data/lib/rubygems/resolver/vendor_specification.rb +0 -2
  417. data/lib/rubygems/s3_uri_signer.rb +15 -13
  418. data/lib/rubygems/safe_yaml.rb +4 -4
  419. data/lib/rubygems/security.rb +27 -34
  420. data/lib/rubygems/security/policy.rb +4 -8
  421. data/lib/rubygems/security/signer.rb +8 -9
  422. data/lib/rubygems/security/trust_dir.rb +1 -3
  423. data/lib/rubygems/server.rb +20 -16
  424. data/lib/rubygems/source.rb +30 -13
  425. data/lib/rubygems/source/git.rb +7 -8
  426. data/lib/rubygems/source/installed.rb +0 -2
  427. data/lib/rubygems/source/local.rb +2 -4
  428. data/lib/rubygems/source/lock.rb +0 -2
  429. data/lib/rubygems/source/specific_file.rb +0 -2
  430. data/lib/rubygems/source/vendor.rb +0 -2
  431. data/lib/rubygems/source_list.rb +6 -6
  432. data/lib/rubygems/spec_fetcher.rb +22 -34
  433. data/lib/rubygems/specification.rb +207 -278
  434. data/lib/rubygems/specification_policy.rb +135 -57
  435. data/{bundler/lib/bundler/ssl_certs/index.rubygems.org → lib/rubygems/ssl_certs/rubygems.org}/GlobalSignRootCA.pem +0 -0
  436. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
  437. data/lib/rubygems/stub_specification.rb +4 -5
  438. data/lib/rubygems/test_case.rb +221 -341
  439. data/lib/rubygems/test_utilities.rb +22 -18
  440. data/lib/rubygems/text.rb +2 -3
  441. data/lib/rubygems/uninstaller.rb +49 -30
  442. data/lib/rubygems/uri_formatter.rb +2 -4
  443. data/lib/rubygems/uri_parser.rb +34 -0
  444. data/lib/rubygems/uri_parsing.rb +23 -0
  445. data/lib/rubygems/user_interaction.rb +3 -20
  446. data/lib/rubygems/util.rb +20 -44
  447. data/lib/rubygems/util/licenses.rb +400 -400
  448. data/lib/rubygems/validator.rb +9 -31
  449. data/lib/rubygems/version.rb +29 -21
  450. data/lib/rubygems/version_option.rb +6 -0
  451. data/rubygems-update.gemspec +4 -11
  452. data/setup.rb +2 -7
  453. data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
  454. data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
  455. data/test/rubygems/rubygems/commands/crash_command.rb +0 -2
  456. data/test/rubygems/rubygems_plugin.rb +0 -2
  457. data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
  458. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +12 -0
  459. data/test/rubygems/test_bundled_ca.rb +42 -45
  460. data/test/rubygems/test_config.rb +0 -2
  461. data/test/rubygems/test_deprecate.rb +41 -5
  462. data/test/rubygems/test_gem.rb +405 -236
  463. data/test/rubygems/test_gem_available_set.rb +5 -6
  464. data/test/rubygems/test_gem_bundler_version_finder.rb +20 -2
  465. data/test/rubygems/test_gem_command.rb +144 -9
  466. data/test/rubygems/test_gem_command_manager.rb +40 -17
  467. data/test/rubygems/test_gem_commands_build_command.rb +386 -13
  468. data/test/rubygems/test_gem_commands_cert_command.rb +18 -6
  469. data/test/rubygems/test_gem_commands_check_command.rb +0 -2
  470. data/test/rubygems/test_gem_commands_cleanup_command.rb +35 -10
  471. data/test/rubygems/test_gem_commands_contents_command.rb +50 -19
  472. data/test/rubygems/test_gem_commands_dependency_command.rb +1 -3
  473. data/test/rubygems/test_gem_commands_environment_command.rb +21 -33
  474. data/test/rubygems/test_gem_commands_fetch_command.rb +0 -2
  475. data/test/rubygems/test_gem_commands_generate_index_command.rb +32 -2
  476. data/test/rubygems/test_gem_commands_help_command.rb +16 -8
  477. data/test/rubygems/test_gem_commands_info_command.rb +6 -7
  478. data/test/rubygems/test_gem_commands_install_command.rb +368 -34
  479. data/test/rubygems/test_gem_commands_list_command.rb +0 -2
  480. data/test/rubygems/test_gem_commands_lock_command.rb +0 -2
  481. data/test/rubygems/test_gem_commands_mirror.rb +1 -2
  482. data/test/rubygems/test_gem_commands_open_command.rb +4 -6
  483. data/test/rubygems/test_gem_commands_outdated_command.rb +18 -1
  484. data/test/rubygems/test_gem_commands_owner_command.rb +62 -9
  485. data/test/rubygems/test_gem_commands_pristine_command.rb +148 -16
  486. data/test/rubygems/test_gem_commands_push_command.rb +94 -21
  487. data/test/rubygems/test_gem_commands_query_command.rb +35 -10
  488. data/test/rubygems/test_gem_commands_search_command.rb +0 -2
  489. data/test/rubygems/test_gem_commands_server_command.rb +6 -4
  490. data/test/rubygems/test_gem_commands_setup_command.rb +228 -128
  491. data/test/rubygems/test_gem_commands_signin_command.rb +36 -11
  492. data/test/rubygems/test_gem_commands_signout_command.rb +0 -7
  493. data/test/rubygems/test_gem_commands_sources_command.rb +193 -9
  494. data/test/rubygems/test_gem_commands_specification_command.rb +46 -20
  495. data/test/rubygems/test_gem_commands_stale_command.rb +0 -2
  496. data/test/rubygems/test_gem_commands_uninstall_command.rb +108 -52
  497. data/test/rubygems/test_gem_commands_unpack_command.rb +0 -2
  498. data/test/rubygems/test_gem_commands_update_command.rb +201 -29
  499. data/test/rubygems/test_gem_commands_which_command.rb +3 -5
  500. data/test/rubygems/test_gem_commands_yank_command.rb +86 -5
  501. data/test/rubygems/test_gem_config_file.rb +25 -13
  502. data/test/rubygems/test_gem_dependency.rb +6 -2
  503. data/test/rubygems/test_gem_dependency_installer.rb +169 -252
  504. data/test/rubygems/test_gem_dependency_list.rb +31 -26
  505. data/test/rubygems/test_gem_dependency_resolution_error.rb +1 -3
  506. data/test/rubygems/test_gem_doctor.rb +28 -2
  507. data/test/rubygems/test_gem_ext_builder.rb +51 -44
  508. data/test/rubygems/test_gem_ext_cmake_builder.rb +16 -23
  509. data/test/rubygems/test_gem_ext_configure_builder.rb +6 -14
  510. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -29
  511. data/test/rubygems/test_gem_ext_rake_builder.rb +39 -22
  512. data/test/rubygems/test_gem_gem_runner.rb +47 -2
  513. data/test/rubygems/test_gem_gemcutter_utilities.rb +16 -13
  514. data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -2
  515. data/test/rubygems/test_gem_indexer.rb +40 -55
  516. data/test/rubygems/test_gem_install_update_options.rb +45 -21
  517. data/test/rubygems/test_gem_installer.rb +661 -338
  518. data/test/rubygems/test_gem_local_remote_options.rb +0 -2
  519. data/test/rubygems/test_gem_name_tuple.rb +0 -2
  520. data/test/rubygems/test_gem_package.rb +132 -45
  521. data/test/rubygems/test_gem_package_old.rb +56 -55
  522. data/test/rubygems/test_gem_package_tar_header.rb +18 -1
  523. data/test/rubygems/test_gem_package_tar_reader.rb +0 -2
  524. data/test/rubygems/test_gem_package_tar_reader_entry.rb +6 -7
  525. data/test/rubygems/test_gem_package_tar_writer.rb +20 -12
  526. data/test/rubygems/test_gem_package_task.rb +46 -13
  527. data/test/rubygems/test_gem_path_support.rb +17 -13
  528. data/test/rubygems/test_gem_platform.rb +74 -7
  529. data/test/rubygems/test_gem_rdoc.rb +0 -1
  530. data/test/rubygems/test_gem_remote_fetcher.rb +223 -209
  531. data/test/rubygems/test_gem_request.rb +30 -19
  532. data/test/rubygems/test_gem_request_connection_pools.rb +2 -2
  533. data/test/rubygems/test_gem_request_set.rb +104 -29
  534. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +4 -6
  535. data/test/rubygems/test_gem_request_set_lockfile.rb +4 -5
  536. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +9 -10
  537. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +118 -118
  538. data/test/rubygems/test_gem_requirement.rb +50 -4
  539. data/test/rubygems/test_gem_resolver.rb +73 -31
  540. data/test/rubygems/test_gem_resolver_activation_request.rb +3 -34
  541. data/test/rubygems/test_gem_resolver_api_set.rb +60 -59
  542. data/test/rubygems/test_gem_resolver_api_specification.rb +3 -5
  543. data/test/rubygems/test_gem_resolver_best_set.rb +27 -6
  544. data/test/rubygems/test_gem_resolver_composed_set.rb +0 -2
  545. data/test/rubygems/test_gem_resolver_conflict.rb +1 -7
  546. data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -2
  547. data/test/rubygems/test_gem_resolver_git_set.rb +0 -2
  548. data/test/rubygems/test_gem_resolver_git_specification.rb +1 -2
  549. data/test/rubygems/test_gem_resolver_index_set.rb +2 -4
  550. data/test/rubygems/test_gem_resolver_index_specification.rb +7 -4
  551. data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -3
  552. data/test/rubygems/test_gem_resolver_installer_set.rb +10 -10
  553. data/test/rubygems/test_gem_resolver_local_specification.rb +0 -2
  554. data/test/rubygems/test_gem_resolver_lock_set.rb +3 -5
  555. data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -2
  556. data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -2
  557. data/test/rubygems/test_gem_resolver_specification.rb +0 -2
  558. data/test/rubygems/test_gem_resolver_vendor_set.rb +1 -3
  559. data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -2
  560. data/test/rubygems/test_gem_security.rb +27 -25
  561. data/test/rubygems/test_gem_security_policy.rb +7 -12
  562. data/test/rubygems/test_gem_security_signer.rb +11 -12
  563. data/test/rubygems/test_gem_security_trust_dir.rb +4 -6
  564. data/test/rubygems/test_gem_server.rb +13 -12
  565. data/test/rubygems/test_gem_silent_ui.rb +0 -1
  566. data/test/rubygems/test_gem_source.rb +32 -17
  567. data/test/rubygems/test_gem_source_fetch_problem.rb +0 -1
  568. data/test/rubygems/test_gem_source_git.rb +12 -18
  569. data/test/rubygems/test_gem_source_installed.rb +11 -13
  570. data/test/rubygems/test_gem_source_list.rb +1 -1
  571. data/test/rubygems/test_gem_source_local.rb +8 -9
  572. data/test/rubygems/test_gem_source_lock.rb +17 -19
  573. data/test/rubygems/test_gem_source_specific_file.rb +9 -10
  574. data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
  575. data/test/rubygems/test_gem_source_vendor.rb +7 -9
  576. data/test/rubygems/test_gem_spec_fetcher.rb +11 -4
  577. data/test/rubygems/test_gem_specification.rb +363 -245
  578. data/test/rubygems/test_gem_stream_ui.rb +3 -1
  579. data/test/rubygems/test_gem_stub_specification.rb +6 -7
  580. data/test/rubygems/test_gem_text.rb +1 -2
  581. data/test/rubygems/test_gem_uninstaller.rb +165 -22
  582. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -2
  583. data/test/rubygems/test_gem_uri_formatter.rb +0 -2
  584. data/test/rubygems/test_gem_util.rb +17 -15
  585. data/test/rubygems/test_gem_validator.rb +4 -7
  586. data/test/rubygems/test_gem_version.rb +23 -10
  587. data/test/rubygems/test_gem_version_option.rb +1 -3
  588. data/test/rubygems/test_kernel.rb +25 -9
  589. data/test/rubygems/test_project_sanity.rb +20 -0
  590. data/test/rubygems/test_remote_fetch_error.rb +1 -2
  591. data/test/rubygems/test_require.rb +394 -56
  592. data/test/test_changelog_generator.rb +17 -0
  593. metadata +109 -155
  594. data/.rubocop.yml +0 -67
  595. data/.travis.yml +0 -38
  596. data/appveyor.yml +0 -43
  597. data/bundler/CODE_OF_CONDUCT.md +0 -42
  598. data/bundler/CONTRIBUTING.md +0 -17
  599. data/bundler/exe/bundle_ruby +0 -60
  600. data/bundler/lib/bundler/cli/package.rb +0 -49
  601. data/bundler/lib/bundler/compatibility_guard.rb +0 -14
  602. data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
  603. data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
  604. data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  605. data/bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  606. data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
  607. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  608. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
  609. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
  610. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
  611. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
  612. data/lib/rubygems/source_local.rb +0 -7
  613. data/lib/rubygems/source_specific_file.rb +0 -6
  614. data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
  615. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  616. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  617. data/lib/ubygems.rb +0 -14
  618. data/util/CL2notes +0 -55
  619. data/util/ci +0 -82
  620. data/util/cops/deprecations.rb +0 -52
  621. data/util/create_certs.rb +0 -171
  622. data/util/create_certs.sh +0 -27
  623. data/util/create_encrypted_key.rb +0 -16
  624. data/util/generate_spdx_license_list.rb +0 -61
  625. data/util/patch_with_prs.rb +0 -77
  626. data/util/rubocop +0 -8
  627. data/util/update_bundled_ca_certificates.rb +0 -139
  628. data/util/update_changelog.rb +0 -67
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'rubygems/source'
3
2
 
4
3
  ##
5
4
  # The SourceList represents the sources rubygems has been configured to use.
@@ -15,7 +14,6 @@ require 'rubygems/source'
15
14
  # The most common way to get a SourceList is Gem.sources.
16
15
 
17
16
  class Gem::SourceList
18
-
19
17
  include Enumerable
20
18
 
21
19
  ##
@@ -50,6 +48,8 @@ class Gem::SourceList
50
48
  # String.
51
49
 
52
50
  def <<(obj)
51
+ require "uri"
52
+
53
53
  src = case obj
54
54
  when URI
55
55
  Gem::Source.new(obj)
@@ -88,7 +88,7 @@ class Gem::SourceList
88
88
  # Yields each source URI in the list.
89
89
 
90
90
  def each
91
- @sources.each { |s| yield s.uri.to_s }
91
+ @sources.each {|s| yield s.uri.to_s }
92
92
  end
93
93
 
94
94
  ##
@@ -113,7 +113,7 @@ class Gem::SourceList
113
113
  # Returns an Array of source URI Strings.
114
114
 
115
115
  def to_a
116
- @sources.map { |x| x.uri.to_s }
116
+ @sources.map {|x| x.uri.to_s }
117
117
  end
118
118
 
119
119
  alias_method :to_ary, :to_a
@@ -133,7 +133,7 @@ class Gem::SourceList
133
133
  if other.kind_of? Gem::Source
134
134
  @sources.include? other
135
135
  else
136
- @sources.find { |x| x.uri.to_s == other.to_s }
136
+ @sources.find {|x| x.uri.to_s == other.to_s }
137
137
  end
138
138
  end
139
139
 
@@ -144,7 +144,7 @@ class Gem::SourceList
144
144
  if source.kind_of? Gem::Source
145
145
  @sources.delete source
146
146
  else
147
- @sources.delete_if { |x| x.uri.to_s == source.to_s }
147
+ @sources.delete_if {|x| x.uri.to_s == source.to_s }
148
148
  end
149
149
  end
150
150
  end
@@ -9,7 +9,6 @@ require 'rubygems/name_tuple'
9
9
  # SpecFetcher handles metadata updates from remote gem repositories.
10
10
 
11
11
  class Gem::SpecFetcher
12
-
13
12
  include Gem::UserInteraction
14
13
  include Gem::Text
15
14
 
@@ -88,29 +87,18 @@ class Gem::SpecFetcher
88
87
 
89
88
  rejected_specs = {}
90
89
 
91
- if dependency.prerelease?
92
- if dependency.specific?
93
- type = :complete
94
- else
95
- type = :abs_latest
96
- end
97
- elsif dependency.latest_version?
98
- type = :latest
99
- else
100
- type = :released
101
- end
90
+ list, errors = available_specs(dependency.identity)
102
91
 
103
- list, errors = available_specs(type)
104
92
  list.each do |source, specs|
105
93
  if dependency.name.is_a?(String) && specs.respond_to?(:bsearch)
106
- start_index = (0 ... specs.length).bsearch{ |i| specs[i].name >= dependency.name }
107
- end_index = (0 ... specs.length).bsearch{ |i| specs[i].name > dependency.name }
94
+ start_index = (0 ... specs.length).bsearch{|i| specs[i].name >= dependency.name }
95
+ end_index = (0 ... specs.length).bsearch{|i| specs[i].name > dependency.name }
108
96
  specs = specs[start_index ... end_index] if start_index && end_index
109
97
  end
110
98
 
111
99
  found[source] = specs.select do |tup|
112
100
  if dependency.match?(tup)
113
- if matching_platform and !Gem::Platform.match(tup.platform)
101
+ if matching_platform and !Gem::Platform.match_gem?(tup.platform, tup.name)
114
102
  pm = (
115
103
  rejected_specs[dependency] ||= \
116
104
  Gem::PlatformMismatch.new(tup.name, tup.version))
@@ -133,12 +121,11 @@ class Gem::SpecFetcher
133
121
  end
134
122
  end
135
123
 
136
- tuples = tuples.sort_by { |x| x[0] }
124
+ tuples = tuples.sort_by {|x| x[0] }
137
125
 
138
126
  return [tuples, errors]
139
127
  end
140
128
 
141
-
142
129
  ##
143
130
  # Return all gem name tuples who's names match +obj+
144
131
 
@@ -157,7 +144,6 @@ class Gem::SpecFetcher
157
144
  tuples
158
145
  end
159
146
 
160
-
161
147
  ##
162
148
  # Find and fetch specs that match +dependency+.
163
149
  #
@@ -184,30 +170,33 @@ class Gem::SpecFetcher
184
170
  # Suggests gems based on the supplied +gem_name+. Returns an array of
185
171
  # alternative gem names.
186
172
 
187
- def suggest_gems_from_name(gem_name, type = :latest)
173
+ def suggest_gems_from_name(gem_name, type = :latest, num_results = 5)
188
174
  gem_name = gem_name.downcase.tr('_-', '')
189
175
  max = gem_name.size / 2
190
176
  names = available_specs(type).first.values.flatten(1)
191
177
 
192
- matches = names.map { |n|
178
+ matches = names.map do |n|
193
179
  next unless n.match_platform?
194
-
195
- distance = levenshtein_distance gem_name, n.name.downcase.tr('_-', '')
196
-
197
- next if distance >= max
198
-
199
- return [n.name] if distance == 0
200
-
201
- [n.name, distance]
202
- }.compact
180
+ [n.name, 0] if n.name.downcase.tr('_-', '').include?(gem_name)
181
+ end.compact
182
+
183
+ if matches.length < num_results
184
+ matches += names.map do |n|
185
+ next unless n.match_platform?
186
+ distance = levenshtein_distance gem_name, n.name.downcase.tr('_-', '')
187
+ next if distance >= max
188
+ return [n.name] if distance == 0
189
+ [n.name, distance]
190
+ end.compact
191
+ end
203
192
 
204
193
  matches = if matches.empty? && type != :prerelease
205
194
  suggest_gems_from_name gem_name, :prerelease
206
195
  else
207
- matches.uniq.sort_by { |name, dist| dist }
196
+ matches.uniq.sort_by {|name, dist| dist }
208
197
  end
209
198
 
210
- matches.first(5).map { |name, dist| name }
199
+ matches.map {|name, dist| name }.uniq.first(num_results)
211
200
  end
212
201
 
213
202
  ##
@@ -264,10 +253,9 @@ class Gem::SpecFetcher
264
253
 
265
254
  def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
266
255
  @caches[type][source.uri] ||=
267
- source.load_specs(type).sort_by { |tup| tup.name }
256
+ source.load_specs(type).sort_by {|tup| tup.name }
268
257
  rescue Gem::RemoteFetcher::FetchError
269
258
  raise unless gracefully_ignore
270
259
  []
271
260
  end
272
-
273
261
  end
@@ -6,16 +6,11 @@
6
6
  # See LICENSE.txt for permissions.
7
7
  #++
8
8
 
9
-
10
- require 'rubygems/version'
11
- require 'rubygems/requirement'
12
- require 'rubygems/platform'
13
9
  require 'rubygems/deprecate'
14
10
  require 'rubygems/basic_specification'
15
11
  require 'rubygems/stub_specification'
16
12
  require 'rubygems/specification_policy'
17
13
  require 'rubygems/util/list'
18
- require 'stringio'
19
14
 
20
15
  ##
21
16
  # The Specification class contains the information for a gem. Typically
@@ -39,7 +34,6 @@ require 'stringio'
39
34
  # items you may add to a specification.
40
35
 
41
36
  class Gem::Specification < Gem::BasicSpecification
42
-
43
37
  extend Gem::Deprecate
44
38
 
45
39
  # REFACTOR: Consider breaking out this version stuff into a separate
@@ -83,18 +77,18 @@ class Gem::Specification < Gem::BasicSpecification
83
77
  -1 => ['(RubyGems versions up to and including 0.7 did not have versioned specifications)'],
84
78
  1 => [
85
79
  'Deprecated "test_suite_file" in favor of the new, but equivalent, "test_files"',
86
- '"test_file=x" is a shortcut for "test_files=[x]"'
80
+ '"test_file=x" is a shortcut for "test_files=[x]"',
87
81
  ],
88
- 2 => [
82
+ 2 => [
89
83
  'Added "required_rubygems_version"',
90
84
  'Now forward-compatible with future versions',
91
85
  ],
92
- 3 => [
93
- 'Added Fixnum validation to the specification_version'
86
+ 3 => [
87
+ 'Added Fixnum validation to the specification_version',
88
+ ],
89
+ 4 => [
90
+ 'Added sandboxed freeform metadata to the specification version.',
94
91
  ],
95
- 4 => [
96
- 'Added sandboxed freeform metadata to the specification version.'
97
- ]
98
92
  }.freeze
99
93
 
100
94
  MARSHAL_FIELDS = { # :nodoc:
@@ -111,6 +105,7 @@ class Gem::Specification < Gem::BasicSpecification
111
105
  # rubocop:disable Style/MutableConstant
112
106
  LOAD_CACHE = {} # :nodoc:
113
107
  # rubocop:enable Style/MutableConstant
108
+ LOAD_CACHE_MUTEX = Mutex.new
114
109
 
115
110
  private_constant :LOAD_CACHE if defined? private_constant
116
111
 
@@ -181,18 +176,25 @@ class Gem::Specification < Gem::BasicSpecification
181
176
  end
182
177
  end
183
178
 
184
- @@attributes = @@default_value.keys.sort_by { |s| s.to_s }
185
- @@array_attributes = @@default_value.reject { |k,v| v != [] }.keys
186
- @@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition { |k|
179
+ @@attributes = @@default_value.keys.sort_by {|s| s.to_s }
180
+ @@array_attributes = @@default_value.reject {|k,v| v != [] }.keys
181
+ @@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition do |k|
187
182
  @@default_value[k].nil?
188
- }
183
+ end
189
184
 
185
+ @@stubs = nil
190
186
  @@stubs_by_name = {}
191
187
 
192
188
  # Sentinel object to represent "not found" stubs
193
189
  NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:
194
- @@spec_with_requirable_file = {}
195
- @@active_stub_with_requirable_file = {}
190
+ @@spec_with_requirable_file = {}
191
+ @@active_stub_with_requirable_file = {}
192
+
193
+ # Tracking removed method calls to warn users during build time.
194
+ REMOVED_METHODS = [:rubyforge_project=].freeze # :nodoc:
195
+ def removed_method_calls
196
+ @removed_method_calls ||= []
197
+ end
196
198
 
197
199
  ######################################################################
198
200
  # :section: Required gemspec attributes
@@ -244,12 +246,11 @@ class Gem::Specification < Gem::BasicSpecification
244
246
  # require 'rake'
245
247
  # spec.files = FileList['lib/**/*.rb',
246
248
  # 'bin/*',
247
- # '[A-Z]*',
248
- # 'test/**/*'].to_a
249
+ # '[A-Z]*'].to_a
249
250
  #
250
251
  # # or without Rake...
251
252
  # spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
252
- # spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
253
+ # spec.files += Dir['[A-Z]*']
253
254
  # spec.files.reject! { |fn| fn.include? "CVS" }
254
255
 
255
256
  def files
@@ -385,6 +386,7 @@ class Gem::Specification < Gem::BasicSpecification
385
386
  # "mailing_list_uri" => "https://groups.example.com/bestgemever",
386
387
  # "source_code_uri" => "https://example.com/user/bestgemever",
387
388
  # "wiki_uri" => "https://example.com/user/bestgemever/wiki"
389
+ # "funding_uri" => "https://example.com/donate"
388
390
  # }
389
391
  #
390
392
  # These links will be used on your gem's page on rubygems.org and must pass
@@ -555,6 +557,10 @@ class Gem::Specification < Gem::BasicSpecification
555
557
  # spec.add_runtime_dependency 'example', '~> 1.1', '>= 1.1.4'
556
558
 
557
559
  def add_runtime_dependency(gem, *requirements)
560
+ if requirements.uniq.size != requirements.size
561
+ warn "WARNING: duplicated #{gem} dependency #{requirements}"
562
+ end
563
+
558
564
  add_dependency_with_type(gem, :runtime, requirements)
559
565
  end
560
566
 
@@ -660,6 +666,9 @@ class Gem::Specification < Gem::BasicSpecification
660
666
  #
661
667
  # # Only prereleases or final releases after 2.6.0.preview2
662
668
  # spec.required_ruby_version = '> 2.6.0.preview2'
669
+ #
670
+ # # This gem will work with 2.3.0 or greater, including major version 3, but lesser than 4.0.0
671
+ # spec.required_ruby_version = '>= 2.3', '< 4'
663
672
 
664
673
  def required_ruby_version=(req)
665
674
  @required_ruby_version = Gem::Requirement.create req
@@ -720,20 +729,13 @@ class Gem::Specification < Gem::BasicSpecification
720
729
  # Deprecated: You must now specify the executable name to Gem.bin_path.
721
730
 
722
731
  attr_writer :default_executable
723
- deprecate :default_executable=, :none, 2018, 12
732
+ rubygems_deprecate :default_executable=
724
733
 
725
734
  ##
726
735
  # Allows deinstallation of gems with legacy platforms.
727
736
 
728
737
  attr_writer :original_platform # :nodoc:
729
738
 
730
- ##
731
- # Deprecated and ignored.
732
- #
733
- # Formerly used to set rubyforge project.
734
-
735
- attr_writer :rubyforge_project
736
-
737
739
  ##
738
740
  # The Gem::Specification version of this gemspec.
739
741
  #
@@ -748,38 +750,31 @@ class Gem::Specification < Gem::BasicSpecification
748
750
  # After a reset, make sure already loaded specs
749
751
  # are still marked as activated.
750
752
  specs = {}
751
- Gem.loaded_specs.each_value{|s| specs[s] = true}
752
- @@all.each{|s| s.activated = true if specs[s]}
753
+ Gem.loaded_specs.each_value{|s| specs[s] = true }
754
+ @@all.each{|s| s.activated = true if specs[s] }
753
755
  end
754
756
  @@all
755
757
  end
756
758
 
757
759
  def self._clear_load_cache # :nodoc:
758
- LOAD_CACHE.clear
760
+ LOAD_CACHE_MUTEX.synchronize do
761
+ LOAD_CACHE.clear
762
+ end
759
763
  end
760
764
 
761
765
  def self.each_gemspec(dirs) # :nodoc:
762
766
  dirs.each do |dir|
763
767
  Gem::Util.glob_files_in_dir("*.gemspec", dir).each do |path|
764
- yield path.untaint
768
+ yield path.tap(&Gem::UNTAINT)
765
769
  end
766
770
  end
767
771
  end
768
772
 
769
773
  def self.gemspec_stubs_in(dir, pattern)
770
- Gem::Util.glob_files_in_dir(pattern, dir).map { |path| yield path }.select(&:valid?)
774
+ Gem::Util.glob_files_in_dir(pattern, dir).map {|path| yield path }.select(&:valid?)
771
775
  end
772
776
  private_class_method :gemspec_stubs_in
773
777
 
774
- def self.default_stubs(pattern)
775
- base_dir = Gem.default_dir
776
- gems_dir = File.join base_dir, "gems"
777
- gemspec_stubs_in(default_specifications_dir, pattern) do |path|
778
- Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
779
- end
780
- end
781
- private_class_method :default_stubs
782
-
783
778
  def self.installed_stubs(dirs, pattern)
784
779
  map_stubs(dirs, pattern) do |path, base_dir, gems_dir|
785
780
  Gem::StubSpecification.gemspec_stub(path, base_dir, gems_dir)
@@ -788,24 +783,14 @@ class Gem::Specification < Gem::BasicSpecification
788
783
  private_class_method :installed_stubs
789
784
 
790
785
  def self.map_stubs(dirs, pattern) # :nodoc:
791
- dirs.flat_map { |dir|
786
+ dirs.flat_map do |dir|
792
787
  base_dir = File.dirname dir
793
788
  gems_dir = File.join base_dir, "gems"
794
- gemspec_stubs_in(dir, pattern) { |path| yield path, base_dir, gems_dir }
795
- }
789
+ gemspec_stubs_in(dir, pattern) {|path| yield path, base_dir, gems_dir }
790
+ end
796
791
  end
797
792
  private_class_method :map_stubs
798
793
 
799
- def self.uniq_by(list, &block) # :nodoc:
800
- list.uniq(&block)
801
- end
802
- private_class_method :uniq_by
803
-
804
- def self.sort_by!(list, &block)
805
- list.sort_by!(&block)
806
- end
807
- private_class_method :sort_by!
808
-
809
794
  def self.each_spec(dirs) # :nodoc:
810
795
  each_gemspec(dirs) do |path|
811
796
  spec = self.load path
@@ -819,16 +804,23 @@ class Gem::Specification < Gem::BasicSpecification
819
804
  def self.stubs
820
805
  @@stubs ||= begin
821
806
  pattern = "*.gemspec"
822
- stubs = Gem.loaded_specs.values + default_stubs(pattern) + installed_stubs(dirs, pattern)
823
- stubs = uniq_by(stubs) { |stub| stub.full_name }
807
+ stubs = stubs_for_pattern(pattern, false)
824
808
 
825
- _resort!(stubs)
826
- @@stubs_by_name = stubs.select { |s| Gem::Platform.match s.platform }.group_by(&:name)
809
+ @@stubs_by_name = stubs.select {|s| Gem::Platform.match_spec? s }.group_by(&:name)
827
810
  stubs
828
811
  end
829
812
  end
830
813
 
831
- EMPTY = [].freeze # :nodoc:
814
+ ##
815
+ # Returns a Gem::StubSpecification for default gems
816
+
817
+ def self.default_stubs(pattern = "*.gemspec")
818
+ base_dir = Gem.default_dir
819
+ gems_dir = File.join base_dir, "gems"
820
+ gemspec_stubs_in(Gem.default_specifications_dir, pattern) do |path|
821
+ Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
822
+ end
823
+ end
832
824
 
833
825
  ##
834
826
  # Returns a Gem::StubSpecification for installed gem named +name+
@@ -838,81 +830,46 @@ class Gem::Specification < Gem::BasicSpecification
838
830
  if @@stubs
839
831
  @@stubs_by_name[name] || []
840
832
  else
841
- pattern = "#{name}-*.gemspec"
842
- stubs = Gem.loaded_specs.values + default_stubs(pattern) +
843
- installed_stubs(dirs, pattern).select { |s| Gem::Platform.match s.platform }
844
- stubs = uniq_by(stubs) { |stub| stub.full_name }.group_by(&:name)
845
- stubs.each_value { |v| _resort!(v) }
846
-
847
- @@stubs_by_name.merge! stubs
848
- @@stubs_by_name[name] ||= EMPTY
833
+ @@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec").select do |s|
834
+ s.name == name
835
+ end
849
836
  end
850
837
  end
851
838
 
839
+ ##
840
+ # Finds stub specifications matching a pattern from the standard locations,
841
+ # optionally filtering out specs not matching the current platform
842
+ #
843
+ def self.stubs_for_pattern(pattern, match_platform = true) # :nodoc:
844
+ installed_stubs = installed_stubs(Gem::Specification.dirs, pattern)
845
+ installed_stubs.select! {|s| Gem::Platform.match_spec? s } if match_platform
846
+ stubs = installed_stubs + default_stubs(pattern)
847
+ stubs = stubs.uniq {|stub| stub.full_name }
848
+ _resort!(stubs)
849
+ stubs
850
+ end
851
+
852
852
  def self._resort!(specs) # :nodoc:
853
- specs.sort! { |a, b|
853
+ specs.sort! do |a, b|
854
854
  names = a.name <=> b.name
855
855
  next names if names.nonzero?
856
- b.version <=> a.version
857
- }
856
+ versions = b.version <=> a.version
857
+ next versions if versions.nonzero?
858
+ b.platform == Gem::Platform::RUBY ? -1 : 1
859
+ end
858
860
  end
859
861
 
860
862
  ##
861
863
  # Loads the default specifications. It should be called only once.
862
864
 
863
865
  def self.load_defaults
864
- each_spec([default_specifications_dir]) do |spec|
866
+ each_spec([Gem.default_specifications_dir]) do |spec|
865
867
  # #load returns nil if the spec is bad, so we just ignore
866
868
  # it at this stage
867
869
  Gem.register_default_spec(spec)
868
870
  end
869
871
  end
870
872
 
871
- ##
872
- # Adds +spec+ to the known specifications, keeping the collection
873
- # properly sorted.
874
-
875
- def self.add_spec(spec)
876
- warn "Gem::Specification.add_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
877
- # TODO: find all extraneous adds
878
- # puts
879
- # p :add_spec => [spec.full_name, caller.reject { |s| s =~ /minitest/ }]
880
-
881
- # TODO: flush the rest of the crap from the tests
882
- # raise "no dupes #{spec.full_name} in #{all_names.inspect}" if
883
- # _all.include? spec
884
-
885
- raise "nil spec!" unless spec # TODO: remove once we're happy with tests
886
-
887
- return if _all.include? spec
888
-
889
- _all << spec
890
- stubs << spec
891
- (@@stubs_by_name[spec.name] ||= []) << spec
892
- sort_by!(@@stubs_by_name[spec.name]) { |s| s.version }
893
- _resort!(_all)
894
- _resort!(stubs)
895
- end
896
-
897
- ##
898
- # Adds multiple specs to the known specifications.
899
-
900
- def self.add_specs(*specs)
901
- warn "Gem::Specification.add_specs is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
902
-
903
- raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
904
-
905
- # TODO: this is much more efficient, but we need the extra checks for now
906
- # _all.concat specs
907
- # _resort!
908
-
909
- Gem::Deprecate.skip_during do
910
- specs.each do |spec| # TODO: slow
911
- add_spec spec
912
- end
913
- end
914
- end
915
-
916
873
  ##
917
874
  # Returns all specifications. This method is discouraged from use.
918
875
  # You probably want to use one of the Enumerable methods instead.
@@ -969,9 +926,9 @@ class Gem::Specification < Gem::BasicSpecification
969
926
  # Return the directories that Specification uses to find specs.
970
927
 
971
928
  def self.dirs
972
- @@dirs ||= Gem.path.collect { |dir|
973
- File.join dir.dup.untaint, "specifications"
974
- }
929
+ @@dirs ||= Gem.path.collect do |dir|
930
+ File.join dir.dup.tap(&Gem::UNTAINT), "specifications"
931
+ end
975
932
  end
976
933
 
977
934
  ##
@@ -981,7 +938,7 @@ class Gem::Specification < Gem::BasicSpecification
981
938
  def self.dirs=(dirs)
982
939
  self.reset
983
940
 
984
- @@dirs = Array(dirs).map { |dir| File.join dir, "specifications" }
941
+ @@dirs = Array(dirs).map {|dir| File.join dir, "specifications" }
985
942
  end
986
943
 
987
944
  extend Enumerable
@@ -1033,10 +990,10 @@ class Gem::Specification < Gem::BasicSpecification
1033
990
 
1034
991
  def self.find_by_path(path)
1035
992
  path = path.dup.freeze
1036
- spec = @@spec_with_requirable_file[path] ||= (stubs.find { |s|
993
+ spec = @@spec_with_requirable_file[path] ||= (stubs.find do |s|
1037
994
  next unless Gem::BundlerVersionFinder.compatible?(s)
1038
995
  s.contains_requirable_file? path
1039
- } || NOT_FOUND)
996
+ end || NOT_FOUND)
1040
997
  spec.to_spec
1041
998
  end
1042
999
 
@@ -1045,18 +1002,18 @@ class Gem::Specification < Gem::BasicSpecification
1045
1002
  # amongst the specs that are not activated.
1046
1003
 
1047
1004
  def self.find_inactive_by_path(path)
1048
- stub = stubs.find { |s|
1005
+ stub = stubs.find do |s|
1049
1006
  next if s.activated?
1050
1007
  next unless Gem::BundlerVersionFinder.compatible?(s)
1051
1008
  s.contains_requirable_file? path
1052
- }
1009
+ end
1053
1010
  stub && stub.to_spec
1054
1011
  end
1055
1012
 
1056
1013
  def self.find_active_stub_by_path(path)
1057
- stub = @@active_stub_with_requirable_file[path] ||= (stubs.find { |s|
1014
+ stub = @@active_stub_with_requirable_file[path] ||= (stubs.find do |s|
1058
1015
  s.activated? and s.contains_requirable_file? path
1059
- } || NOT_FOUND)
1016
+ end || NOT_FOUND)
1060
1017
  stub.this
1061
1018
  end
1062
1019
 
@@ -1064,10 +1021,7 @@ class Gem::Specification < Gem::BasicSpecification
1064
1021
  # Return currently unresolved specs that contain the file matching +path+.
1065
1022
 
1066
1023
  def self.find_in_unresolved(path)
1067
- # TODO: do we need these?? Kill it
1068
- specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
1069
-
1070
- specs.find_all { |spec| spec.contains_requirable_file? path }
1024
+ unresolved_specs.find_all {|spec| spec.contains_requirable_file? path }
1071
1025
  end
1072
1026
 
1073
1027
  ##
@@ -1075,9 +1029,7 @@ class Gem::Specification < Gem::BasicSpecification
1075
1029
  # specs that contain the file matching +path+.
1076
1030
 
1077
1031
  def self.find_in_unresolved_tree(path)
1078
- specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
1079
-
1080
- specs.each do |spec|
1032
+ unresolved_specs.each do |spec|
1081
1033
  spec.traverse do |from_spec, dep, to_spec, trail|
1082
1034
  if to_spec.has_conflicts? || to_spec.conficts_when_loaded_with?(trail)
1083
1035
  :next
@@ -1090,6 +1042,11 @@ class Gem::Specification < Gem::BasicSpecification
1090
1042
  []
1091
1043
  end
1092
1044
 
1045
+ def self.unresolved_specs
1046
+ unresolved_deps.values.map {|dep| dep.to_specs }.flatten
1047
+ end
1048
+ private_class_method :unresolved_specs
1049
+
1093
1050
  ##
1094
1051
  # Special loader for YAML files. When a Specification object is loaded
1095
1052
  # from a YAML file, it bypasses the normal Ruby object initialization
@@ -1126,21 +1083,23 @@ class Gem::Specification < Gem::BasicSpecification
1126
1083
  _latest_specs Gem::Specification._all, prerelease
1127
1084
  end
1128
1085
 
1086
+ ##
1087
+ # Return the latest installed spec for gem +name+.
1088
+
1089
+ def self.latest_spec_for(name)
1090
+ latest_specs(true).find {|installed_spec| installed_spec.name == name }
1091
+ end
1092
+
1129
1093
  def self._latest_specs(specs, prerelease = false) # :nodoc:
1130
- result = Hash.new { |h,k| h[k] = {} }
1131
- native = {}
1094
+ result = {}
1132
1095
 
1133
1096
  specs.reverse_each do |spec|
1134
1097
  next if spec.version.prerelease? unless prerelease
1135
1098
 
1136
- native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY
1137
- result[spec.name][spec.platform] = spec
1099
+ result[spec.name] = spec
1138
1100
  end
1139
1101
 
1140
- result.map(&:last).map(&:values).flatten.reject { |spec|
1141
- minimum = native[spec.name]
1142
- minimum && spec.version < minimum
1143
- }.sort_by{ |tup| tup.name }
1102
+ result.map(&:last).flatten.sort_by{|tup| tup.name }
1144
1103
  end
1145
1104
 
1146
1105
  ##
@@ -1149,22 +1108,29 @@ class Gem::Specification < Gem::BasicSpecification
1149
1108
  def self.load(file)
1150
1109
  return unless file
1151
1110
 
1152
- _spec = LOAD_CACHE[file]
1111
+ _spec = LOAD_CACHE_MUTEX.synchronize { LOAD_CACHE[file] }
1153
1112
  return _spec if _spec
1154
1113
 
1155
- file = file.dup.untaint
1114
+ file = file.dup.tap(&Gem::UNTAINT)
1156
1115
  return unless File.file?(file)
1157
1116
 
1158
1117
  code = File.read file, :mode => 'r:UTF-8:-'
1159
1118
 
1160
- code.untaint
1119
+ code.tap(&Gem::UNTAINT)
1161
1120
 
1162
1121
  begin
1163
1122
  _spec = eval code, binding, file
1164
1123
 
1165
1124
  if Gem::Specification === _spec
1166
1125
  _spec.loaded_from = File.expand_path file.to_s
1167
- LOAD_CACHE[file] = _spec
1126
+ LOAD_CACHE_MUTEX.synchronize do
1127
+ prev = LOAD_CACHE[file]
1128
+ if prev
1129
+ _spec = prev
1130
+ else
1131
+ LOAD_CACHE[file] = _spec
1132
+ end
1133
+ end
1168
1134
  return _spec
1169
1135
  end
1170
1136
 
@@ -1190,7 +1156,7 @@ class Gem::Specification < Gem::BasicSpecification
1190
1156
 
1191
1157
  def self.normalize_yaml_input(input)
1192
1158
  result = input.respond_to?(:read) ? input.read : input
1193
- result = "--- " + result unless result =~ /\A--- /
1159
+ result = "--- " + result unless result.start_with?("--- ")
1194
1160
  result = result.dup
1195
1161
  result.gsub!(/ !!null \n/, " \n")
1196
1162
  # date: 2011-04-26 00:00:00.000000000Z
@@ -1207,7 +1173,7 @@ class Gem::Specification < Gem::BasicSpecification
1207
1173
  # version as well.
1208
1174
 
1209
1175
  def self.outdated
1210
- outdated_and_latest_version.map { |local, _| local.name }
1176
+ outdated_and_latest_version.map {|local, _| local.name }
1211
1177
  end
1212
1178
 
1213
1179
  ##
@@ -1228,7 +1194,7 @@ class Gem::Specification < Gem::BasicSpecification
1228
1194
  Gem::Dependency.new local_spec.name, ">= #{local_spec.version}"
1229
1195
 
1230
1196
  remotes, = fetcher.search_for_dependency dependency
1231
- remotes = remotes.map { |n, _| n.version }
1197
+ remotes = remotes.map {|n, _| n.version }
1232
1198
 
1233
1199
  latest_remote = remotes.sort.last
1234
1200
 
@@ -1239,17 +1205,6 @@ class Gem::Specification < Gem::BasicSpecification
1239
1205
  nil
1240
1206
  end
1241
1207
 
1242
- ##
1243
- # Removes +spec+ from the known specs.
1244
-
1245
- def self.remove_spec(spec)
1246
- warn "Gem::Specification.remove_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
1247
- _all.delete spec
1248
- stubs.delete_if { |s| s.full_name == spec.full_name }
1249
- (@@stubs_by_name[spec.name] || []).delete_if { |s| s.full_name == spec.full_name }
1250
- reset
1251
- end
1252
-
1253
1208
  ##
1254
1209
  # Is +name+ a required attribute?
1255
1210
 
@@ -1270,36 +1225,36 @@ class Gem::Specification < Gem::BasicSpecification
1270
1225
 
1271
1226
  def self.reset
1272
1227
  @@dirs = nil
1273
- Gem.pre_reset_hooks.each { |hook| hook.call }
1228
+ Gem.pre_reset_hooks.each {|hook| hook.call }
1274
1229
  @@all = nil
1275
1230
  @@stubs = nil
1276
1231
  @@stubs_by_name = {}
1277
- @@spec_with_requirable_file = {}
1278
- @@active_stub_with_requirable_file = {}
1232
+ @@spec_with_requirable_file = {}
1233
+ @@active_stub_with_requirable_file = {}
1279
1234
  _clear_load_cache
1280
1235
  unresolved = unresolved_deps
1281
1236
  unless unresolved.empty?
1282
1237
  w = "W" + "ARN"
1283
- warn "#{w}: Unresolved or ambigious specs during Gem::Specification.reset:"
1238
+ warn "#{w}: Unresolved or ambiguous specs during Gem::Specification.reset:"
1284
1239
  unresolved.values.each do |dep|
1285
1240
  warn " #{dep}"
1286
1241
 
1287
1242
  versions = find_all_by_name(dep.name)
1288
1243
  unless versions.empty?
1289
1244
  warn " Available/installed versions of this gem:"
1290
- versions.each { |s| warn " - #{s.version}" }
1245
+ versions.each {|s| warn " - #{s.version}" }
1291
1246
  end
1292
1247
  end
1293
1248
  warn "#{w}: Clearing out unresolved specs. Try 'gem cleanup <gem>'"
1294
1249
  warn "Please report a bug if this causes problems."
1295
1250
  unresolved.clear
1296
1251
  end
1297
- Gem.post_reset_hooks.each { |hook| hook.call }
1252
+ Gem.post_reset_hooks.each {|hook| hook.call }
1298
1253
  end
1299
1254
 
1300
1255
  # DOC: This method needs documented or nodoc'd
1301
1256
  def self.unresolved_deps
1302
- @unresolved_deps ||= Hash.new { |h, n| h[n] = Gem::Dependency.new n }
1257
+ @unresolved_deps ||= Hash.new {|h, n| h[n] = Gem::Dependency.new n }
1303
1258
  end
1304
1259
 
1305
1260
  ##
@@ -1330,7 +1285,7 @@ class Gem::Specification < Gem::BasicSpecification
1330
1285
  # Cleanup any YAML::PrivateType. They only show up for an old bug
1331
1286
  # where nil => null, so just convert them to nil based on the type.
1332
1287
 
1333
- array.map! { |e| e.kind_of?(YAML::PrivateType) ? nil : e }
1288
+ array.map! {|e| e.kind_of?(YAML::PrivateType) ? nil : e }
1334
1289
 
1335
1290
  spec.instance_variable_set :@rubygems_version, array[0]
1336
1291
  # spec version
@@ -1395,7 +1350,7 @@ class Gem::Specification < Gem::BasicSpecification
1395
1350
  true, # has_rdoc
1396
1351
  @new_platform,
1397
1352
  @licenses,
1398
- @metadata
1353
+ @metadata,
1399
1354
  ]
1400
1355
  end
1401
1356
 
@@ -1443,7 +1398,11 @@ class Gem::Specification < Gem::BasicSpecification
1443
1398
  raise e
1444
1399
  end
1445
1400
 
1446
- specs = spec_dep.to_specs
1401
+ begin
1402
+ specs = spec_dep.to_specs
1403
+ rescue Gem::MissingSpecError => e
1404
+ raise Gem::MissingSpecError.new(e.name, e.requirement, "at: #{self.spec_file}")
1405
+ end
1447
1406
 
1448
1407
  if specs.size == 1
1449
1408
  specs.first.activate
@@ -1479,7 +1438,7 @@ class Gem::Specification < Gem::BasicSpecification
1479
1438
  self.summary = sanitize_string(summary)
1480
1439
  self.description = sanitize_string(description)
1481
1440
  self.post_install_message = sanitize_string(post_install_message)
1482
- self.authors = authors.collect { |a| sanitize_string(a) }
1441
+ self.authors = authors.collect {|a| sanitize_string(a) }
1483
1442
  end
1484
1443
 
1485
1444
  ##
@@ -1491,13 +1450,7 @@ class Gem::Specification < Gem::BasicSpecification
1491
1450
  # HACK the #to_s is in here because RSpec has an Array of Arrays of
1492
1451
  # Strings for authors. Need a way to disallow bad values on gemspec
1493
1452
  # generation. (Probably won't happen.)
1494
- string = string.to_s
1495
-
1496
- begin
1497
- Builder::XChar.encode string
1498
- rescue NameError, NoMethodError
1499
- string.to_xs
1500
- end
1453
+ string.to_s
1501
1454
  end
1502
1455
 
1503
1456
  ##
@@ -1508,7 +1461,7 @@ class Gem::Specification < Gem::BasicSpecification
1508
1461
  return nil if executables.nil?
1509
1462
 
1510
1463
  if @bindir
1511
- Array(executables).map { |e| File.join(@bindir, e) }
1464
+ Array(executables).map {|e| File.join(@bindir, e) }
1512
1465
  else
1513
1466
  executables
1514
1467
  end
@@ -1548,16 +1501,7 @@ class Gem::Specification < Gem::BasicSpecification
1548
1501
 
1549
1502
  paths = full_require_paths
1550
1503
 
1551
- # gem directories must come after -I and ENV['RUBYLIB']
1552
- insert_index = Gem.load_path_insert_index
1553
-
1554
- if insert_index
1555
- # gem directories must come after -I and ENV['RUBYLIB']
1556
- $LOAD_PATH.insert(insert_index, *paths)
1557
- else
1558
- # we are probably testing in core, -I and RUBYLIB don't apply
1559
- $LOAD_PATH.unshift(*paths)
1560
- end
1504
+ Gem.add_to_load_path(*paths)
1561
1505
  end
1562
1506
 
1563
1507
  ##
@@ -1583,7 +1527,7 @@ class Gem::Specification < Gem::BasicSpecification
1583
1527
  # a full path.
1584
1528
 
1585
1529
  def bin_dir
1586
- @bin_dir ||= File.join gem_dir, bindir # TODO: this is unfortunate
1530
+ @bin_dir ||= File.join gem_dir, bindir
1587
1531
  end
1588
1532
 
1589
1533
  ##
@@ -1599,7 +1543,7 @@ class Gem::Specification < Gem::BasicSpecification
1599
1543
  def build_args
1600
1544
  if File.exist? build_info_file
1601
1545
  build_info = File.readlines build_info_file
1602
- build_info = build_info.map { |x| x.strip }
1546
+ build_info = build_info.map {|x| x.strip }
1603
1547
  build_info.delete ""
1604
1548
  build_info
1605
1549
  else
@@ -1675,12 +1619,12 @@ class Gem::Specification < Gem::BasicSpecification
1675
1619
 
1676
1620
  def conflicts
1677
1621
  conflicts = {}
1678
- self.runtime_dependencies.each { |dep|
1622
+ self.runtime_dependencies.each do |dep|
1679
1623
  spec = Gem.loaded_specs[dep.name]
1680
1624
  if spec and not spec.satisfies_requirement? dep
1681
1625
  (conflicts[spec] ||= []) << dep
1682
1626
  end
1683
- }
1627
+ end
1684
1628
  env_req = Gem.env_requirement(name)
1685
1629
  (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version
1686
1630
  conflicts
@@ -1690,9 +1634,9 @@ class Gem::Specification < Gem::BasicSpecification
1690
1634
  # return true if there will be conflict when spec if loaded together with the list of specs.
1691
1635
 
1692
1636
  def conficts_when_loaded_with?(list_of_specs) # :nodoc:
1693
- result = list_of_specs.any? { |spec|
1694
- spec.dependencies.any? { |dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
1695
- }
1637
+ result = list_of_specs.any? do |spec|
1638
+ spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
1639
+ end
1696
1640
  result
1697
1641
  end
1698
1642
 
@@ -1701,14 +1645,14 @@ class Gem::Specification < Gem::BasicSpecification
1701
1645
 
1702
1646
  def has_conflicts?
1703
1647
  return true unless Gem.env_requirement(name).satisfied_by?(version)
1704
- self.dependencies.any? { |dep|
1648
+ self.dependencies.any? do |dep|
1705
1649
  if dep.runtime?
1706
1650
  spec = Gem.loaded_specs[dep.name]
1707
1651
  spec and not spec.satisfies_requirement? dep
1708
1652
  else
1709
1653
  false
1710
1654
  end
1711
- }
1655
+ end
1712
1656
  end
1713
1657
 
1714
1658
  # The date this gem was created.
@@ -1720,7 +1664,7 @@ class Gem::Specification < Gem::BasicSpecification
1720
1664
  # https://reproducible-builds.org/specs/source-date-epoch/
1721
1665
 
1722
1666
  def date
1723
- @date ||= ENV["SOURCE_DATE_EPOCH"] ? Time.utc(*Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc.to_a[3..5].reverse) : TODAY
1667
+ @date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)
1724
1668
  end
1725
1669
 
1726
1670
  DateLike = Object.new # :nodoc:
@@ -1780,7 +1724,7 @@ class Gem::Specification < Gem::BasicSpecification
1780
1724
  end
1781
1725
  result
1782
1726
  end
1783
- deprecate :default_executable, :none, 2018, 12
1727
+ rubygems_deprecate :default_executable
1784
1728
 
1785
1729
  ##
1786
1730
  # The default value for specification attribute +name+
@@ -1805,10 +1749,11 @@ class Gem::Specification < Gem::BasicSpecification
1805
1749
  #
1806
1750
  # [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
1807
1751
 
1808
- def dependent_gems
1752
+ def dependent_gems(check_dev=true)
1809
1753
  out = []
1810
1754
  Gem::Specification.each do |spec|
1811
- spec.dependencies.each do |dep|
1755
+ deps = check_dev ? spec.dependencies : spec.runtime_dependencies
1756
+ deps.each do |dep|
1812
1757
  if self.satisfies_requirement?(dep)
1813
1758
  sats = []
1814
1759
  find_all_satisfiers(dep) do |sat|
@@ -1825,7 +1770,7 @@ class Gem::Specification < Gem::BasicSpecification
1825
1770
  # Returns all specs that matches this spec's runtime dependencies.
1826
1771
 
1827
1772
  def dependent_specs
1828
- runtime_dependencies.map { |dep| dep.to_specs }.flatten
1773
+ runtime_dependencies.map {|dep| dep.to_specs }.flatten
1829
1774
  end
1830
1775
 
1831
1776
  ##
@@ -1839,7 +1784,7 @@ class Gem::Specification < Gem::BasicSpecification
1839
1784
  # List of dependencies that are used for development
1840
1785
 
1841
1786
  def development_dependencies
1842
- dependencies.select { |d| d.type == :development }
1787
+ dependencies.select {|d| d.type == :development }
1843
1788
  end
1844
1789
 
1845
1790
  ##
@@ -1900,29 +1845,23 @@ class Gem::Specification < Gem::BasicSpecification
1900
1845
  end
1901
1846
 
1902
1847
  ##
1903
- # Sets executables to +value+, ensuring it is an array. Don't
1904
- # use this, push onto the array instead.
1848
+ # Sets executables to +value+, ensuring it is an array.
1905
1849
 
1906
1850
  def executables=(value)
1907
- # TODO: warn about setting instead of pushing
1908
1851
  @executables = Array(value)
1909
1852
  end
1910
1853
 
1911
1854
  ##
1912
- # Sets extensions to +extensions+, ensuring it is an array. Don't
1913
- # use this, push onto the array instead.
1855
+ # Sets extensions to +extensions+, ensuring it is an array.
1914
1856
 
1915
1857
  def extensions=(extensions)
1916
- # TODO: warn about setting instead of pushing
1917
1858
  @extensions = Array extensions
1918
1859
  end
1919
1860
 
1920
1861
  ##
1921
- # Sets extra_rdoc_files to +files+, ensuring it is an array. Don't
1922
- # use this, push onto the array instead.
1862
+ # Sets extra_rdoc_files to +files+, ensuring it is an array.
1923
1863
 
1924
1864
  def extra_rdoc_files=(files)
1925
- # TODO: warn about setting instead of pushing
1926
1865
  @extra_rdoc_files = Array files
1927
1866
  end
1928
1867
 
@@ -1977,8 +1916,7 @@ class Gem::Specification < Gem::BasicSpecification
1977
1916
  end
1978
1917
 
1979
1918
  def gems_dir
1980
- # TODO: this logic seems terribly broken, but tests fail if just base_dir
1981
- @gems_dir ||= File.join(loaded_from && base_dir || Gem.dir, "gems")
1919
+ @gems_dir ||= File.join(base_dir, "gems")
1982
1920
  end
1983
1921
 
1984
1922
  ##
@@ -1989,7 +1927,7 @@ class Gem::Specification < Gem::BasicSpecification
1989
1927
  def has_rdoc # :nodoc:
1990
1928
  true
1991
1929
  end
1992
- deprecate :has_rdoc, :none, 2018, 12
1930
+ rubygems_deprecate :has_rdoc
1993
1931
 
1994
1932
  ##
1995
1933
  # Deprecated and ignored.
@@ -1999,10 +1937,10 @@ class Gem::Specification < Gem::BasicSpecification
1999
1937
  def has_rdoc=(ignored) # :nodoc:
2000
1938
  @has_rdoc = true
2001
1939
  end
2002
- deprecate :has_rdoc=, :none, 2018, 12
1940
+ rubygems_deprecate :has_rdoc=
2003
1941
 
2004
1942
  alias :has_rdoc? :has_rdoc # :nodoc:
2005
- deprecate :has_rdoc?, :none, 2018, 12
1943
+ rubygems_deprecate :has_rdoc?
2006
1944
 
2007
1945
  ##
2008
1946
  # True if this gem has files in test_files
@@ -2024,9 +1962,9 @@ class Gem::Specification < Gem::BasicSpecification
2024
1962
  yaml_initialize coder.tag, coder.map
2025
1963
  end
2026
1964
 
1965
+ eval <<-RUBY, binding, __FILE__, __LINE__ + 1
1966
+ # frozen_string_literal: true
2027
1967
 
2028
-
2029
- eval <<-RB, binding, __FILE__, __LINE__ + 1
2030
1968
  def set_nil_attributes_to_nil
2031
1969
  #{@@nil_attributes.map {|key| "@#{key} = nil" }.join "; "}
2032
1970
  end
@@ -2036,7 +1974,7 @@ class Gem::Specification < Gem::BasicSpecification
2036
1974
  #{@@non_nil_attributes.map {|key| "@#{key} = #{INITIALIZE_CODE_FOR_DEFAULTS[key]}" }.join ";"}
2037
1975
  end
2038
1976
  private :set_not_nil_attributes_to_default_values
2039
- RB
1977
+ RUBY
2040
1978
 
2041
1979
  ##
2042
1980
  # Specification constructor. Assigns the default values to the attributes
@@ -2061,6 +1999,10 @@ class Gem::Specification < Gem::BasicSpecification
2061
1999
  self.name = name if name
2062
2000
  self.version = version if version
2063
2001
 
2002
+ if platform = Gem.platforms.last and platform != Gem::Platform::RUBY and platform != Gem::Platform.local
2003
+ self.platform = platform
2004
+ end
2005
+
2064
2006
  yield self if block_given?
2065
2007
  end
2066
2008
 
@@ -2163,11 +2105,17 @@ class Gem::Specification < Gem::BasicSpecification
2163
2105
  end
2164
2106
 
2165
2107
  ##
2108
+ # Track removed method calls to warn about during build time.
2166
2109
  # Warn about unknown attributes while loading a spec.
2167
2110
 
2168
2111
  def method_missing(sym, *a, &b) # :nodoc:
2112
+ if REMOVED_METHODS.include?(sym)
2113
+ removed_method_calls << sym
2114
+ return
2115
+ end
2116
+
2169
2117
  if @specification_version > CURRENT_SPECIFICATION_VERSION and
2170
- sym.to_s =~ /=$/
2118
+ sym.to_s.end_with?("=")
2171
2119
  warn "ignoring #{sym} loading #{full_name}" if $DEBUG
2172
2120
  else
2173
2121
  super
@@ -2251,6 +2199,7 @@ class Gem::Specification < Gem::BasicSpecification
2251
2199
 
2252
2200
  attributes.each do |attr_name|
2253
2201
  current_value = self.send attr_name
2202
+ current_value = current_value.sort if %i[files test_files].include? attr_name
2254
2203
  if current_value != default_value(attr_name) or
2255
2204
  self.class.required_attribute? attr_name
2256
2205
 
@@ -2300,11 +2249,9 @@ class Gem::Specification < Gem::BasicSpecification
2300
2249
  end
2301
2250
 
2302
2251
  ##
2303
- # Sets rdoc_options to +value+, ensuring it is an array. Don't
2304
- # use this, push onto the array instead.
2252
+ # Sets rdoc_options to +value+, ensuring it is an array.
2305
2253
 
2306
2254
  def rdoc_options=(options)
2307
- # TODO: warn about setting instead of pushing
2308
2255
  @rdoc_options = Array options
2309
2256
  end
2310
2257
 
@@ -2323,11 +2270,9 @@ class Gem::Specification < Gem::BasicSpecification
2323
2270
  end
2324
2271
 
2325
2272
  ##
2326
- # Set requirements to +req+, ensuring it is an array. Don't
2327
- # use this, push onto the array instead.
2273
+ # Set requirements to +req+, ensuring it is an array.
2328
2274
 
2329
2275
  def requirements=(req)
2330
- # TODO: warn about setting instead of pushing
2331
2276
  @requirements = Array req
2332
2277
  end
2333
2278
 
@@ -2348,18 +2293,18 @@ class Gem::Specification < Gem::BasicSpecification
2348
2293
 
2349
2294
  def ruby_code(obj)
2350
2295
  case obj
2351
- when String then obj.dump + ".freeze"
2352
- when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
2353
- when Hash then
2354
- seg = obj.keys.sort.map { |k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
2296
+ when String then obj.dump + ".freeze"
2297
+ when Array then '[' + obj.map {|x| ruby_code x }.join(", ") + ']'
2298
+ when Hash then
2299
+ seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
2355
2300
  "{ #{seg.join(', ')} }"
2356
- when Gem::Version then obj.to_s.dump
2357
- when DateLike then obj.strftime('%Y-%m-%d').dump
2358
- when Time then obj.strftime('%Y-%m-%d').dump
2359
- when Numeric then obj.inspect
2360
- when true, false, nil then obj.inspect
2361
- when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
2362
- when Gem::Requirement then
2301
+ when Gem::Version then obj.to_s.dump
2302
+ when DateLike then obj.strftime('%Y-%m-%d').dump
2303
+ when Time then obj.strftime('%Y-%m-%d').dump
2304
+ when Numeric then obj.inspect
2305
+ when true, false, nil then obj.inspect
2306
+ when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
2307
+ when Gem::Requirement then
2363
2308
  list = obj.as_list
2364
2309
  "Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})"
2365
2310
  else raise Gem::Exception, "ruby_code case not handled: #{obj.class}"
@@ -2379,7 +2324,7 @@ class Gem::Specification < Gem::BasicSpecification
2379
2324
  # True if this gem has the same attributes as +other+.
2380
2325
 
2381
2326
  def same_attributes?(spec)
2382
- @@attributes.all? { |name, default| self.send(name) == spec.send(name) }
2327
+ @@attributes.all? {|name, default| self.send(name) == spec.send(name) }
2383
2328
  end
2384
2329
 
2385
2330
  private :same_attributes?
@@ -2478,6 +2423,7 @@ class Gem::Specification < Gem::BasicSpecification
2478
2423
  # still have their default values are omitted.
2479
2424
 
2480
2425
  def to_ruby
2426
+ require_relative 'openssl'
2481
2427
  mark_version
2482
2428
  result = []
2483
2429
  result << "# -*- encoding: utf-8 -*-"
@@ -2510,15 +2456,14 @@ class Gem::Specification < Gem::BasicSpecification
2510
2456
  :version,
2511
2457
  :has_rdoc,
2512
2458
  :default_executable,
2513
- :metadata
2459
+ :metadata,
2514
2460
  ]
2515
2461
 
2516
2462
  @@attributes.each do |attr_name|
2517
2463
  next if handled.include? attr_name
2518
2464
  current_value = self.send(attr_name)
2519
- if current_value != default_value(attr_name) or
2520
- self.class.required_attribute? attr_name
2521
- result << " s.#{attr_name} = #{ruby_code current_value}"
2465
+ if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)
2466
+ result << " s.#{attr_name} = #{ruby_code current_value}" unless defined?(OpenSSL::PKey::RSA) && current_value.is_a?(OpenSSL::PKey::RSA)
2522
2467
  end
2523
2468
  end
2524
2469
 
@@ -2531,25 +2476,17 @@ class Gem::Specification < Gem::BasicSpecification
2531
2476
  result << nil
2532
2477
  result << " if s.respond_to? :specification_version then"
2533
2478
  result << " s.specification_version = #{specification_version}"
2479
+ result << " end"
2534
2480
  result << nil
2535
2481
 
2536
- result << " if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then"
2482
+ result << " if s.respond_to? :add_runtime_dependency then"
2537
2483
 
2538
2484
  dependencies.each do |dep|
2539
2485
  req = dep.requirements_list.inspect
2540
2486
  dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
2541
- result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
2487
+ result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
2542
2488
  end
2543
2489
 
2544
- result << " else"
2545
-
2546
- dependencies.each do |dep|
2547
- version_reqs_param = dep.requirements_list.inspect
2548
- result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
2549
- end
2550
-
2551
- result << ' end'
2552
-
2553
2490
  result << " else"
2554
2491
  dependencies.each do |dep|
2555
2492
  version_reqs_param = dep.requirements_list.inspect
@@ -2599,6 +2536,7 @@ class Gem::Specification < Gem::BasicSpecification
2599
2536
  builder << self
2600
2537
  ast = builder.tree
2601
2538
 
2539
+ require 'stringio'
2602
2540
  io = StringIO.new
2603
2541
  io.set_encoding Encoding::UTF_8
2604
2542
 
@@ -2616,7 +2554,7 @@ class Gem::Specification < Gem::BasicSpecification
2616
2554
  begin
2617
2555
  dependencies.each do |dep|
2618
2556
  next unless dep.runtime?
2619
- dep.to_specs.each do |dep_spec|
2557
+ dep.matching_specs(true).each do |dep_spec|
2620
2558
  next if visited.has_key?(dep_spec)
2621
2559
  visited[dep_spec] = true
2622
2560
  trail.push(dep_spec)
@@ -2628,7 +2566,7 @@ class Gem::Specification < Gem::BasicSpecification
2628
2566
  unless result == :next
2629
2567
  spec_name = dep_spec.name
2630
2568
  dep_spec.traverse(trail, visited, &block) unless
2631
- trail.any? { |s| s.name == spec_name }
2569
+ trail.any? {|s| s.name == spec_name }
2632
2570
  end
2633
2571
  end
2634
2572
  end
@@ -2645,8 +2583,6 @@ class Gem::Specification < Gem::BasicSpecification
2645
2583
  # checks..
2646
2584
 
2647
2585
  def validate(packaging = true, strict = false)
2648
- require 'rubygems/user_interaction'
2649
- extend Gem::UserInteraction
2650
2586
  normalize
2651
2587
 
2652
2588
  validation_policy = Gem::SpecificationPolicy.new(self)
@@ -2655,30 +2591,27 @@ class Gem::Specification < Gem::BasicSpecification
2655
2591
  end
2656
2592
 
2657
2593
  def keep_only_files_and_directories
2658
- @executables.delete_if { |x| File.directory?(File.join(@bindir, x)) }
2659
- @extensions.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
2660
- @extra_rdoc_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
2661
- @files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
2662
- @test_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
2594
+ @executables.delete_if {|x| File.directory?(File.join(@bindir, x)) }
2595
+ @extensions.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
2596
+ @extra_rdoc_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
2597
+ @files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
2598
+ @test_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
2663
2599
  end
2664
2600
 
2665
2601
  def validate_metadata
2666
2602
  Gem::SpecificationPolicy.new(self).validate_metadata
2667
2603
  end
2604
+ rubygems_deprecate :validate_metadata
2668
2605
 
2669
- ##
2670
- # Checks that dependencies use requirements as we recommend. Warnings are
2671
- # issued when dependencies are open-ended or overly strict for semantic
2672
- # versioning.
2673
2606
  def validate_dependencies
2674
2607
  Gem::SpecificationPolicy.new(self).validate_dependencies
2675
2608
  end
2609
+ rubygems_deprecate :validate_dependencies
2676
2610
 
2677
- ##
2678
- # Checks to see if the files to be packaged are world-readable.
2679
2611
  def validate_permissions
2680
2612
  Gem::SpecificationPolicy.new(self).validate_permissions
2681
2613
  end
2614
+ rubygems_deprecate :validate_permissions
2682
2615
 
2683
2616
  ##
2684
2617
  # Set the version to +version+, potentially also setting
@@ -2706,9 +2639,9 @@ class Gem::Specification < Gem::BasicSpecification
2706
2639
  case ivar
2707
2640
  when "date"
2708
2641
  # Force Date to go through the extra coerce logic in date=
2709
- self.date = val.untaint
2642
+ self.date = val.tap(&Gem::UNTAINT)
2710
2643
  else
2711
- instance_variable_set "@#{ivar}", val.untaint
2644
+ instance_variable_set "@#{ivar}", val.tap(&Gem::UNTAINT)
2712
2645
  end
2713
2646
  end
2714
2647
 
@@ -2741,8 +2674,4 @@ class Gem::Specification < Gem::BasicSpecification
2741
2674
  def raw_require_paths # :nodoc:
2742
2675
  @require_paths
2743
2676
  end
2744
-
2745
2677
  end
2746
-
2747
- # DOC: What is this and why is it here, randomly, at the end of this file?
2748
- Gem.clear_paths