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
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: false
2
+ module Bundler::URI
3
+ class RFC3986_Parser # :nodoc:
4
+ # Bundler::URI defined in RFC3986
5
+ # this regexp is modified not to host is not empty string
6
+ RFC3986_URI = /\A(?<Bundler::URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
7
+ RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+)\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])+)(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
8
+ attr_reader :regexp
9
+
10
+ def initialize
11
+ @regexp = default_regexp.each_value(&:freeze).freeze
12
+ end
13
+
14
+ def split(uri) #:nodoc:
15
+ begin
16
+ uri = uri.to_str
17
+ rescue NoMethodError
18
+ raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}"
19
+ end
20
+ uri.ascii_only? or
21
+ raise InvalidURIError, "Bundler::URI must be ascii only #{uri.dump}"
22
+ if m = RFC3986_URI.match(uri)
23
+ query = m["query".freeze]
24
+ scheme = m["scheme".freeze]
25
+ opaque = m["path-rootless".freeze]
26
+ if opaque
27
+ opaque << "?#{query}" if query
28
+ [ scheme,
29
+ nil, # userinfo
30
+ nil, # host
31
+ nil, # port
32
+ nil, # registry
33
+ nil, # path
34
+ opaque,
35
+ nil, # query
36
+ m["fragment".freeze]
37
+ ]
38
+ else # normal
39
+ [ scheme,
40
+ m["userinfo".freeze],
41
+ m["host".freeze],
42
+ m["port".freeze],
43
+ nil, # registry
44
+ (m["path-abempty".freeze] ||
45
+ m["path-absolute".freeze] ||
46
+ m["path-empty".freeze]),
47
+ nil, # opaque
48
+ query,
49
+ m["fragment".freeze]
50
+ ]
51
+ end
52
+ elsif m = RFC3986_relative_ref.match(uri)
53
+ [ nil, # scheme
54
+ m["userinfo".freeze],
55
+ m["host".freeze],
56
+ m["port".freeze],
57
+ nil, # registry,
58
+ (m["path-abempty".freeze] ||
59
+ m["path-absolute".freeze] ||
60
+ m["path-noscheme".freeze] ||
61
+ m["path-empty".freeze]),
62
+ nil, # opaque
63
+ m["query".freeze],
64
+ m["fragment".freeze]
65
+ ]
66
+ else
67
+ raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}"
68
+ end
69
+ end
70
+
71
+ def parse(uri) # :nodoc:
72
+ scheme, userinfo, host, port,
73
+ registry, path, opaque, query, fragment = self.split(uri)
74
+ scheme_list = Bundler::URI.scheme_list
75
+ if scheme && scheme_list.include?(uc = scheme.upcase)
76
+ scheme_list[uc].new(scheme, userinfo, host, port,
77
+ registry, path, opaque, query,
78
+ fragment, self)
79
+ else
80
+ Generic.new(scheme, userinfo, host, port,
81
+ registry, path, opaque, query,
82
+ fragment, self)
83
+ end
84
+ end
85
+
86
+
87
+ def join(*uris) # :nodoc:
88
+ uris[0] = convert_to_uri(uris[0])
89
+ uris.inject :merge
90
+ end
91
+
92
+ @@to_s = Kernel.instance_method(:to_s)
93
+ def inspect
94
+ @@to_s.bind_call(self)
95
+ end
96
+
97
+ private
98
+
99
+ def default_regexp # :nodoc:
100
+ {
101
+ SCHEME: /\A[A-Za-z][A-Za-z0-9+\-.]*\z/,
102
+ USERINFO: /\A(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*\z/,
103
+ HOST: /\A(?:(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{,4}::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])*))\z/,
104
+ ABS_PATH: /\A\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*(?:\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*)*\z/,
105
+ REL_PATH: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+(?:\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*)*\z/,
106
+ QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
107
+ FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
108
+ OPAQUE: /\A(?:[^\/].*)?\z/,
109
+ PORT: /\A[\x09\x0a\x0c\x0d ]*\d*[\x09\x0a\x0c\x0d ]*\z/,
110
+ }
111
+ end
112
+
113
+ def convert_to_uri(uri)
114
+ if uri.is_a?(Bundler::URI::Generic)
115
+ uri
116
+ elsif uri = String.try_convert(uri)
117
+ parse(uri)
118
+ else
119
+ raise ArgumentError,
120
+ "bad argument (expected Bundler::URI object or Bundler::URI string)"
121
+ end
122
+ end
123
+
124
+ end # class Parser
125
+ end # module Bundler::URI
@@ -0,0 +1,6 @@
1
+ module Bundler::URI
2
+ # :stopdoc:
3
+ VERSION_CODE = '001000'.freeze
4
+ VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
5
+ # :startdoc:
6
+ end
@@ -1,9 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bundler; end
4
- if RUBY_VERSION >= "2.4"
5
- require "bundler/vendor/fileutils/lib/fileutils"
6
- else
7
- # the version we vendor is 2.4+
8
- require "fileutils"
9
- end
4
+ require_relative "vendor/fileutils/lib/fileutils"
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bundler; end
4
- require "bundler/vendor/molinillo/lib/molinillo"
4
+ require_relative "vendor/molinillo/lib/molinillo"
@@ -1,12 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # We forcibly require OpenSSL, because net/http/persistent will only autoload
4
- # it. On some Rubies, autoload fails but explicit require succeeds.
5
- begin
6
- require "openssl"
7
- rescue LoadError
8
- # some Ruby builds don't have OpenSSL
9
- end
10
3
  module Bundler
11
4
  module Persistent
12
5
  module Net
@@ -15,18 +8,20 @@ module Bundler
15
8
  end
16
9
  end
17
10
  end
18
- require "bundler/vendor/net-http-persistent/lib/net/http/persistent"
11
+ require_relative "vendor/net-http-persistent/lib/net/http/persistent"
19
12
 
20
13
  module Bundler
21
14
  class PersistentHTTP < Persistent::Net::HTTP::Persistent
22
15
  def connection_for(uri)
23
- connection = super
24
- warn_old_tls_version_rubygems_connection(uri, connection)
25
- connection
16
+ super(uri) do |connection|
17
+ result = yield connection
18
+ warn_old_tls_version_rubygems_connection(uri, connection)
19
+ result
20
+ end
26
21
  end
27
22
 
28
23
  def warn_old_tls_version_rubygems_connection(uri, connection)
29
- return unless connection.use_ssl?
24
+ return unless connection.http.use_ssl?
30
25
  return unless (uri.host || "").end_with?("rubygems.org")
31
26
 
32
27
  socket = connection.instance_variable_get(:@socket)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Bundler
4
4
  def self.require_thor_actions
5
- Kernel.send(:require, "bundler/vendor/thor/lib/thor/actions")
5
+ require_relative "vendor/thor/lib/thor/actions"
6
6
  end
7
7
  end
8
- require "bundler/vendor/thor/lib/thor"
8
+ require_relative "vendor/thor/lib/thor"
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler; end
4
+ require_relative "vendor/tmpdir/lib/tmpdir"
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler; end
4
+ require_relative "vendor/uri/lib/uri"
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # Ruby 1.9.3 and old RubyGems don't play nice with frozen version strings
4
- # rubocop:disable MutableConstant
5
-
6
3
  module Bundler
7
- # We're doing this because we might write tests that deal
8
- # with other versions of bundler and we are unsure how to
9
- # handle this better.
10
- VERSION = "1.17.3" unless defined?(::Bundler::VERSION)
11
-
12
- def self.overwrite_loaded_gem_version
13
- begin
14
- require "rubygems"
15
- rescue LoadError
16
- return
17
- end
18
- return unless bundler_spec = Gem.loaded_specs["bundler"]
19
- return if bundler_spec.version == VERSION
20
- bundler_spec.version = Bundler::VERSION
21
- end
22
- private_class_method :overwrite_loaded_gem_version
23
- overwrite_loaded_gem_version
4
+ VERSION = "2.2.14".freeze
24
5
 
25
6
  def self.bundler_major_version
26
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -5,11 +5,42 @@ module Bundler
5
5
  NEq = Struct.new(:version)
6
6
  ReqR = Struct.new(:left, :right)
7
7
  class ReqR
8
- Endpoint = Struct.new(:version, :inclusive)
8
+ Endpoint = Struct.new(:version, :inclusive) do
9
+ def <=>(other)
10
+ if version.equal?(INFINITY)
11
+ return 0 if other.version.equal?(INFINITY)
12
+ return 1
13
+ elsif other.version.equal?(INFINITY)
14
+ return -1
15
+ end
16
+
17
+ comp = version <=> other.version
18
+ return comp unless comp.zero?
19
+
20
+ if inclusive && !other.inclusive
21
+ 1
22
+ elsif !inclusive && other.inclusive
23
+ -1
24
+ else
25
+ 0
26
+ end
27
+ end
28
+ end
29
+
9
30
  def to_s
10
31
  "#{left.inclusive ? "[" : "("}#{left.version}, #{right.version}#{right.inclusive ? "]" : ")"}"
11
32
  end
12
- INFINITY = Object.new.freeze
33
+ INFINITY = begin
34
+ inf = Object.new
35
+ def inf.to_s
36
+ "∞"
37
+ end
38
+ def inf.<=>(other)
39
+ return 0 if other.equal?(self)
40
+ 1
41
+ end
42
+ inf.freeze
43
+ end
13
44
  ZERO = Gem::Version.new("0.a")
14
45
 
15
46
  def cover?(v)
@@ -32,6 +63,15 @@ module Bundler
32
63
  left.version == right.version
33
64
  end
34
65
 
66
+ def <=>(other)
67
+ return -1 if other.equal?(INFINITY)
68
+
69
+ comp = left <=> other.left
70
+ return comp unless comp.zero?
71
+
72
+ right <=> other.right
73
+ end
74
+
35
75
  UNIVERSAL = ReqR.new(ReqR::Endpoint.new(Gem::Version.new("0.a"), true), ReqR::Endpoint.new(ReqR::INFINITY, false)).freeze
36
76
  end
37
77
 
@@ -57,7 +97,7 @@ module Bundler
57
97
  end.uniq
58
98
  ranges, neqs = ranges.partition {|r| !r.is_a?(NEq) }
59
99
 
60
- [ranges.sort_by {|range| [range.left.version, range.left.inclusive ? 0 : 1] }, neqs.map(&:version)]
100
+ [ranges.sort, neqs.map(&:version)]
61
101
  end
62
102
 
63
103
  def self.empty?(ranges, neqs)
@@ -66,8 +106,14 @@ module Bundler
66
106
  next false if curr_range.single? && neqs.include?(curr_range.left.version)
67
107
  next curr_range if last_range.right.version == ReqR::INFINITY
68
108
  case last_range.right.version <=> curr_range.left.version
69
- when 1 then next curr_range
70
- when 0 then next(last_range.right.inclusive && curr_range.left.inclusive && !neqs.include?(curr_range.left.version) && curr_range)
109
+ # higher
110
+ when 1 then next ReqR.new(curr_range.left, last_range.right)
111
+ # equal
112
+ when 0
113
+ if last_range.right.inclusive && curr_range.left.inclusive && !neqs.include?(curr_range.left.version)
114
+ ReqR.new(curr_range.left, [curr_range.right, last_range.right].max)
115
+ end
116
+ # lower
71
117
  when -1 then next false
72
118
  end
73
119
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/shared_helpers"
3
+ require_relative "shared_helpers"
4
4
  Bundler::SharedHelpers.major_deprecation 2,
5
5
  "The Bundler task for Vlad"
6
6
 
@@ -8,7 +8,7 @@ Bundler::SharedHelpers.major_deprecation 2,
8
8
  #
9
9
  # Add "require 'bundler/vlad'" in your Vlad deploy.rb, and
10
10
  # include the vlad:bundle:install task in your vlad:deploy task.
11
- require "bundler/deployment"
11
+ require_relative "deployment"
12
12
 
13
13
  include Rake::DSL if defined? Rake::DSL
14
14
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "thread"
4
-
5
3
  module Bundler
6
4
  class Worker
7
5
  POISON = Object.new
@@ -50,7 +48,7 @@ module Bundler
50
48
  stop_threads
51
49
  end
52
50
 
53
- private
51
+ private
54
52
 
55
53
  def process_queue(i)
56
54
  loop do
@@ -62,7 +60,7 @@ module Bundler
62
60
 
63
61
  def apply_func(obj, i)
64
62
  @func.call(obj, i)
65
- rescue Exception => e
63
+ rescue Exception => e # rubocop:disable Lint/RescueException
66
64
  WrappedException.new(e)
67
65
  end
68
66
 
@@ -3,7 +3,7 @@
3
3
  module Bundler
4
4
  # A stub yaml serializer that can handle only hashes and strings (as of now).
5
5
  module YAMLSerializer
6
- module_function
6
+ module_function
7
7
 
8
8
  def dump(hash)
9
9
  yaml = String.new("---")
@@ -32,7 +32,7 @@ module Bundler
32
32
  (.*) # value
33
33
  \1 # matching closing quote
34
34
  $
35
- /xo
35
+ /xo.freeze
36
36
 
37
37
  HASH_REGEX = /
38
38
  ^
@@ -40,12 +40,11 @@ module Bundler
40
40
  (.+) # key
41
41
  (?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
42
42
  [ ]?
43
- (?: !\s)? # optional exclamation mark found with ruby 1.9.3
44
43
  (['"]?) # optional opening quote
45
44
  (.*) # value
46
45
  \3 # matching closing quote
47
46
  $
48
- /xo
47
+ /xo.freeze
49
48
 
50
49
  def load(str)
51
50
  res = {}
data/lib/rubygems.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- # -*- ruby -*-
3
2
  #--
4
3
  # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
5
4
  # All rights reserved.
@@ -9,7 +8,7 @@
9
8
  require 'rbconfig'
10
9
 
11
10
  module Gem
12
- VERSION = "3.0.6".freeze
11
+ VERSION = "3.2.14".freeze
13
12
  end
14
13
 
15
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -18,7 +17,6 @@ require 'rubygems/compatibility'
18
17
  require 'rubygems/defaults'
19
18
  require 'rubygems/deprecate'
20
19
  require 'rubygems/errors'
21
- require 'rubygems/path_support'
22
20
 
23
21
  ##
24
22
  # RubyGems is the Ruby standard for publishing and managing third party
@@ -27,27 +25,27 @@ require 'rubygems/path_support'
27
25
  # For user documentation, see:
28
26
  #
29
27
  # * <tt>gem help</tt> and <tt>gem help [command]</tt>
30
- # * {RubyGems User Guide}[http://guides.rubygems.org/]
31
- # * {Frequently Asked Questions}[http://guides.rubygems.org/faqs]
28
+ # * {RubyGems User Guide}[https://guides.rubygems.org/]
29
+ # * {Frequently Asked Questions}[https://guides.rubygems.org/faqs]
32
30
  #
33
31
  # For gem developer documentation see:
34
32
  #
35
- # * {Creating Gems}[http://guides.rubygems.org/make-your-own-gem]
33
+ # * {Creating Gems}[https://guides.rubygems.org/make-your-own-gem]
36
34
  # * Gem::Specification
37
35
  # * Gem::Version for version dependency notes
38
36
  #
39
37
  # Further RubyGems documentation can be found at:
40
38
  #
41
- # * {RubyGems Guides}[http://guides.rubygems.org]
42
- # * {RubyGems API}[http://www.rubydoc.info/github/rubygems/rubygems] (also available from
39
+ # * {RubyGems Guides}[https://guides.rubygems.org]
40
+ # * {RubyGems API}[https://www.rubydoc.info/github/rubygems/rubygems] (also available from
43
41
  # <tt>gem server</tt>)
44
42
  #
45
43
  # == RubyGems Plugins
46
44
  #
47
- # As of RubyGems 1.3.2, RubyGems will load plugins installed in gems or
45
+ # RubyGems will load plugins in the latest version of each installed gem or
48
46
  # $LOAD_PATH. Plugins must be named 'rubygems_plugin' (.rb, .so, etc) and
49
- # placed at the root of your gem's #require_path. Plugins are discovered via
50
- # Gem::find_files and then loaded.
47
+ # placed at the root of your gem's #require_path. Plugins are installed at a
48
+ # special location and loaded on boot.
51
49
  #
52
50
  # For an example plugin, see the {Graph gem}[https://github.com/seattlerb/graph]
53
51
  # which adds a `gem graph` command.
@@ -113,10 +111,18 @@ require 'rubygems/path_support'
113
111
  #
114
112
  # -The RubyGems Team
115
113
 
116
-
117
114
  module Gem
118
115
  RUBYGEMS_DIR = File.dirname File.expand_path(__FILE__)
119
116
 
117
+ # Taint support is deprecated in Ruby 2.7.
118
+ # This allows switching ".untaint" to ".tap(&Gem::UNTAINT)",
119
+ # to avoid deprecation warnings in Ruby 2.7.
120
+ UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc{}
121
+
122
+ # When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn
123
+ KERNEL_WARN_IGNORES_INTERNAL_ENTRIES = RUBY_ENGINE == "truffleruby" ||
124
+ (RUBY_ENGINE == "ruby" && RUBY_VERSION >= '3.0')
125
+
120
126
  ##
121
127
  # An Array of Regexps that match windows Ruby platforms.
122
128
 
@@ -145,6 +151,7 @@ module Gem
145
151
  doc
146
152
  extensions
147
153
  gems
154
+ plugins
148
155
  specifications
149
156
  ].freeze
150
157
 
@@ -157,26 +164,14 @@ module Gem
157
164
  ].freeze
158
165
 
159
166
  ##
160
- # Exception classes used in a Gem.read_binary +rescue+ statement. Not all of
161
- # these are defined in Ruby 1.8.7, hence the need for this convoluted setup.
167
+ # Exception classes used in a Gem.read_binary +rescue+ statement
162
168
 
163
- READ_BINARY_ERRORS = begin
164
- read_binary_errors = [Errno::EACCES, Errno::EROFS, Errno::ENOSYS]
165
- read_binary_errors << Errno::ENOTSUP if Errno.const_defined?(:ENOTSUP)
166
- read_binary_errors
167
- end.freeze
169
+ READ_BINARY_ERRORS = [Errno::EACCES, Errno::EROFS, Errno::ENOSYS, Errno::ENOTSUP].freeze
168
170
 
169
171
  ##
170
- # Exception classes used in Gem.write_binary +rescue+ statement. Not all of
171
- # these are defined in Ruby 1.8.7.
172
+ # Exception classes used in Gem.write_binary +rescue+ statement
172
173
 
173
- WRITE_BINARY_ERRORS = begin
174
- write_binary_errors = [Errno::ENOSYS]
175
- write_binary_errors << Errno::ENOTSUP if Errno.const_defined?(:ENOTSUP)
176
- write_binary_errors
177
- end.freeze
178
-
179
- USE_BUNDLER_FOR_GEMDEPS = !ENV['DONT_USE_BUNDLER_FOR_GEMDEPS'] # :nodoc:
174
+ WRITE_BINARY_ERRORS = [Errno::ENOSYS, Errno::ENOTSUP].freeze
180
175
 
181
176
  @@win_platform = nil
182
177
 
@@ -198,6 +193,8 @@ module Gem
198
193
  @pre_reset_hooks ||= []
199
194
  @post_reset_hooks ||= []
200
195
 
196
+ @default_source_date_epoch = nil
197
+
201
198
  ##
202
199
  # Try to activate a gem containing +path+. Returns true if
203
200
  # activation succeeded or wasn't needed because it was already
@@ -255,8 +252,6 @@ module Gem
255
252
  # TODO: fails test_self_bin_path_bin_file_gone_in_latest
256
253
  # Gem::Specification.find_by_name(name, *requirements).bin_file exec_name
257
254
 
258
- raise ArgumentError, "you must supply exec_name" unless exec_name
259
-
260
255
  requirements = Gem::Requirement.default if
261
256
  requirements.empty?
262
257
 
@@ -264,6 +259,8 @@ module Gem
264
259
  end
265
260
 
266
261
  def self.find_spec_for_exe(name, exec_name, requirements)
262
+ raise ArgumentError, "you must supply exec_name" unless exec_name
263
+
267
264
  dep = Gem::Dependency.new name, requirements
268
265
 
269
266
  loaded = Gem.loaded_specs[name]
@@ -272,13 +269,13 @@ module Gem
272
269
 
273
270
  specs = dep.matching_specs(true)
274
271
 
275
- specs = specs.find_all { |spec|
272
+ specs = specs.find_all do |spec|
276
273
  spec.executables.include? exec_name
277
- } if exec_name
274
+ end if exec_name
278
275
 
279
276
  unless spec = specs.first
280
277
  msg = "can't find gem #{dep} with executable #{exec_name}"
281
- if name == "bundler" && bundler_message = Gem::BundlerVersionFinder.missing_version_message
278
+ if dep.filters_bundler? && bundler_message = Gem::BundlerVersionFinder.missing_version_message
282
279
  msg = bundler_message
283
280
  end
284
281
  raise Gem::GemNotFoundException, msg
@@ -299,8 +296,8 @@ module Gem
299
296
  #
300
297
  # This method should *only* be used in bin stub files.
301
298
 
302
- def self.activate_bin_path(name, exec_name, requirement) # :nodoc:
303
- spec = find_spec_for_exe name, exec_name, [requirement]
299
+ def self.activate_bin_path(name, exec_name = nil, *requirements) # :nodoc:
300
+ spec = find_spec_for_exe name, exec_name, requirements
304
301
  Gem::LOADED_SPECS_MUTEX.synchronize do
305
302
  spec.activate
306
303
  finish_resolve
@@ -324,6 +321,13 @@ module Gem
324
321
  Gem.default_bindir
325
322
  end
326
323
 
324
+ ##
325
+ # The path were rubygems plugins are to be installed.
326
+
327
+ def self.plugindir(install_dir=Gem.dir)
328
+ File.join install_dir, 'plugins'
329
+ end
330
+
327
331
  ##
328
332
  # Reset the +dir+ and +path+ values. The next time +dir+ or +path+
329
333
  # is requested, the values will be calculated from scratch. This is
@@ -336,13 +340,6 @@ module Gem
336
340
  Gem::Security.reset if defined?(Gem::Security)
337
341
  end
338
342
 
339
- ##
340
- # The path to standard location of the user's .gemrc file.
341
-
342
- def self.config_file
343
- @config_file ||= File.join Gem.user_home, '.gemrc'
344
- end
345
-
346
343
  ##
347
344
  # The standard configuration object for gems.
348
345
 
@@ -400,11 +397,11 @@ module Gem
400
397
  target[k] = v
401
398
  when Array
402
399
  unless Gem::Deprecate.skip
403
- warn <<-eowarn
400
+ warn <<-EOWARN
404
401
  Array values in the parameter to `Gem.paths=` are deprecated.
405
402
  Please use a String or nil.
406
403
  An Array (#{env.inspect}) was passed in from #{caller[3]}
407
- eowarn
404
+ EOWARN
408
405
  end
409
406
  target[k] = v.join File::PATH_SEPARATOR
410
407
  end
@@ -418,8 +415,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
418
415
 
419
416
  ##
420
417
  # The path where gems are to be installed.
421
- #--
422
- # FIXME deprecate these once everything else has been done -ebh
423
418
 
424
419
  def self.dir
425
420
  paths.home
@@ -472,7 +467,10 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
472
467
  subdirs.each do |name|
473
468
  subdir = File.join dir, name
474
469
  next if File.exist? subdir
475
- FileUtils.mkdir_p subdir, options rescue nil
470
+ begin
471
+ FileUtils.mkdir_p subdir, **options
472
+ rescue SystemCallError
473
+ end
476
474
  end
477
475
  ensure
478
476
  File.umask old_umask
@@ -509,7 +507,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
509
507
 
510
508
  gem_specifications = @gemdeps ? Gem.loaded_specs.values : Gem::Specification.stubs
511
509
 
512
- files.concat gem_specifications.map { |spec|
510
+ files.concat gem_specifications.map {|spec|
513
511
  spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
514
512
  }.flatten
515
513
 
@@ -522,9 +520,9 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
522
520
 
523
521
  def self.find_files_from_load_path(glob) # :nodoc:
524
522
  glob_with_suffixes = "#{glob}#{Gem.suffix_pattern}"
525
- $LOAD_PATH.map { |load_path|
523
+ $LOAD_PATH.map do |load_path|
526
524
  Gem::Util.glob_files_in_dir(glob_with_suffixes, load_path)
527
- }.flatten.select { |file| File.file? file.untaint }
525
+ end.flatten.select {|file| File.file? file.tap(&Gem::UNTAINT) }
528
526
  end
529
527
 
530
528
  ##
@@ -544,7 +542,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
544
542
 
545
543
  files = find_files_from_load_path glob if check_load_path
546
544
 
547
- files.concat Gem::Specification.latest_specs(true).map { |spec|
545
+ files.concat Gem::Specification.latest_specs(true).map {|spec|
548
546
  spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
549
547
  }.flatten
550
548
 
@@ -555,77 +553,12 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
555
553
  return files
556
554
  end
557
555
 
558
- ##
559
- # Finds the user's home directory.
560
- #--
561
- # Some comments from the ruby-talk list regarding finding the home
562
- # directory:
563
- #
564
- # I have HOME, USERPROFILE and HOMEDRIVE + HOMEPATH. Ruby seems
565
- # to be depending on HOME in those code samples. I propose that
566
- # it should fallback to USERPROFILE and HOMEDRIVE + HOMEPATH (at
567
- # least on Win32).
568
- #++
569
- #--
570
- #
571
- #++
572
-
573
- def self.find_home
574
- Dir.home.dup
575
- rescue
576
- if Gem.win_platform?
577
- File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/')
578
- else
579
- File.expand_path "/"
580
- end
581
- end
582
-
583
- private_class_method :find_home
584
-
585
- # TODO: remove in RubyGems 4.0
586
-
587
- ##
588
- # Zlib::GzipReader wrapper that unzips +data+.
589
-
590
- def self.gunzip(data)
591
- Gem::Util.gunzip data
592
- end
593
-
594
- class << self
595
- extend Gem::Deprecate
596
- deprecate :gunzip, "Gem::Util.gunzip", 2018, 12
597
- end
598
-
599
- ##
600
- # Zlib::GzipWriter wrapper that zips +data+.
601
-
602
- def self.gzip(data)
603
- Gem::Util.gzip data
604
- end
605
-
606
- class << self
607
- extend Gem::Deprecate
608
- deprecate :gzip, "Gem::Util.gzip", 2018, 12
609
- end
610
-
611
- ##
612
- # A Zlib::Inflate#inflate wrapper
613
-
614
- def self.inflate(data)
615
- Gem::Util.inflate data
616
- end
617
-
618
- class << self
619
- extend Gem::Deprecate
620
- deprecate :inflate, "Gem::Util.inflate", 2018, 12
621
- end
622
-
623
556
  ##
624
557
  # Top level install helper method. Allows you to install gems interactively:
625
558
  #
626
559
  # % irb
627
560
  # >> Gem.install "minitest"
628
- # Fetching: minitest-3.0.1.gem (100%)
561
+ # Fetching: minitest-5.14.0.gem (100%)
629
562
  # => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>]
630
563
 
631
564
  def self.install(name, version = Gem::Requirement.default, *options)
@@ -660,7 +593,25 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
660
593
 
661
594
  index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir']
662
595
 
663
- index
596
+ index || 0
597
+ end
598
+
599
+ ##
600
+ # The number of paths in the `$LOAD_PATH` from activated gems. Used to
601
+ # prioritize `-I` and `ENV['RUBYLIB`]` entries during `require`.
602
+
603
+ def self.activated_gem_paths
604
+ @activated_gem_paths ||= 0
605
+ end
606
+
607
+ ##
608
+ # Add a list of paths to the $LOAD_PATH at the proper place.
609
+
610
+ def self.add_to_load_path(*paths)
611
+ @activated_gem_paths = activated_gem_paths + paths.size
612
+
613
+ # gem directories must come after -I and ENV['RUBYLIB']
614
+ $LOAD_PATH.insert(Gem.load_path_insert_index, *paths)
664
615
  end
665
616
 
666
617
  @yaml_loaded = false
@@ -670,14 +621,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
670
621
 
671
622
  def self.load_yaml
672
623
  return if @yaml_loaded
673
- return unless defined?(gem)
674
-
675
- begin
676
- gem 'psych', '>= 2.0.0'
677
- rescue Gem::LoadError
678
- # It's OK if the user does not have the psych gem installed. We will
679
- # attempt to require the stdlib version
680
- end
681
624
 
682
625
  begin
683
626
  # Try requiring the gem version *or* stdlib version of psych.
@@ -892,8 +835,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
892
835
 
893
836
  def self.ruby
894
837
  if @ruby.nil?
895
- @ruby = File.join(RbConfig::CONFIG['bindir'],
896
- "#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}")
838
+ @ruby = RbConfig.ruby
897
839
 
898
840
  @ruby = "\"#{@ruby}\"" if @ruby =~ /\s/
899
841
  end
@@ -1006,17 +948,38 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1006
948
  @suffix_pattern ||= "{#{suffixes.join(',')}}"
1007
949
  end
1008
950
 
951
+ ##
952
+ # Regexp for require-able path suffixes.
953
+
954
+ def self.suffix_regexp
955
+ @suffix_regexp ||= /#{Regexp.union(suffixes)}\z/
956
+ end
957
+
958
+ ##
959
+ # Glob pattern for require-able plugin suffixes.
960
+
961
+ def self.plugin_suffix_pattern
962
+ @plugin_suffix_pattern ||= "_plugin#{suffix_pattern}"
963
+ end
964
+
965
+ ##
966
+ # Regexp for require-able plugin suffixes.
967
+
968
+ def self.plugin_suffix_regexp
969
+ @plugin_suffix_regexp ||= /_plugin#{suffix_regexp}\z/
970
+ end
971
+
1009
972
  ##
1010
973
  # Suffixes for require-able paths.
1011
974
 
1012
975
  def self.suffixes
1013
976
  @suffixes ||= ['',
1014
977
  '.rb',
1015
- *%w(DLEXT DLEXT2).map { |key|
978
+ *%w[DLEXT DLEXT2].map do |key|
1016
979
  val = RbConfig::CONFIG[key]
1017
980
  next unless val and not val.empty?
1018
981
  ".#{val}"
1019
- }
982
+ end,
1020
983
  ].compact.uniq
1021
984
  end
1022
985
 
@@ -1053,29 +1016,29 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1053
1016
  paths.flatten!
1054
1017
  paths.compact!
1055
1018
  hash = { "GEM_HOME" => home, "GEM_PATH" => paths.empty? ? home : paths.join(File::PATH_SEPARATOR) }
1056
- hash.delete_if { |_, v| v.nil? }
1019
+ hash.delete_if {|_, v| v.nil? }
1057
1020
  self.paths = hash
1058
1021
  end
1059
1022
 
1060
- ##
1061
- # The home directory for the user.
1062
-
1063
- def self.user_home
1064
- @user_home ||= find_home.untaint
1065
- end
1066
-
1067
1023
  ##
1068
1024
  # Is this a windows platform?
1069
1025
 
1070
1026
  def self.win_platform?
1071
1027
  if @@win_platform.nil?
1072
1028
  ruby_platform = RbConfig::CONFIG['host_os']
1073
- @@win_platform = !!WIN_PATTERNS.find { |r| ruby_platform =~ r }
1029
+ @@win_platform = !!WIN_PATTERNS.find {|r| ruby_platform =~ r }
1074
1030
  end
1075
1031
 
1076
1032
  @@win_platform
1077
1033
  end
1078
1034
 
1035
+ ##
1036
+ # Is this a java platform?
1037
+
1038
+ def self.java_platform?
1039
+ RUBY_PLATFORM == "java"
1040
+ end
1041
+
1079
1042
  ##
1080
1043
  # Load +plugins+ as Ruby files
1081
1044
 
@@ -1097,35 +1060,17 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1097
1060
  end
1098
1061
 
1099
1062
  ##
1100
- # Find the 'rubygems_plugin' files in the latest installed gems and load
1101
- # them
1063
+ # Find rubygems plugin files in the standard location and load them
1102
1064
 
1103
1065
  def self.load_plugins
1104
- # Remove this env var by at least 3.0
1105
- if ENV['RUBYGEMS_LOAD_ALL_PLUGINS']
1106
- load_plugin_files find_files('rubygems_plugin', false)
1107
- else
1108
- load_plugin_files find_latest_files('rubygems_plugin', false)
1109
- end
1066
+ load_plugin_files Gem::Util.glob_files_in_dir("*#{Gem.plugin_suffix_pattern}", plugindir)
1110
1067
  end
1111
1068
 
1112
1069
  ##
1113
1070
  # Find all 'rubygems_plugin' files in $LOAD_PATH and load them
1114
1071
 
1115
1072
  def self.load_env_plugins
1116
- path = "rubygems_plugin"
1117
-
1118
- files = []
1119
- glob = "#{path}#{Gem.suffix_pattern}"
1120
- $LOAD_PATH.each do |load_path|
1121
- globbed = Gem::Util.glob_files_in_dir(glob, load_path)
1122
-
1123
- globbed.each do |load_path_file|
1124
- files << load_path_file if File.file?(load_path_file.untaint)
1125
- end
1126
- end
1127
-
1128
- load_plugin_files files
1073
+ load_plugin_files find_files_from_load_path("rubygems_plugin")
1129
1074
  end
1130
1075
 
1131
1076
  ##
@@ -1158,7 +1103,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1158
1103
 
1159
1104
  if path == "-"
1160
1105
  Gem::Util.traverse_parents Dir.pwd do |directory|
1161
- dep_file = GEM_DEP_FILES.find { |f| File.file?(f) }
1106
+ dep_file = GEM_DEP_FILES.find {|f| File.file?(f) }
1162
1107
 
1163
1108
  next unless dep_file
1164
1109
 
@@ -1167,7 +1112,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1167
1112
  end
1168
1113
  end
1169
1114
 
1170
- path.untaint
1115
+ path.tap(&Gem::UNTAINT)
1171
1116
 
1172
1117
  unless File.file? path
1173
1118
  return unless raise_exception
@@ -1175,27 +1120,20 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1175
1120
  raise ArgumentError, "Unable to find gem dependencies file at #{path}"
1176
1121
  end
1177
1122
 
1178
- if USE_BUNDLER_FOR_GEMDEPS
1179
-
1180
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path)
1181
- require 'rubygems/user_interaction'
1182
- Gem::DefaultUserInteraction.use_ui(ui) do
1183
- require "bundler"
1184
- @gemdeps = Bundler.setup
1185
- Bundler.ui = nil
1186
- @gemdeps.requested_specs.map(&:to_spec).sort_by(&:name)
1187
- end
1188
-
1189
- else
1190
-
1191
- rs = Gem::RequestSet.new
1192
- @gemdeps = rs.load_gemdeps path
1193
-
1194
- rs.resolve_current.map do |s|
1195
- s.full_spec.tap(&:activate)
1123
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path)
1124
+ require 'rubygems/user_interaction'
1125
+ Gem::DefaultUserInteraction.use_ui(ui) do
1126
+ require "bundler"
1127
+ begin
1128
+ Bundler.ui.silence do
1129
+ @gemdeps = Bundler.setup
1130
+ end
1131
+ ensure
1132
+ Gem::DefaultUserInteraction.ui.close
1196
1133
  end
1197
-
1134
+ @gemdeps.requested_specs.map(&:to_spec).sort_by(&:name)
1198
1135
  end
1136
+
1199
1137
  rescue => e
1200
1138
  case e
1201
1139
  when Gem::LoadError, Gem::UnsatisfiableDependencyError, (defined?(Bundler::GemNotFound) ? Bundler::GemNotFound : Gem::LoadError)
@@ -1207,20 +1145,55 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1207
1145
  end
1208
1146
  end
1209
1147
 
1210
- class << self
1211
- ##
1212
- # TODO remove with RubyGems 4.0
1148
+ ##
1149
+ # If the SOURCE_DATE_EPOCH environment variable is set, returns it's value.
1150
+ # Otherwise, returns the time that `Gem.source_date_epoch_string` was
1151
+ # first called in the same format as SOURCE_DATE_EPOCH.
1152
+ #
1153
+ # NOTE(@duckinator): The implementation is a tad weird because we want to:
1154
+ # 1. Make builds reproducible by default, by having this function always
1155
+ # return the same result during a given run.
1156
+ # 2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple
1157
+ # tests that set this variable will be run in a single process.
1158
+ #
1159
+ # If you simplify this function and a lot of tests fail, that is likely
1160
+ # due to #2 above.
1161
+ #
1162
+ # Details on SOURCE_DATE_EPOCH:
1163
+ # https://reproducible-builds.org/specs/source-date-epoch/
1164
+
1165
+ def self.source_date_epoch_string
1166
+ # The value used if $SOURCE_DATE_EPOCH is not set.
1167
+ @default_source_date_epoch ||= Time.now.to_i.to_s
1168
+
1169
+ specified_epoch = ENV["SOURCE_DATE_EPOCH"]
1170
+
1171
+ # If it's empty or just whitespace, treat it like it wasn't set at all.
1172
+ specified_epoch = nil if !specified_epoch.nil? && specified_epoch.strip.empty?
1213
1173
 
1214
- alias detect_gemdeps use_gemdeps # :nodoc:
1174
+ epoch = specified_epoch || @default_source_date_epoch
1175
+
1176
+ epoch.strip
1177
+ end
1178
+
1179
+ ##
1180
+ # Returns the value of Gem.source_date_epoch_string, as a Time object.
1181
+ #
1182
+ # This is used throughout RubyGems for enabling reproducible builds.
1215
1183
 
1216
- extend Gem::Deprecate
1217
- deprecate :detect_gemdeps, "Gem.use_gemdeps", 2018, 12
1184
+ def self.source_date_epoch
1185
+ Time.at(self.source_date_epoch_string.to_i).utc.freeze
1218
1186
  end
1219
1187
 
1220
1188
  # FIX: Almost everywhere else we use the `def self.` way of defining class
1221
1189
  # methods, and then we switch over to `class << self` here. Pick one or the
1222
1190
  # other.
1223
1191
  class << self
1192
+ ##
1193
+ # RubyGems distributors (like operating system package managers) can
1194
+ # disable RubyGems update by setting this to error message printed to
1195
+ # end-users on gem update --system instead of actual update.
1196
+ attr_accessor :disable_system_update_message
1224
1197
 
1225
1198
  ##
1226
1199
  # Hash of loaded Gem::Specification keyed by name
@@ -1246,23 +1219,24 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1246
1219
  #
1247
1220
 
1248
1221
  def register_default_spec(spec)
1249
- new_format = Gem.default_gems_use_full_paths? || spec.require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
1222
+ extended_require_paths = spec.require_paths.map {|f| f + "/" }
1223
+ new_format = extended_require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
1250
1224
 
1251
1225
  if new_format
1252
- prefix_group = spec.require_paths.map {|f| f + "/"}.join("|")
1226
+ prefix_group = extended_require_paths.join("|")
1253
1227
  prefix_pattern = /^(#{prefix_group})/
1254
1228
  end
1255
1229
 
1256
- suffix_pattern = /#{Regexp.union(Gem.suffixes)}\z/
1257
-
1258
1230
  spec.files.each do |file|
1259
1231
  if new_format
1260
1232
  file = file.sub(prefix_pattern, "")
1261
1233
  next unless $~
1262
1234
  end
1263
1235
 
1236
+ spec.activate if already_loaded?(file)
1237
+
1264
1238
  @path_to_default_spec_map[file] = spec
1265
- @path_to_default_spec_map[file.sub(suffix_pattern, "")] = spec
1239
+ @path_to_default_spec_map[file.sub(suffix_regexp, "")] = spec
1266
1240
  end
1267
1241
  end
1268
1242
 
@@ -1270,17 +1244,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1270
1244
  # Find a Gem::Specification of default gem from +path+
1271
1245
 
1272
1246
  def find_unresolved_default_spec(path)
1273
- @path_to_default_spec_map[path]
1274
- end
1275
-
1276
- ##
1277
- # Remove needless Gem::Specification of default gem from
1278
- # unresolved default gem list
1279
-
1280
- def remove_unresolved_default_spec(spec)
1281
- spec.files.each do |file|
1282
- @path_to_default_spec_map.delete(file)
1283
- end
1247
+ default_spec = @path_to_default_spec_map[path]
1248
+ return default_spec if default_spec && loaded_specs[default_spec.name] != default_spec
1284
1249
  end
1285
1250
 
1286
1251
  ##
@@ -1334,6 +1299,18 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1334
1299
  # work
1335
1300
 
1336
1301
  attr_reader :pre_uninstall_hooks
1302
+
1303
+ private
1304
+
1305
+ def already_loaded?(file)
1306
+ $LOADED_FEATURES.any? do |feature_path|
1307
+ feature_path.end_with?(file) && default_gem_load_paths.any? {|load_path_entry| feature_path == "#{load_path_entry}/#{file}" }
1308
+ end
1309
+ end
1310
+
1311
+ def default_gem_load_paths
1312
+ @default_gem_load_paths ||= $LOAD_PATH[load_path_insert_index..-1]
1313
+ end
1337
1314
  end
1338
1315
 
1339
1316
  ##
@@ -1341,25 +1318,24 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1341
1318
 
1342
1319
  MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/".freeze
1343
1320
 
1344
- autoload :BundlerVersionFinder, 'rubygems/bundler_version_finder'
1345
- autoload :ConfigFile, 'rubygems/config_file'
1346
- autoload :Dependency, 'rubygems/dependency'
1347
- autoload :DependencyList, 'rubygems/dependency_list'
1348
- autoload :Installer, 'rubygems/installer'
1349
- autoload :Licenses, 'rubygems/util/licenses'
1350
- autoload :PathSupport, 'rubygems/path_support'
1351
- autoload :Platform, 'rubygems/platform'
1352
- autoload :RequestSet, 'rubygems/request_set'
1353
- autoload :Requirement, 'rubygems/requirement'
1354
- autoload :Resolver, 'rubygems/resolver'
1355
- autoload :Source, 'rubygems/source'
1356
- autoload :SourceList, 'rubygems/source_list'
1357
- autoload :SpecFetcher, 'rubygems/spec_fetcher'
1358
- autoload :Specification, 'rubygems/specification'
1359
- autoload :Util, 'rubygems/util'
1360
- autoload :Version, 'rubygems/version'
1361
-
1362
- require "rubygems/specification"
1321
+ autoload :BundlerVersionFinder, File.expand_path('rubygems/bundler_version_finder', __dir__)
1322
+ autoload :ConfigFile, File.expand_path('rubygems/config_file', __dir__)
1323
+ autoload :Dependency, File.expand_path('rubygems/dependency', __dir__)
1324
+ autoload :DependencyList, File.expand_path('rubygems/dependency_list', __dir__)
1325
+ autoload :Installer, File.expand_path('rubygems/installer', __dir__)
1326
+ autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__)
1327
+ autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__)
1328
+ autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__)
1329
+ autoload :Platform, File.expand_path('rubygems/platform', __dir__)
1330
+ autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__)
1331
+ autoload :Requirement, File.expand_path('rubygems/requirement', __dir__)
1332
+ autoload :Resolver, File.expand_path('rubygems/resolver', __dir__)
1333
+ autoload :Source, File.expand_path('rubygems/source', __dir__)
1334
+ autoload :SourceList, File.expand_path('rubygems/source_list', __dir__)
1335
+ autoload :SpecFetcher, File.expand_path('rubygems/spec_fetcher', __dir__)
1336
+ autoload :Specification, File.expand_path('rubygems/specification', __dir__)
1337
+ autoload :Util, File.expand_path('rubygems/util', __dir__)
1338
+ autoload :Version, File.expand_path('rubygems/version', __dir__)
1363
1339
  end
1364
1340
 
1365
1341
  require 'rubygems/exceptions'