rubygems-update 3.0.3 → 3.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (795) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5556 -0
  3. data/CODE_OF_CONDUCT.md +62 -24
  4. data/CONTRIBUTING.md +111 -21
  5. data/MAINTAINERS.txt +1 -6
  6. data/Manifest.txt +209 -101
  7. data/POLICIES.md +65 -22
  8. data/README.md +23 -15
  9. data/UPGRADING.md +5 -81
  10. data/bin/gem +2 -16
  11. data/bin/update_rubygems +5 -5
  12. data/bundler/CHANGELOG.md +2619 -1256
  13. data/bundler/LICENSE.md +18 -19
  14. data/bundler/README.md +11 -12
  15. data/bundler/UPGRADING.md +222 -0
  16. data/bundler/bundler.gemspec +13 -33
  17. data/bundler/exe/bundle +26 -11
  18. data/bundler/exe/bundler +1 -1
  19. data/bundler/lib/bundler/.document +1 -0
  20. data/bundler/lib/bundler/build_metadata.rb +5 -13
  21. data/bundler/lib/bundler/capistrano.rb +4 -4
  22. data/bundler/lib/bundler/cli/add.rb +28 -16
  23. data/bundler/lib/bundler/cli/binstubs.rb +11 -3
  24. data/bundler/lib/bundler/cli/cache.rb +24 -17
  25. data/bundler/lib/bundler/cli/check.rb +5 -3
  26. data/bundler/lib/bundler/cli/clean.rb +1 -1
  27. data/bundler/lib/bundler/cli/common.rb +41 -13
  28. data/bundler/lib/bundler/cli/config.rb +170 -86
  29. data/bundler/lib/bundler/cli/console.rb +3 -3
  30. data/bundler/lib/bundler/cli/doctor.rb +27 -10
  31. data/bundler/lib/bundler/cli/exec.rb +8 -25
  32. data/bundler/lib/bundler/cli/fund.rb +36 -0
  33. data/bundler/lib/bundler/cli/gem.rb +261 -48
  34. data/bundler/lib/bundler/cli/info.rb +52 -8
  35. data/bundler/lib/bundler/cli/init.rb +7 -3
  36. data/bundler/lib/bundler/cli/inject.rb +1 -1
  37. data/bundler/lib/bundler/cli/install.rb +38 -66
  38. data/bundler/lib/bundler/cli/issue.rb +8 -7
  39. data/bundler/lib/bundler/cli/list.rb +19 -11
  40. data/bundler/lib/bundler/cli/lock.rb +11 -4
  41. data/bundler/lib/bundler/cli/open.rb +14 -9
  42. data/bundler/lib/bundler/cli/outdated.rb +152 -121
  43. data/bundler/lib/bundler/cli/platform.rb +2 -2
  44. data/bundler/lib/bundler/cli/plugin.rb +19 -2
  45. data/bundler/lib/bundler/cli/pristine.rb +6 -1
  46. data/bundler/lib/bundler/cli/remove.rb +1 -2
  47. data/bundler/lib/bundler/cli/show.rb +3 -3
  48. data/bundler/lib/bundler/cli/update.rb +49 -18
  49. data/bundler/lib/bundler/cli/viz.rb +1 -1
  50. data/bundler/lib/bundler/cli.rb +269 -165
  51. data/bundler/lib/bundler/compact_index_client/cache.rb +7 -24
  52. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  53. data/bundler/lib/bundler/compact_index_client/updater.rb +58 -57
  54. data/bundler/lib/bundler/compact_index_client.rb +28 -18
  55. data/bundler/lib/bundler/constants.rb +1 -1
  56. data/bundler/lib/bundler/current_ruby.rb +26 -11
  57. data/bundler/lib/bundler/definition.rb +359 -441
  58. data/bundler/lib/bundler/dependency.rb +29 -71
  59. data/bundler/lib/bundler/deployment.rb +1 -1
  60. data/bundler/lib/bundler/digest.rb +71 -0
  61. data/bundler/lib/bundler/dsl.rb +84 -116
  62. data/bundler/lib/bundler/endpoint_specification.rb +20 -14
  63. data/bundler/lib/bundler/env.rb +10 -15
  64. data/bundler/lib/bundler/environment_preserver.rb +30 -3
  65. data/bundler/lib/bundler/errors.rb +31 -14
  66. data/bundler/lib/bundler/feature_flag.rb +13 -33
  67. data/bundler/lib/bundler/fetcher/base.rb +7 -9
  68. data/bundler/lib/bundler/fetcher/compact_index.rb +46 -39
  69. data/bundler/lib/bundler/fetcher/dependency.rb +2 -2
  70. data/bundler/lib/bundler/fetcher/downloader.rb +15 -12
  71. data/bundler/lib/bundler/fetcher/index.rb +4 -30
  72. data/bundler/lib/bundler/fetcher.rb +39 -41
  73. data/bundler/lib/bundler/force_platform.rb +18 -0
  74. data/bundler/lib/bundler/friendly_errors.rb +49 -54
  75. data/bundler/lib/bundler/gem_helper.rb +79 -43
  76. data/bundler/lib/bundler/gem_helpers.rb +44 -28
  77. data/bundler/lib/bundler/gem_tasks.rb +1 -1
  78. data/bundler/lib/bundler/gem_version_promoter.rb +54 -99
  79. data/bundler/lib/bundler/graph.rb +5 -5
  80. data/bundler/lib/bundler/index.rb +14 -52
  81. data/bundler/lib/bundler/injector.rb +50 -16
  82. data/bundler/lib/bundler/inline.rb +28 -29
  83. data/bundler/lib/bundler/installer/gem_installer.rb +22 -23
  84. data/bundler/lib/bundler/installer/parallel_installer.rb +51 -51
  85. data/bundler/lib/bundler/installer/standalone.rb +62 -12
  86. data/bundler/lib/bundler/installer.rb +46 -97
  87. data/bundler/lib/bundler/lazy_specification.rb +88 -48
  88. data/bundler/lib/bundler/lockfile_generator.rb +3 -3
  89. data/bundler/lib/bundler/lockfile_parser.rb +30 -62
  90. data/bundler/{man → lib/bundler/man}/bundle-add.1 +29 -5
  91. data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +22 -4
  92. data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
  93. data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
  94. data/bundler/lib/bundler/man/bundle-cache.1 +61 -0
  95. data/bundler/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +22 -15
  96. data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
  97. data/bundler/{man → lib/bundler/man}/bundle-clean.1 +2 -2
  98. data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
  99. data/bundler/{man → lib/bundler/man}/bundle-config.1 +78 -60
  100. data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +96 -85
  101. data/bundler/lib/bundler/man/bundle-console.1 +53 -0
  102. data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
  103. data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  104. data/bundler/{man → lib/bundler/man}/bundle-exec.1 +6 -6
  105. data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +6 -6
  106. data/bundler/lib/bundler/man/bundle-gem.1 +105 -0
  107. data/bundler/lib/bundler/man/bundle-gem.1.ronn +117 -0
  108. data/bundler/lib/bundler/man/bundle-help.1 +13 -0
  109. data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
  110. data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
  111. data/bundler/{man → lib/bundler/man}/bundle-init.1 +6 -2
  112. data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +3 -1
  113. data/bundler/{man → lib/bundler/man}/bundle-inject.1 +5 -2
  114. data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
  115. data/bundler/{man → lib/bundler/man}/bundle-install.1 +42 -37
  116. data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +42 -38
  117. data/bundler/{man → lib/bundler/man}/bundle-list.1 +7 -7
  118. data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  119. data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  120. data/bundler/{man → lib/bundler/man}/bundle-open.1 +22 -2
  121. data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +9 -1
  122. data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
  123. data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
  124. data/bundler/{man → lib/bundler/man}/bundle-platform.1 +16 -6
  125. data/bundler/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
  126. data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
  127. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  128. data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  129. data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  130. data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
  131. data/bundler/{man → lib/bundler/man}/bundle-update.1 +8 -8
  132. data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +8 -7
  133. data/bundler/lib/bundler/man/bundle-version.1 +35 -0
  134. data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
  135. data/bundler/{man → lib/bundler/man}/bundle-viz.1 +4 -1
  136. data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
  137. data/bundler/{man → lib/bundler/man}/bundle.1 +17 -12
  138. data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +14 -9
  139. data/bundler/lib/bundler/man/gemfile.5 +723 -0
  140. data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +112 -95
  141. data/bundler/lib/bundler/man/index.txt +29 -0
  142. data/bundler/lib/bundler/match_metadata.rb +13 -0
  143. data/bundler/lib/bundler/match_platform.rb +1 -2
  144. data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
  145. data/bundler/lib/bundler/mirror.rb +10 -12
  146. data/bundler/lib/bundler/plugin/api/source.rb +29 -15
  147. data/bundler/lib/bundler/plugin/api.rb +1 -1
  148. data/bundler/lib/bundler/plugin/dsl.rb +1 -1
  149. data/bundler/lib/bundler/plugin/index.rb +31 -8
  150. data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
  151. data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -9
  152. data/bundler/lib/bundler/plugin/installer.rb +35 -22
  153. data/bundler/lib/bundler/plugin/source_list.rb +5 -1
  154. data/bundler/lib/bundler/plugin.rb +102 -42
  155. data/bundler/lib/bundler/process_lock.rb +1 -1
  156. data/bundler/lib/bundler/remote_specification.rb +15 -8
  157. data/bundler/lib/bundler/resolver/base.rb +77 -0
  158. data/bundler/lib/bundler/resolver/candidate.rb +94 -0
  159. data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
  160. data/bundler/lib/bundler/resolver/package.rb +72 -0
  161. data/bundler/lib/bundler/resolver/root.rb +25 -0
  162. data/bundler/lib/bundler/resolver/spec_group.rb +49 -73
  163. data/bundler/lib/bundler/resolver.rb +343 -300
  164. data/bundler/lib/bundler/retry.rb +4 -4
  165. data/bundler/lib/bundler/ruby_dsl.rb +1 -1
  166. data/bundler/lib/bundler/ruby_version.rb +9 -37
  167. data/bundler/lib/bundler/rubygems_ext.rb +235 -92
  168. data/bundler/lib/bundler/rubygems_gem_installer.rb +87 -21
  169. data/bundler/lib/bundler/rubygems_integration.rb +179 -515
  170. data/bundler/lib/bundler/runtime.rb +25 -40
  171. data/bundler/lib/bundler/self_manager.rb +168 -0
  172. data/bundler/lib/bundler/settings.rb +162 -118
  173. data/bundler/lib/bundler/setup.rb +11 -12
  174. data/bundler/lib/bundler/shared_helpers.rb +61 -102
  175. data/bundler/lib/bundler/similarity_detector.rb +3 -3
  176. data/bundler/lib/bundler/source/git/git_proxy.rb +257 -128
  177. data/bundler/lib/bundler/source/git.rb +84 -61
  178. data/bundler/lib/bundler/source/metadata.rb +9 -9
  179. data/bundler/lib/bundler/source/path/installer.rb +11 -32
  180. data/bundler/lib/bundler/source/path.rb +28 -17
  181. data/bundler/lib/bundler/source/rubygems/remote.rb +3 -4
  182. data/bundler/lib/bundler/source/rubygems.rb +171 -197
  183. data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
  184. data/bundler/lib/bundler/source.rb +30 -10
  185. data/bundler/lib/bundler/source_list.rb +112 -67
  186. data/bundler/lib/bundler/source_map.rb +71 -0
  187. data/bundler/lib/bundler/spec_set.rb +86 -72
  188. data/bundler/lib/bundler/stub_specification.rb +45 -37
  189. data/bundler/lib/bundler/templates/Executable +3 -5
  190. data/bundler/lib/bundler/templates/Executable.bundler +21 -17
  191. data/bundler/lib/bundler/templates/Executable.standalone +4 -4
  192. data/bundler/lib/bundler/templates/Gemfile +0 -2
  193. data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  194. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  195. data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  196. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +22 -2
  197. data/bundler/lib/bundler/templates/newgem/README.md.tt +13 -15
  198. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +33 -5
  199. data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
  200. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
  201. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  202. data/bundler/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +2 -0
  203. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  204. data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  205. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
  206. data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
  207. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
  208. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  209. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  210. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +36 -41
  211. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  212. data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  213. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  214. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  215. data/bundler/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  216. data/bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
  217. data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
  218. data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  219. data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  220. data/bundler/lib/bundler/ui/rg_proxy.rb +1 -1
  221. data/bundler/lib/bundler/ui/shell.rb +39 -20
  222. data/bundler/lib/bundler/ui/silent.rb +21 -5
  223. data/bundler/lib/bundler/ui.rb +3 -3
  224. data/bundler/lib/bundler/uri_credentials_filter.rb +10 -4
  225. data/bundler/lib/bundler/vendor/.document +1 -0
  226. data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  227. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
  228. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
  229. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
  230. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +128 -0
  231. data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  232. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1493 -425
  233. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  234. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
  235. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
  236. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
  237. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
  238. data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  239. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  240. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  241. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  242. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +155 -0
  243. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  244. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  245. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  246. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  247. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
  248. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  249. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  250. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
  251. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
  252. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +243 -0
  253. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  254. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  255. data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
  256. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
  257. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
  258. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
  259. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +25 -14
  260. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +20 -10
  261. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +34 -15
  262. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
  263. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
  264. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  265. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +83 -0
  266. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
  267. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
  268. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
  269. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
  270. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
  271. data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  272. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
  273. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
  274. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +40 -6
  275. data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
  276. data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
  277. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
  278. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +88 -13
  279. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
  280. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
  281. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +5 -5
  282. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
  283. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  284. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +16 -9
  285. data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  286. data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  287. data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  288. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +729 -0
  289. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
  290. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  291. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1587 -0
  292. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +125 -0
  293. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  294. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  295. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +22 -0
  296. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
  297. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +539 -0
  298. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +119 -0
  299. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  300. data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  301. data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  302. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  303. data/bundler/lib/bundler/vendored_fileutils.rb +1 -6
  304. data/bundler/lib/bundler/vendored_persistent.rb +2 -39
  305. data/bundler/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
  306. data/bundler/lib/bundler/vendored_thor.rb +2 -2
  307. data/bundler/lib/bundler/vendored_tsort.rb +4 -0
  308. data/bundler/lib/bundler/vendored_uri.rb +4 -0
  309. data/bundler/lib/bundler/version.rb +5 -20
  310. data/bundler/lib/bundler/vlad.rb +2 -2
  311. data/bundler/lib/bundler/worker.rb +26 -15
  312. data/bundler/lib/bundler/yaml_serializer.rb +3 -4
  313. data/bundler/lib/bundler.rb +285 -183
  314. data/hide_lib_for_update/note.txt +0 -4
  315. data/lib/rubygems/available_set.rb +7 -8
  316. data/lib/rubygems/basic_specification.rb +44 -31
  317. data/lib/rubygems/bundler_version_finder.rb +28 -50
  318. data/lib/rubygems/command.rb +104 -46
  319. data/lib/rubygems/command_manager.rb +35 -16
  320. data/lib/rubygems/commands/build_command.rb +77 -26
  321. data/lib/rubygems/commands/cert_command.rb +78 -76
  322. data/lib/rubygems/commands/check_command.rb +20 -22
  323. data/lib/rubygems/commands/cleanup_command.rb +36 -32
  324. data/lib/rubygems/commands/contents_command.rb +16 -18
  325. data/lib/rubygems/commands/dependency_command.rb +39 -50
  326. data/lib/rubygems/commands/environment_command.rb +11 -13
  327. data/lib/rubygems/commands/fetch_command.rb +33 -16
  328. data/lib/rubygems/commands/generate_index_command.rb +18 -17
  329. data/lib/rubygems/commands/help_command.rb +7 -7
  330. data/lib/rubygems/commands/info_command.rb +11 -6
  331. data/lib/rubygems/commands/install_command.rb +45 -79
  332. data/lib/rubygems/commands/list_command.rb +9 -8
  333. data/lib/rubygems/commands/lock_command.rb +7 -9
  334. data/lib/rubygems/commands/mirror_command.rb +3 -4
  335. data/lib/rubygems/commands/open_command.rb +11 -14
  336. data/lib/rubygems/commands/outdated_command.rb +5 -6
  337. data/lib/rubygems/commands/owner_command.rb +29 -22
  338. data/lib/rubygems/commands/pristine_command.rb +61 -51
  339. data/lib/rubygems/commands/push_command.rb +26 -63
  340. data/lib/rubygems/commands/query_command.rb +21 -337
  341. data/lib/rubygems/commands/rdoc_command.rb +26 -26
  342. data/lib/rubygems/commands/search_command.rb +8 -8
  343. data/lib/rubygems/commands/server_command.rb +16 -77
  344. data/lib/rubygems/commands/setup_command.rb +282 -241
  345. data/lib/rubygems/commands/signin_command.rb +9 -10
  346. data/lib/rubygems/commands/signout_command.rb +7 -9
  347. data/lib/rubygems/commands/sources_command.rb +42 -26
  348. data/lib/rubygems/commands/specification_command.rb +25 -20
  349. data/lib/rubygems/commands/stale_command.rb +3 -3
  350. data/lib/rubygems/commands/uninstall_command.rb +58 -49
  351. data/lib/rubygems/commands/unpack_command.rb +15 -44
  352. data/lib/rubygems/commands/update_command.rb +133 -81
  353. data/lib/rubygems/commands/which_command.rb +8 -11
  354. data/lib/rubygems/commands/yank_command.rb +22 -19
  355. data/lib/rubygems/compatibility.rb +7 -5
  356. data/lib/rubygems/config_file.rb +101 -47
  357. data/lib/rubygems/core_ext/kernel_gem.rb +8 -12
  358. data/lib/rubygems/core_ext/kernel_require.rb +124 -83
  359. data/lib/rubygems/core_ext/kernel_warn.rb +35 -30
  360. data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
  361. data/lib/rubygems/defaults.rb +131 -55
  362. data/lib/rubygems/dependency.rb +44 -27
  363. data/lib/rubygems/dependency_installer.rb +49 -205
  364. data/lib/rubygems/dependency_list.rb +24 -25
  365. data/lib/rubygems/deprecate.rb +106 -12
  366. data/lib/rubygems/doctor.rb +22 -22
  367. data/lib/rubygems/errors.rb +8 -14
  368. data/lib/rubygems/exceptions.rb +35 -33
  369. data/lib/rubygems/ext/build_error.rb +2 -0
  370. data/lib/rubygems/ext/builder.rb +71 -95
  371. data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +27 -0
  372. data/lib/rubygems/ext/cargo_builder.rb +360 -0
  373. data/lib/rubygems/ext/cmake_builder.rb +6 -7
  374. data/lib/rubygems/ext/configure_builder.rb +5 -8
  375. data/lib/rubygems/ext/ext_conf_builder.rb +45 -65
  376. data/lib/rubygems/ext/rake_builder.rb +7 -10
  377. data/lib/rubygems/ext.rb +7 -6
  378. data/lib/rubygems/gem_runner.rb +15 -26
  379. data/lib/rubygems/gemcutter_utilities.rb +179 -54
  380. data/lib/rubygems/indexer.rb +38 -53
  381. data/lib/rubygems/install_default_message.rb +2 -2
  382. data/lib/rubygems/install_message.rb +2 -2
  383. data/lib/rubygems/install_update_options.rb +73 -64
  384. data/lib/rubygems/installer.rb +230 -173
  385. data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
  386. data/lib/rubygems/local_remote_options.rb +22 -24
  387. data/lib/rubygems/mock_gem_ui.rb +2 -5
  388. data/lib/rubygems/name_tuple.rb +10 -14
  389. data/lib/rubygems/openssl.rb +7 -0
  390. data/lib/rubygems/optparse/.document +1 -0
  391. data/lib/rubygems/optparse/COPYING +56 -0
  392. data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
  393. data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
  394. data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
  395. data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
  396. data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
  397. data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
  398. data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
  399. data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
  400. data/lib/rubygems/optparse/lib/optparse.rb +2308 -0
  401. data/lib/rubygems/optparse.rb +3 -0
  402. data/lib/rubygems/package/digest_io.rb +0 -2
  403. data/lib/rubygems/package/file_source.rb +2 -4
  404. data/lib/rubygems/package/io_source.rb +4 -2
  405. data/lib/rubygems/package/old.rb +9 -11
  406. data/lib/rubygems/package/tar_header.rb +73 -66
  407. data/lib/rubygems/package/tar_reader/entry.rb +8 -9
  408. data/lib/rubygems/package/tar_reader.rb +16 -13
  409. data/lib/rubygems/package/tar_writer.rb +12 -22
  410. data/lib/rubygems/package.rb +142 -125
  411. data/lib/rubygems/package_task.rb +5 -11
  412. data/lib/rubygems/path_support.rb +3 -8
  413. data/lib/rubygems/platform.rb +113 -73
  414. data/lib/rubygems/psych_tree.rb +1 -1
  415. data/lib/rubygems/query_utils.rb +351 -0
  416. data/lib/rubygems/rdoc.rb +4 -16
  417. data/lib/rubygems/remote_fetcher.rb +64 -136
  418. data/lib/rubygems/request/connection_pools.rb +7 -11
  419. data/lib/rubygems/request/http_pool.rb +2 -3
  420. data/lib/rubygems/request.rb +31 -32
  421. data/lib/rubygems/request_set/gem_dependency_api.rb +135 -136
  422. data/lib/rubygems/request_set/lockfile/parser.rb +28 -28
  423. data/lib/rubygems/request_set/lockfile/tokenizer.rb +5 -5
  424. data/lib/rubygems/request_set/lockfile.rb +21 -20
  425. data/lib/rubygems/request_set.rb +30 -43
  426. data/lib/rubygems/requirement.rb +42 -64
  427. data/lib/rubygems/resolver/activation_request.rb +29 -53
  428. data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
  429. data/lib/rubygems/resolver/api_set.rb +33 -26
  430. data/lib/rubygems/resolver/api_specification.rb +30 -16
  431. data/lib/rubygems/resolver/best_set.rb +9 -11
  432. data/lib/rubygems/resolver/composed_set.rb +3 -5
  433. data/lib/rubygems/resolver/conflict.rb +12 -19
  434. data/lib/rubygems/resolver/current_set.rb +0 -2
  435. data/lib/rubygems/resolver/dependency_request.rb +3 -5
  436. data/lib/rubygems/resolver/git_set.rb +2 -4
  437. data/lib/rubygems/resolver/git_specification.rb +6 -8
  438. data/lib/rubygems/resolver/index_set.rb +4 -6
  439. data/lib/rubygems/resolver/index_specification.rb +38 -7
  440. data/lib/rubygems/resolver/installed_specification.rb +4 -6
  441. data/lib/rubygems/resolver/installer_set.rb +69 -27
  442. data/lib/rubygems/resolver/local_specification.rb +2 -4
  443. data/lib/rubygems/resolver/lock_set.rb +7 -9
  444. data/lib/rubygems/resolver/lock_specification.rb +6 -8
  445. data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
  446. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  447. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +8 -0
  448. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  449. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
  450. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
  451. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
  452. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
  453. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
  454. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
  455. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
  456. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +51 -12
  457. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +42 -9
  458. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +82 -8
  459. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  460. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +13 -1
  461. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
  462. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +510 -165
  463. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
  464. data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
  465. data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
  466. data/lib/rubygems/resolver/molinillo.rb +1 -1
  467. data/lib/rubygems/resolver/requirement_list.rb +0 -1
  468. data/lib/rubygems/resolver/set.rb +0 -3
  469. data/lib/rubygems/resolver/source_set.rb +0 -2
  470. data/lib/rubygems/resolver/spec_specification.rb +14 -2
  471. data/lib/rubygems/resolver/specification.rb +14 -3
  472. data/lib/rubygems/resolver/vendor_set.rb +1 -3
  473. data/lib/rubygems/resolver/vendor_specification.rb +3 -5
  474. data/lib/rubygems/resolver.rb +58 -54
  475. data/lib/rubygems/s3_uri_signer.rb +175 -0
  476. data/lib/rubygems/safe_yaml.rb +14 -16
  477. data/lib/rubygems/security/policies.rb +47 -47
  478. data/lib/rubygems/security/policy.rb +25 -29
  479. data/lib/rubygems/security/signer.rb +16 -18
  480. data/lib/rubygems/security/trust_dir.rb +5 -6
  481. data/lib/rubygems/security.rb +90 -69
  482. data/lib/rubygems/security_option.rb +7 -8
  483. data/lib/rubygems/source/git.rb +30 -30
  484. data/lib/rubygems/source/installed.rb +1 -3
  485. data/lib/rubygems/source/local.rb +4 -6
  486. data/lib/rubygems/source/lock.rb +0 -2
  487. data/lib/rubygems/source/specific_file.rb +1 -3
  488. data/lib/rubygems/source/vendor.rb +0 -2
  489. data/lib/rubygems/source.rb +50 -38
  490. data/lib/rubygems/source_list.rb +9 -13
  491. data/lib/rubygems/spec_fetcher.rb +52 -64
  492. data/lib/rubygems/specification.rb +432 -463
  493. data/lib/rubygems/specification_policy.rb +185 -87
  494. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
  495. data/lib/rubygems/stub_specification.rb +24 -29
  496. data/lib/rubygems/text.rb +21 -21
  497. data/lib/rubygems/tsort/.document +1 -0
  498. data/lib/rubygems/tsort/LICENSE.txt +22 -0
  499. data/lib/rubygems/tsort/lib/tsort.rb +452 -0
  500. data/lib/rubygems/tsort.rb +3 -0
  501. data/lib/rubygems/uninstaller.rb +110 -57
  502. data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
  503. data/lib/rubygems/update_suggestion.rb +69 -0
  504. data/lib/rubygems/uri.rb +126 -0
  505. data/lib/rubygems/uri_formatter.rb +2 -4
  506. data/lib/rubygems/user_interaction.rb +46 -49
  507. data/lib/rubygems/util/licenses.rb +511 -404
  508. data/lib/rubygems/util.rb +40 -56
  509. data/lib/rubygems/validator.rb +15 -37
  510. data/lib/rubygems/version.rb +48 -29
  511. data/lib/rubygems/version_option.rb +11 -5
  512. data/lib/rubygems.rb +305 -332
  513. data/rubygems-update.gemspec +6 -13
  514. data/setup.rb +11 -22
  515. data/test/rubygems/alternate_cert.pem +14 -14
  516. data/test/rubygems/alternate_cert_32.pem +15 -15
  517. data/test/rubygems/alternate_key.pem +25 -25
  518. data/test/rubygems/bundler_test_gem.rb +419 -0
  519. data/test/rubygems/ca_cert.pem +74 -65
  520. data/test/rubygems/child_cert.pem +15 -16
  521. data/test/rubygems/child_cert_32.pem +15 -16
  522. data/test/rubygems/child_key.pem +25 -25
  523. data/test/rubygems/client.pem +103 -45
  524. data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
  525. data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
  526. data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
  527. data/test/rubygems/data/pry-0.4.7.gemspec.rz +0 -0
  528. data/test/rubygems/encrypted_private_key.pem +26 -26
  529. data/test/rubygems/expired_cert.pem +15 -15
  530. data/test/rubygems/future_cert.pem +15 -15
  531. data/test/rubygems/future_cert_32.pem +15 -15
  532. data/test/rubygems/grandchild_cert.pem +15 -16
  533. data/test/rubygems/grandchild_cert_32.pem +15 -16
  534. data/test/rubygems/grandchild_key.pem +25 -25
  535. data/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +505 -507
  536. data/{lib → test}/rubygems/installer_test_case.rb +115 -53
  537. data/test/rubygems/invalid_issuer_cert.pem +16 -16
  538. data/test/rubygems/invalid_issuer_cert_32.pem +16 -16
  539. data/test/rubygems/invalid_key.pem +25 -25
  540. data/test/rubygems/invalid_signer_cert.pem +15 -15
  541. data/test/rubygems/invalid_signer_cert_32.pem +15 -15
  542. data/test/rubygems/invalidchild_cert.pem +15 -16
  543. data/test/rubygems/invalidchild_cert_32.pem +15 -16
  544. data/test/rubygems/invalidchild_key.pem +25 -25
  545. data/{lib → test}/rubygems/package/tar_test_case.rb +4 -6
  546. data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
  547. data/test/rubygems/packages/ascii_binder-0.1.10.1.gem +0 -0
  548. data/test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem +0 -0
  549. data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
  550. data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
  551. data/test/rubygems/private_ec_key.pem +9 -0
  552. data/test/rubygems/private_key.pem +25 -25
  553. data/test/rubygems/public_cert.pem +16 -16
  554. data/test/rubygems/public_cert_32.pem +15 -15
  555. data/test/rubygems/public_key.pem +7 -7
  556. data/test/rubygems/rubygems/commands/crash_command.rb +0 -2
  557. data/test/rubygems/rubygems_plugin.rb +2 -4
  558. data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
  559. data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +12 -0
  560. data/test/rubygems/ssl_cert.pem +78 -17
  561. data/test/rubygems/ssl_key.pem +25 -13
  562. data/test/rubygems/test_bundled_ca.rb +44 -47
  563. data/test/rubygems/test_config.rb +5 -7
  564. data/test/rubygems/test_deprecate.rb +90 -10
  565. data/test/rubygems/test_exit.rb +17 -0
  566. data/test/rubygems/test_gem.rb +679 -885
  567. data/test/rubygems/test_gem_available_set.rb +24 -25
  568. data/test/rubygems/test_gem_bundler_version_finder.rb +42 -42
  569. data/test/rubygems/test_gem_command.rb +186 -39
  570. data/test/rubygems/test_gem_command_manager.rb +166 -36
  571. data/test/rubygems/test_gem_commands_build_command.rb +436 -52
  572. data/test/rubygems/test_gem_commands_cert_command.rb +193 -124
  573. data/test/rubygems/test_gem_commands_check_command.rb +9 -11
  574. data/test/rubygems/test_gem_commands_cleanup_command.rb +87 -62
  575. data/test/rubygems/test_gem_commands_contents_command.rb +73 -42
  576. data/test/rubygems/test_gem_commands_dependency_command.rb +39 -41
  577. data/test/rubygems/test_gem_commands_environment_command.rb +60 -48
  578. data/test/rubygems/test_gem_commands_fetch_command.rb +163 -32
  579. data/test/rubygems/test_gem_commands_generate_index_command.rb +39 -9
  580. data/test/rubygems/test_gem_commands_help_command.rb +34 -19
  581. data/test/rubygems/test_gem_commands_info_command.rb +34 -9
  582. data/test/rubygems/test_gem_commands_install_command.rb +600 -173
  583. data/test/rubygems/test_gem_commands_list_command.rb +5 -7
  584. data/test/rubygems/test_gem_commands_lock_command.rb +11 -13
  585. data/test/rubygems/test_gem_commands_mirror.rb +3 -4
  586. data/test/rubygems/test_gem_commands_open_command.rb +16 -19
  587. data/test/rubygems/test_gem_commands_outdated_command.rb +24 -7
  588. data/test/rubygems/test_gem_commands_owner_command.rb +183 -49
  589. data/test/rubygems/test_gem_commands_pristine_command.rb +222 -89
  590. data/test/rubygems/test_gem_commands_push_command.rb +178 -69
  591. data/test/rubygems/test_gem_commands_query_command.rb +114 -89
  592. data/test/rubygems/test_gem_commands_search_command.rb +2 -4
  593. data/test/rubygems/test_gem_commands_server_command.rb +6 -46
  594. data/test/rubygems/test_gem_commands_setup_command.rb +334 -157
  595. data/test/rubygems/test_gem_commands_signin_command.rb +187 -27
  596. data/test/rubygems/test_gem_commands_signout_command.rb +3 -10
  597. data/test/rubygems/test_gem_commands_sources_command.rb +266 -33
  598. data/test/rubygems/test_gem_commands_specification_command.rb +81 -55
  599. data/test/rubygems/test_gem_commands_stale_command.rb +4 -6
  600. data/test/rubygems/test_gem_commands_uninstall_command.rb +230 -95
  601. data/test/rubygems/test_gem_commands_unpack_command.rb +32 -34
  602. data/test/rubygems/test_gem_commands_update_command.rb +412 -102
  603. data/test/rubygems/test_gem_commands_which_command.rb +12 -14
  604. data/test/rubygems/test_gem_commands_yank_command.rb +107 -26
  605. data/test/rubygems/test_gem_config_file.rb +120 -96
  606. data/test/rubygems/test_gem_dependency.rb +94 -86
  607. data/test/rubygems/test_gem_dependency_installer.rb +305 -388
  608. data/test/rubygems/test_gem_dependency_list.rb +66 -61
  609. data/test/rubygems/test_gem_dependency_resolution_error.rb +5 -7
  610. data/test/rubygems/test_gem_doctor.rb +73 -47
  611. data/test/rubygems/test_gem_ext_builder.rb +116 -106
  612. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
  613. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +8 -0
  614. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +233 -0
  615. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +10 -0
  616. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs +27 -0
  617. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -0
  618. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +1 -0
  619. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +233 -0
  620. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +10 -0
  621. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +8 -0
  622. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +51 -0
  623. data/test/rubygems/test_gem_ext_cargo_builder.rb +166 -0
  624. data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
  625. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +60 -0
  626. data/test/rubygems/test_gem_ext_cmake_builder.rb +32 -37
  627. data/test/rubygems/test_gem_ext_configure_builder.rb +23 -31
  628. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +75 -79
  629. data/test/rubygems/test_gem_ext_rake_builder.rb +49 -30
  630. data/test/rubygems/test_gem_gem_runner.rb +52 -7
  631. data/test/rubygems/test_gem_gemcutter_utilities.rb +91 -76
  632. data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -6
  633. data/test/rubygems/test_gem_indexer.rb +120 -105
  634. data/test/rubygems/test_gem_install_update_options.rb +57 -33
  635. data/test/rubygems/test_gem_installer.rb +1230 -644
  636. data/test/rubygems/test_gem_local_remote_options.rb +11 -13
  637. data/test/rubygems/test_gem_name_tuple.rb +4 -6
  638. data/test/rubygems/test_gem_package.rb +396 -266
  639. data/test/rubygems/test_gem_package_old.rb +57 -56
  640. data/test/rubygems/test_gem_package_tar_header.rb +108 -50
  641. data/test/rubygems/test_gem_package_tar_reader.rb +8 -10
  642. data/test/rubygems/test_gem_package_tar_reader_entry.rb +77 -20
  643. data/test/rubygems/test_gem_package_tar_writer.rb +107 -101
  644. data/test/rubygems/test_gem_package_task.rb +58 -25
  645. data/test/rubygems/test_gem_path_support.rb +29 -29
  646. data/test/rubygems/test_gem_platform.rb +388 -199
  647. data/test/rubygems/test_gem_rdoc.rb +20 -155
  648. data/test/rubygems/test_gem_remote_fetcher.rb +474 -303
  649. data/test/rubygems/test_gem_request.rb +128 -85
  650. data/test/rubygems/test_gem_request_connection_pools.rb +32 -32
  651. data/test/rubygems/test_gem_request_set.rb +186 -110
  652. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +280 -261
  653. data/test/rubygems/test_gem_request_set_lockfile.rb +93 -94
  654. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +68 -69
  655. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +136 -136
  656. data/test/rubygems/test_gem_requirement.rb +140 -55
  657. data/test/rubygems/test_gem_resolver.rb +224 -115
  658. data/test/rubygems/test_gem_resolver_activation_request.rb +9 -40
  659. data/test/rubygems/test_gem_resolver_api_set.rb +79 -78
  660. data/test/rubygems/test_gem_resolver_api_specification.rb +47 -49
  661. data/test/rubygems/test_gem_resolver_best_set.rb +43 -22
  662. data/test/rubygems/test_gem_resolver_composed_set.rb +1 -3
  663. data/test/rubygems/test_gem_resolver_conflict.rb +12 -18
  664. data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -17
  665. data/test/rubygems/test_gem_resolver_git_set.rb +22 -24
  666. data/test/rubygems/test_gem_resolver_git_specification.rb +22 -22
  667. data/test/rubygems/test_gem_resolver_index_set.rb +14 -16
  668. data/test/rubygems/test_gem_resolver_index_specification.rb +21 -18
  669. data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -8
  670. data/test/rubygems/test_gem_resolver_installer_set.rb +106 -44
  671. data/test/rubygems/test_gem_resolver_local_specification.rb +7 -9
  672. data/test/rubygems/test_gem_resolver_lock_set.rb +15 -17
  673. data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -19
  674. data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -3
  675. data/test/rubygems/test_gem_resolver_specification.rb +8 -10
  676. data/test/rubygems/test_gem_resolver_vendor_set.rb +9 -11
  677. data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -12
  678. data/test/rubygems/test_gem_security.rb +109 -79
  679. data/test/rubygems/test_gem_security_policy.rb +102 -107
  680. data/test/rubygems/test_gem_security_signer.rb +51 -52
  681. data/test/rubygems/test_gem_security_trust_dir.rb +14 -16
  682. data/test/rubygems/test_gem_silent_ui.rb +47 -42
  683. data/test/rubygems/test_gem_source.rb +66 -51
  684. data/test/rubygems/test_gem_source_fetch_problem.rb +17 -8
  685. data/test/rubygems/test_gem_source_git.rb +74 -74
  686. data/test/rubygems/test_gem_source_installed.rb +16 -18
  687. data/test/rubygems/test_gem_source_list.rb +5 -5
  688. data/test/rubygems/test_gem_source_local.rb +15 -16
  689. data/test/rubygems/test_gem_source_lock.rb +31 -33
  690. data/test/rubygems/test_gem_source_specific_file.rb +18 -19
  691. data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
  692. data/test/rubygems/test_gem_source_vendor.rb +13 -15
  693. data/test/rubygems/test_gem_spec_fetcher.rb +74 -67
  694. data/test/rubygems/test_gem_specification.rb +1051 -1071
  695. data/test/rubygems/test_gem_stream_ui.rb +25 -23
  696. data/test/rubygems/test_gem_stub_specification.rb +39 -56
  697. data/test/rubygems/test_gem_text.rb +8 -3
  698. data/test/rubygems/test_gem_uninstaller.rb +269 -100
  699. data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -5
  700. data/test/rubygems/test_gem_update_suggestion.rb +208 -0
  701. data/test/rubygems/test_gem_uri.rb +39 -0
  702. data/test/rubygems/test_gem_uri_formatter.rb +14 -16
  703. data/test/rubygems/test_gem_util.rb +46 -34
  704. data/test/rubygems/test_gem_validator.rb +12 -15
  705. data/test/rubygems/test_gem_version.rb +49 -34
  706. data/test/rubygems/test_gem_version_option.rb +16 -18
  707. data/test/rubygems/test_kernel.rb +61 -53
  708. data/test/rubygems/test_project_sanity.rb +20 -0
  709. data/test/rubygems/test_remote_fetch_error.rb +7 -8
  710. data/test/rubygems/test_require.rb +415 -121
  711. data/test/rubygems/test_rubygems.rb +74 -0
  712. data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +74 -50
  713. data/test/rubygems/wrong_key_cert.pem +15 -15
  714. data/test/rubygems/wrong_key_cert_32.pem +15 -15
  715. data/test/test_changelog_generator.rb +17 -0
  716. metadata +218 -244
  717. data/.rubocop.yml +0 -66
  718. data/.travis.yml +0 -38
  719. data/History.txt +0 -3965
  720. data/Rakefile +0 -372
  721. data/appveyor.yml +0 -43
  722. data/bundler/CODE_OF_CONDUCT.md +0 -42
  723. data/bundler/CONTRIBUTING.md +0 -17
  724. data/bundler/exe/bundle_ruby +0 -60
  725. data/bundler/lib/bundler/cli/package.rb +0 -49
  726. data/bundler/lib/bundler/compatibility_guard.rb +0 -14
  727. data/bundler/lib/bundler/dep_proxy.rb +0 -48
  728. data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
  729. data/bundler/lib/bundler/gemdeps.rb +0 -29
  730. data/bundler/lib/bundler/psyched_yaml.rb +0 -37
  731. data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
  732. data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  733. data/bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  734. data/bundler/lib/bundler/templates/gems.rb +0 -8
  735. data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
  736. data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -7
  737. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  738. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  739. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
  740. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  741. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  742. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  743. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  744. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  745. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  746. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  747. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  748. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -136
  749. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
  750. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
  751. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  752. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
  753. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  754. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
  755. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  756. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  757. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
  758. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
  759. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
  760. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
  761. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
  762. data/bundler/lib/bundler/version_ranges.rb +0 -76
  763. data/bundler/man/bundle-gem.1 +0 -80
  764. data/bundler/man/bundle-gem.ronn +0 -78
  765. data/bundler/man/bundle-package.1 +0 -55
  766. data/lib/rubygems/psych_additions.rb +0 -10
  767. data/lib/rubygems/server.rb +0 -878
  768. data/lib/rubygems/source_local.rb +0 -7
  769. data/lib/rubygems/source_specific_file.rb +0 -6
  770. data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
  771. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  772. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  773. data/lib/rubygems/syck_hack.rb +0 -77
  774. data/lib/ubygems.rb +0 -14
  775. data/test/rubygems/bogussources.rb +0 -9
  776. data/test/rubygems/data/null-type.gemspec.rz +0 -0
  777. data/test/rubygems/test_gem_server.rb +0 -607
  778. data/util/CL2notes +0 -55
  779. data/util/ci +0 -77
  780. data/util/create_certs.rb +0 -171
  781. data/util/create_encrypted_key.rb +0 -16
  782. data/util/generate_spdx_license_list.rb +0 -61
  783. data/util/patch_with_prs.rb +0 -77
  784. data/util/rubocop +0 -8
  785. data/util/update_bundled_ca_certificates.rb +0 -139
  786. data/util/update_changelog.rb +0 -67
  787. /data/bundler/lib/bundler/{ssl_certs → man}/.document +0 -0
  788. /data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  789. /data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  790. /data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  791. /data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  792. /data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  793. /data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  794. /data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
  795. /data/{bundler/lib/bundler/ssl_certs/index.rubygems.org → lib/rubygems/ssl_certs/rubygems.org}/GlobalSignRootCA.pem +0 -0
@@ -1,24 +1,19 @@
1
1
  # frozen_string_literal: true
2
- # -*- coding: utf-8 -*-
2
+ #
3
3
  #--
4
4
  # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
5
5
  # All rights reserved.
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
- require 'rubygems/deprecate'
14
- require 'rubygems/basic_specification'
15
- require 'rubygems/stub_specification'
16
- require 'rubygems/specification_policy'
17
- require 'rubygems/util/list'
18
- require 'stringio'
9
+ require_relative "deprecate"
10
+ require_relative "basic_specification"
11
+ require_relative "stub_specification"
12
+ require_relative "platform"
13
+ require_relative "util/list"
19
14
 
20
15
  ##
21
- # The Specification class contains the information for a Gem. Typically
16
+ # The Specification class contains the information for a gem. Typically
22
17
  # defined in a .gemspec file or a Rakefile, and looks like this:
23
18
  #
24
19
  # Gem::Specification.new do |s|
@@ -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
@@ -80,39 +74,36 @@ class Gem::Specification < Gem::BasicSpecification
80
74
  # key should be equal to the CURRENT_SPECIFICATION_VERSION.
81
75
 
82
76
  SPECIFICATION_VERSION_HISTORY = { # :nodoc:
83
- -1 => ['(RubyGems versions up to and including 0.7 did not have versioned specifications)'],
84
- 1 => [
77
+ -1 => ["(RubyGems versions up to and including 0.7 did not have versioned specifications)"],
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
- 'Now forward-compatible with future versions',
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:
101
95
  -1 => 16,
102
- 1 => 16,
103
- 2 => 16,
104
- 3 => 17,
105
- 4 => 18,
96
+ 1 => 16,
97
+ 2 => 16,
98
+ 3 => 17,
99
+ 4 => 18,
106
100
  }.freeze
107
101
 
108
102
  today = Time.now.utc
109
103
  TODAY = Time.utc(today.year, today.month, today.day) # :nodoc:
110
104
 
111
- # rubocop:disable Style/MutableConstant
112
- LOAD_CACHE = {} # :nodoc:
113
- # rubocop:enable Style/MutableConstant
114
-
115
- private_constant :LOAD_CACHE if defined? private_constant
105
+ @load_cache = {} # :nodoc:
106
+ @load_cache_mutex = Thread::Mutex.new
116
107
 
117
108
  VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/.freeze # :nodoc:
118
109
 
@@ -133,66 +124,79 @@ class Gem::Specification < Gem::BasicSpecification
133
124
  # Map of attribute names to default values.
134
125
 
135
126
  @@default_value = {
136
- :authors => [],
137
- :autorequire => nil,
138
- :bindir => 'bin',
139
- :cert_chain => [],
140
- :date => nil,
141
- :dependencies => [],
142
- :description => nil,
143
- :email => nil,
144
- :executables => [],
145
- :extensions => [],
146
- :extra_rdoc_files => [],
147
- :files => [],
148
- :homepage => nil,
149
- :licenses => [],
150
- :metadata => {},
151
- :name => nil,
152
- :platform => Gem::Platform::RUBY,
153
- :post_install_message => nil,
154
- :rdoc_options => [],
155
- :require_paths => ['lib'],
156
- :required_ruby_version => Gem::Requirement.default,
127
+ :authors => [],
128
+ :autorequire => nil,
129
+ :bindir => "bin",
130
+ :cert_chain => [],
131
+ :date => nil,
132
+ :dependencies => [],
133
+ :description => nil,
134
+ :email => nil,
135
+ :executables => [],
136
+ :extensions => [],
137
+ :extra_rdoc_files => [],
138
+ :files => [],
139
+ :homepage => nil,
140
+ :licenses => [],
141
+ :metadata => {},
142
+ :name => nil,
143
+ :platform => Gem::Platform::RUBY,
144
+ :post_install_message => nil,
145
+ :rdoc_options => [],
146
+ :require_paths => ["lib"],
147
+ :required_ruby_version => Gem::Requirement.default,
157
148
  :required_rubygems_version => Gem::Requirement.default,
158
- :requirements => [],
159
- :rubygems_version => Gem::VERSION,
160
- :signing_key => nil,
161
- :specification_version => CURRENT_SPECIFICATION_VERSION,
162
- :summary => nil,
163
- :test_files => [],
164
- :version => nil,
149
+ :requirements => [],
150
+ :rubygems_version => Gem::VERSION,
151
+ :signing_key => nil,
152
+ :specification_version => CURRENT_SPECIFICATION_VERSION,
153
+ :summary => nil,
154
+ :test_files => [],
155
+ :version => nil,
165
156
  }.freeze
166
157
 
167
158
  # rubocop:disable Style/MutableConstant
168
- INITIALIZE_CODE_FOR_DEFAULTS = { } # :nodoc:
159
+ INITIALIZE_CODE_FOR_DEFAULTS = {} # :nodoc:
169
160
  # rubocop:enable Style/MutableConstant
170
161
 
171
162
  @@default_value.each do |k,v|
172
163
  INITIALIZE_CODE_FOR_DEFAULTS[k] = case v
173
- when [], {}, true, false, nil, Numeric, Symbol
174
- v.inspect
175
- when String
176
- v.dump
177
- when Numeric
178
- "default_value(:#{k})"
179
- else
180
- "default_value(:#{k}).dup"
181
- end
182
- end
183
-
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|
164
+ when [], {}, true, false, nil, Numeric, Symbol
165
+ v.inspect
166
+ when String
167
+ v.dump
168
+ when Numeric
169
+ "default_value(:#{k})"
170
+ else
171
+ "default_value(:#{k}).dup"
172
+ end
173
+ end
174
+
175
+ @@attributes = @@default_value.keys.sort_by {|s| s.to_s }
176
+ @@array_attributes = @@default_value.reject {|k,v| v != [] }.keys
177
+ @@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition do |k|
187
178
  @@default_value[k].nil?
188
- }
179
+ end
189
180
 
190
- @@stubs_by_name = {}
181
+ def self.clear_specs # :nodoc:
182
+ @@all = nil
183
+ @@stubs = nil
184
+ @@stubs_by_name = {}
185
+ @@spec_with_requirable_file = {}
186
+ @@active_stub_with_requirable_file = {}
187
+ end
188
+ private_class_method :clear_specs
189
+
190
+ clear_specs
191
191
 
192
192
  # Sentinel object to represent "not found" stubs
193
193
  NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:
194
- @@spec_with_requirable_file = {}
195
- @@active_stub_with_requirable_file = {}
194
+
195
+ # Tracking removed method calls to warn users during build time.
196
+ REMOVED_METHODS = [:rubyforge_project=].freeze # :nodoc:
197
+ def removed_method_calls
198
+ @removed_method_calls ||= []
199
+ end
196
200
 
197
201
  ######################################################################
198
202
  # :section: Required gemspec attributes
@@ -220,7 +224,7 @@ class Gem::Specification < Gem::BasicSpecification
220
224
  attr_reader :version
221
225
 
222
226
  ##
223
- # A short summary of this gem's description. Displayed in `gem list -d`.
227
+ # A short summary of this gem's description. Displayed in <tt>gem list -d</tt>.
224
228
  #
225
229
  # The #description should be more detailed than the summary.
226
230
  #
@@ -244,12 +248,11 @@ class Gem::Specification < Gem::BasicSpecification
244
248
  # require 'rake'
245
249
  # spec.files = FileList['lib/**/*.rb',
246
250
  # 'bin/*',
247
- # '[A-Z]*',
248
- # 'test/**/*'].to_a
251
+ # '[A-Z]*'].to_a
249
252
  #
250
253
  # # or without Rake...
251
254
  # spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
252
- # spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
255
+ # spec.files += Dir['[A-Z]*']
253
256
  # spec.files.reject! { |fn| fn.include? "CVS" }
254
257
 
255
258
  def files
@@ -267,7 +270,7 @@ class Gem::Specification < Gem::BasicSpecification
267
270
  # A list of authors for this gem.
268
271
  #
269
272
  # Alternatively, a single author can be specified by assigning a string to
270
- # `spec.author`
273
+ # +spec.author+
271
274
  #
272
275
  # Usage:
273
276
  #
@@ -280,6 +283,15 @@ class Gem::Specification < Gem::BasicSpecification
280
283
  ######################################################################
281
284
  # :section: Recommended gemspec attributes
282
285
 
286
+ ##
287
+ # The version of Ruby required by this gem
288
+ #
289
+ # Usage:
290
+ #
291
+ # spec.required_ruby_version = '>= 2.7.0'
292
+
293
+ attr_reader :required_ruby_version
294
+
283
295
  ##
284
296
  # A long description of this gem
285
297
  #
@@ -323,17 +335,21 @@ class Gem::Specification < Gem::BasicSpecification
323
335
  # This should just be the name of your license. The full text of the license
324
336
  # should be inside of the gem (at the top level) when you build it.
325
337
  #
326
- # The simplest way, is to specify the standard SPDX ID
338
+ # The simplest way is to specify the standard SPDX ID
327
339
  # https://spdx.org/licenses/ for the license.
328
- # Ideally you should pick one that is OSI (Open Source Initiative)
340
+ # Ideally, you should pick one that is OSI (Open Source Initiative)
329
341
  # http://opensource.org/licenses/alphabetical approved.
330
342
  #
331
- # The most commonly used OSI approved licenses are MIT and Apache-2.0.
343
+ # The most commonly used OSI-approved licenses are MIT and Apache-2.0.
332
344
  # GitHub also provides a license picker at http://choosealicense.com/.
333
345
  #
346
+ # You can also use a custom license file along with your gemspec and specify
347
+ # a LicenseRef-<idstring>, where idstring is the name of the file containing
348
+ # the license text.
349
+ #
334
350
  # You should specify a license for your gem so that people know how they are
335
- # permitted to use it, and any restrictions you're placing on it. Not
336
- # specifying a license means all rights are reserved; others have no rights
351
+ # permitted to use it and any restrictions you're placing on it. Not
352
+ # specifying a license means all rights are reserved; others have no right
337
353
  # to use the code for any purpose.
338
354
  #
339
355
  # You can set multiple licenses with #licenses=
@@ -364,8 +380,7 @@ class Gem::Specification < Gem::BasicSpecification
364
380
 
365
381
  ##
366
382
  # The metadata holds extra data for this gem that may be useful to other
367
- # consumers and is settable by gem authors without requiring an update to
368
- # the rubygems software.
383
+ # consumers and is settable by gem authors.
369
384
  #
370
385
  # Metadata items have the following restrictions:
371
386
  #
@@ -386,6 +401,7 @@ class Gem::Specification < Gem::BasicSpecification
386
401
  # "mailing_list_uri" => "https://groups.example.com/bestgemever",
387
402
  # "source_code_uri" => "https://example.com/user/bestgemever",
388
403
  # "wiki_uri" => "https://example.com/user/bestgemever/wiki"
404
+ # "funding_uri" => "https://example.com/donate"
389
405
  # }
390
406
  #
391
407
  # These links will be used on your gem's page on rubygems.org and must pass
@@ -457,7 +473,7 @@ class Gem::Specification < Gem::BasicSpecification
457
473
  # spec.platform = Gem::Platform.local
458
474
 
459
475
  def platform=(platform)
460
- if @original_platform.nil? or
476
+ if @original_platform.nil? ||
461
477
  @original_platform == Gem::Platform::RUBY
462
478
  @original_platform = platform
463
479
  end
@@ -473,12 +489,12 @@ class Gem::Specification < Gem::BasicSpecification
473
489
  # legacy constants
474
490
  when nil, Gem::Platform::RUBY then
475
491
  @new_platform = Gem::Platform::RUBY
476
- when 'mswin32' then # was Gem::Platform::WIN32
477
- @new_platform = Gem::Platform.new 'x86-mswin32'
478
- when 'i586-linux' then # was Gem::Platform::LINUX_586
479
- @new_platform = Gem::Platform.new 'x86-linux'
480
- when 'powerpc-darwin' then # was Gem::Platform::DARWIN
481
- @new_platform = Gem::Platform.new 'ppc-darwin'
492
+ when "mswin32" then # was Gem::Platform::WIN32
493
+ @new_platform = Gem::Platform.new "x86-mswin32"
494
+ when "i586-linux" then # was Gem::Platform::LINUX_586
495
+ @new_platform = Gem::Platform.new "x86-linux"
496
+ when "powerpc-darwin" then # was Gem::Platform::DARWIN
497
+ @new_platform = Gem::Platform.new "ppc-darwin"
482
498
  else
483
499
  @new_platform = Gem::Platform.new platform
484
500
  end
@@ -511,11 +527,6 @@ class Gem::Specification < Gem::BasicSpecification
511
527
  @require_paths = Array(val)
512
528
  end
513
529
 
514
- ##
515
- # The version of Ruby required by this gem
516
-
517
- attr_reader :required_ruby_version
518
-
519
530
  ##
520
531
  # The RubyGems version required by this gem
521
532
 
@@ -556,6 +567,10 @@ class Gem::Specification < Gem::BasicSpecification
556
567
  # spec.add_runtime_dependency 'example', '~> 1.1', '>= 1.1.4'
557
568
 
558
569
  def add_runtime_dependency(gem, *requirements)
570
+ if requirements.uniq.size != requirements.size
571
+ warn "WARNING: duplicated #{gem} dependency #{requirements}"
572
+ end
573
+
559
574
  add_dependency_with_type(gem, :runtime, requirements)
560
575
  end
561
576
 
@@ -641,6 +656,8 @@ class Gem::Specification < Gem::BasicSpecification
641
656
  @rdoc_options ||= []
642
657
  end
643
658
 
659
+ LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1")
660
+
644
661
  ##
645
662
  # The version of Ruby required by this gem. The ruby version can be
646
663
  # specified to the patch-level:
@@ -656,14 +673,25 @@ class Gem::Specification < Gem::BasicSpecification
656
673
  # # This gem will work with 1.8.6 or greater...
657
674
  # spec.required_ruby_version = '>= 1.8.6'
658
675
  #
659
- # # Only with ruby 2.0.x
660
- # spec.required_ruby_version = '~> 2.0'
676
+ # # Only with final releases of major version 2 where minor version is at least 3
677
+ # spec.required_ruby_version = '~> 2.3'
661
678
  #
662
679
  # # Only prereleases or final releases after 2.6.0.preview2
663
680
  # spec.required_ruby_version = '> 2.6.0.preview2'
681
+ #
682
+ # # This gem will work with 2.3.0 or greater, including major version 3, but lesser than 4.0.0
683
+ # spec.required_ruby_version = '>= 2.3', '< 4'
664
684
 
665
685
  def required_ruby_version=(req)
666
686
  @required_ruby_version = Gem::Requirement.create req
687
+
688
+ @required_ruby_version.requirements.map! do |op, v|
689
+ if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4
690
+ [op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))]
691
+ else
692
+ [op, v]
693
+ end
694
+ end
667
695
  end
668
696
 
669
697
  ##
@@ -721,20 +749,13 @@ class Gem::Specification < Gem::BasicSpecification
721
749
  # Deprecated: You must now specify the executable name to Gem.bin_path.
722
750
 
723
751
  attr_writer :default_executable
724
- deprecate :default_executable=, :none, 2018, 12
752
+ rubygems_deprecate :default_executable=
725
753
 
726
754
  ##
727
755
  # Allows deinstallation of gems with legacy platforms.
728
756
 
729
757
  attr_writer :original_platform # :nodoc:
730
758
 
731
- ##
732
- # Deprecated and ignored.
733
- #
734
- # Formerly used to set rubyforge project.
735
-
736
- attr_writer :rubyforge_project
737
-
738
759
  ##
739
760
  # The Gem::Specification version of this gemspec.
740
761
  #
@@ -743,47 +764,29 @@ class Gem::Specification < Gem::BasicSpecification
743
764
  attr_accessor :specification_version
744
765
 
745
766
  def self._all # :nodoc:
746
- unless defined?(@@all) && @@all
747
- @@all = stubs.map(&:to_spec)
748
- if @@all.any?(&:nil?) # TODO: remove once we're happy
749
- raise "pid: #{$$} nil spec! included in #{stubs.inspect}"
750
- end
751
-
752
- # After a reset, make sure already loaded specs
753
- # are still marked as activated.
754
- specs = {}
755
- Gem.loaded_specs.each_value{|s| specs[s] = true}
756
- @@all.each{|s| s.activated = true if specs[s]}
757
- end
758
- @@all
767
+ @@all ||= Gem.loaded_specs.values | stubs.map(&:to_spec)
759
768
  end
760
769
 
761
- def self._clear_load_cache # :nodoc:
762
- LOAD_CACHE.clear
770
+ def self.clear_load_cache # :nodoc:
771
+ @load_cache_mutex.synchronize do
772
+ @load_cache.clear
773
+ end
763
774
  end
775
+ private_class_method :clear_load_cache
764
776
 
765
777
  def self.each_gemspec(dirs) # :nodoc:
766
778
  dirs.each do |dir|
767
779
  Gem::Util.glob_files_in_dir("*.gemspec", dir).each do |path|
768
- yield path.untaint
780
+ yield path.tap(&Gem::UNTAINT)
769
781
  end
770
782
  end
771
783
  end
772
784
 
773
785
  def self.gemspec_stubs_in(dir, pattern)
774
- Gem::Util.glob_files_in_dir(pattern, dir).map { |path| yield path }.select(&:valid?)
786
+ Gem::Util.glob_files_in_dir(pattern, dir).map {|path| yield path }.select(&:valid?)
775
787
  end
776
788
  private_class_method :gemspec_stubs_in
777
789
 
778
- def self.default_stubs(pattern)
779
- base_dir = Gem.default_dir
780
- gems_dir = File.join base_dir, "gems"
781
- gemspec_stubs_in(default_specifications_dir, pattern) do |path|
782
- Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
783
- end
784
- end
785
- private_class_method :default_stubs
786
-
787
790
  def self.installed_stubs(dirs, pattern)
788
791
  map_stubs(dirs, pattern) do |path, base_dir, gems_dir|
789
792
  Gem::StubSpecification.gemspec_stub(path, base_dir, gems_dir)
@@ -792,24 +795,14 @@ class Gem::Specification < Gem::BasicSpecification
792
795
  private_class_method :installed_stubs
793
796
 
794
797
  def self.map_stubs(dirs, pattern) # :nodoc:
795
- dirs.flat_map { |dir|
798
+ dirs.flat_map do |dir|
796
799
  base_dir = File.dirname dir
797
800
  gems_dir = File.join base_dir, "gems"
798
- gemspec_stubs_in(dir, pattern) { |path| yield path, base_dir, gems_dir }
799
- }
801
+ gemspec_stubs_in(dir, pattern) {|path| yield path, base_dir, gems_dir }
802
+ end
800
803
  end
801
804
  private_class_method :map_stubs
802
805
 
803
- def self.uniq_by(list, &block) # :nodoc:
804
- list.uniq(&block)
805
- end
806
- private_class_method :uniq_by
807
-
808
- def self.sort_by!(list, &block)
809
- list.sort_by!(&block)
810
- end
811
- private_class_method :sort_by!
812
-
813
806
  def self.each_spec(dirs) # :nodoc:
814
807
  each_gemspec(dirs) do |path|
815
808
  spec = self.load path
@@ -823,16 +816,23 @@ class Gem::Specification < Gem::BasicSpecification
823
816
  def self.stubs
824
817
  @@stubs ||= begin
825
818
  pattern = "*.gemspec"
826
- stubs = Gem.loaded_specs.values + default_stubs(pattern) + installed_stubs(dirs, pattern)
827
- stubs = uniq_by(stubs) { |stub| stub.full_name }
819
+ stubs = stubs_for_pattern(pattern, false)
828
820
 
829
- _resort!(stubs)
830
- @@stubs_by_name = stubs.select { |s| Gem::Platform.match s.platform }.group_by(&:name)
821
+ @@stubs_by_name = stubs.select {|s| Gem::Platform.match_spec? s }.group_by(&:name)
831
822
  stubs
832
823
  end
833
824
  end
834
825
 
835
- EMPTY = [].freeze # :nodoc:
826
+ ##
827
+ # Returns a Gem::StubSpecification for default gems
828
+
829
+ def self.default_stubs(pattern = "*.gemspec")
830
+ base_dir = Gem.default_dir
831
+ gems_dir = File.join base_dir, "gems"
832
+ gemspec_stubs_in(Gem.default_specifications_dir, pattern) do |path|
833
+ Gem::StubSpecification.default_gemspec_stub(path, base_dir, gems_dir)
834
+ end
835
+ end
836
836
 
837
837
  ##
838
838
  # Returns a Gem::StubSpecification for installed gem named +name+
@@ -842,30 +842,40 @@ class Gem::Specification < Gem::BasicSpecification
842
842
  if @@stubs
843
843
  @@stubs_by_name[name] || []
844
844
  else
845
- pattern = "#{name}-*.gemspec"
846
- stubs = Gem.loaded_specs.values + default_stubs(pattern) +
847
- installed_stubs(dirs, pattern).select { |s| Gem::Platform.match s.platform }
848
- stubs = uniq_by(stubs) { |stub| stub.full_name }.group_by(&:name)
849
- stubs.each_value { |v| _resort!(v) }
850
-
851
- @@stubs_by_name.merge! stubs
852
- @@stubs_by_name[name] ||= EMPTY
845
+ @@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec").select do |s|
846
+ s.name == name
847
+ end
853
848
  end
854
849
  end
855
850
 
851
+ ##
852
+ # Finds stub specifications matching a pattern from the standard locations,
853
+ # optionally filtering out specs not matching the current platform
854
+ #
855
+ def self.stubs_for_pattern(pattern, match_platform = true) # :nodoc:
856
+ installed_stubs = installed_stubs(Gem::Specification.dirs, pattern)
857
+ installed_stubs.select! {|s| Gem::Platform.match_spec? s } if match_platform
858
+ stubs = installed_stubs + default_stubs(pattern)
859
+ stubs = stubs.uniq {|stub| stub.full_name }
860
+ _resort!(stubs)
861
+ stubs
862
+ end
863
+
856
864
  def self._resort!(specs) # :nodoc:
857
- specs.sort! { |a, b|
865
+ specs.sort! do |a, b|
858
866
  names = a.name <=> b.name
859
867
  next names if names.nonzero?
860
- b.version <=> a.version
861
- }
868
+ versions = b.version <=> a.version
869
+ next versions if versions.nonzero?
870
+ Gem::Platform.sort_priority(b.platform)
871
+ end
862
872
  end
863
873
 
864
874
  ##
865
875
  # Loads the default specifications. It should be called only once.
866
876
 
867
877
  def self.load_defaults
868
- each_spec([default_specifications_dir]) do |spec|
878
+ each_spec([Gem.default_specifications_dir]) do |spec|
869
879
  # #load returns nil if the spec is bad, so we just ignore
870
880
  # it at this stage
871
881
  Gem.register_default_spec(spec)
@@ -877,44 +887,23 @@ class Gem::Specification < Gem::BasicSpecification
877
887
  # properly sorted.
878
888
 
879
889
  def self.add_spec(spec)
880
- warn "Gem::Specification.add_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
881
- # TODO: find all extraneous adds
882
- # puts
883
- # p :add_spec => [spec.full_name, caller.reject { |s| s =~ /minitest/ }]
884
-
885
- # TODO: flush the rest of the crap from the tests
886
- # raise "no dupes #{spec.full_name} in #{all_names.inspect}" if
887
- # _all.include? spec
888
-
889
- raise "nil spec!" unless spec # TODO: remove once we're happy with tests
890
-
891
890
  return if _all.include? spec
892
891
 
893
892
  _all << spec
894
893
  stubs << spec
895
894
  (@@stubs_by_name[spec.name] ||= []) << spec
896
- sort_by!(@@stubs_by_name[spec.name]) { |s| s.version }
897
- _resort!(_all)
895
+
896
+ _resort!(@@stubs_by_name[spec.name])
898
897
  _resort!(stubs)
899
898
  end
900
899
 
901
900
  ##
902
- # Adds multiple specs to the known specifications.
903
-
904
- def self.add_specs(*specs)
905
- warn "Gem::Specification.add_specs is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
906
-
907
- raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
908
-
909
- # TODO: this is much more efficient, but we need the extra checks for now
910
- # _all.concat specs
911
- # _resort!
901
+ # Removes +spec+ from the known specs.
912
902
 
913
- Gem::Deprecate.skip_during do
914
- specs.each do |spec| # TODO: slow
915
- add_spec spec
916
- end
917
- end
903
+ def self.remove_spec(spec)
904
+ _all.delete spec.to_spec
905
+ stubs.delete spec
906
+ (@@stubs_by_name[spec.name] || []).delete spec
918
907
  end
919
908
 
920
909
  ##
@@ -940,7 +929,6 @@ class Gem::Specification < Gem::BasicSpecification
940
929
  # -- wilsonb
941
930
 
942
931
  def self.all=(specs)
943
- raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
944
932
  @@stubs_by_name = specs.group_by(&:name)
945
933
  @@all = @@stubs = specs
946
934
  end
@@ -974,9 +962,9 @@ class Gem::Specification < Gem::BasicSpecification
974
962
  # Return the directories that Specification uses to find specs.
975
963
 
976
964
  def self.dirs
977
- @@dirs ||= Gem.path.collect { |dir|
978
- File.join dir.dup.untaint, "specifications"
979
- }
965
+ @@dirs ||= Gem.path.collect do |dir|
966
+ File.join dir.dup.tap(&Gem::UNTAINT), "specifications"
967
+ end
980
968
  end
981
969
 
982
970
  ##
@@ -986,7 +974,7 @@ class Gem::Specification < Gem::BasicSpecification
986
974
  def self.dirs=(dirs)
987
975
  self.reset
988
976
 
989
- @@dirs = Array(dirs).map { |dir| File.join dir, "specifications" }
977
+ @@dirs = Array(dirs).map {|dir| File.join dir, "specifications" }
990
978
  end
991
979
 
992
980
  extend Enumerable
@@ -1038,10 +1026,9 @@ class Gem::Specification < Gem::BasicSpecification
1038
1026
 
1039
1027
  def self.find_by_path(path)
1040
1028
  path = path.dup.freeze
1041
- spec = @@spec_with_requirable_file[path] ||= (stubs.find { |s|
1042
- next unless Gem::BundlerVersionFinder.compatible?(s)
1029
+ spec = @@spec_with_requirable_file[path] ||= (stubs.find do |s|
1043
1030
  s.contains_requirable_file? path
1044
- } || NOT_FOUND)
1031
+ end || NOT_FOUND)
1045
1032
  spec.to_spec
1046
1033
  end
1047
1034
 
@@ -1050,18 +1037,17 @@ class Gem::Specification < Gem::BasicSpecification
1050
1037
  # amongst the specs that are not activated.
1051
1038
 
1052
1039
  def self.find_inactive_by_path(path)
1053
- stub = stubs.find { |s|
1040
+ stub = stubs.find do |s|
1054
1041
  next if s.activated?
1055
- next unless Gem::BundlerVersionFinder.compatible?(s)
1056
1042
  s.contains_requirable_file? path
1057
- }
1043
+ end
1058
1044
  stub && stub.to_spec
1059
1045
  end
1060
1046
 
1061
1047
  def self.find_active_stub_by_path(path)
1062
- stub = @@active_stub_with_requirable_file[path] ||= (stubs.find { |s|
1063
- s.activated? and s.contains_requirable_file? path
1064
- } || NOT_FOUND)
1048
+ stub = @@active_stub_with_requirable_file[path] ||= (stubs.find do |s|
1049
+ s.activated? && s.contains_requirable_file?(path)
1050
+ end || NOT_FOUND)
1065
1051
  stub.this
1066
1052
  end
1067
1053
 
@@ -1069,10 +1055,7 @@ class Gem::Specification < Gem::BasicSpecification
1069
1055
  # Return currently unresolved specs that contain the file matching +path+.
1070
1056
 
1071
1057
  def self.find_in_unresolved(path)
1072
- # TODO: do we need these?? Kill it
1073
- specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
1074
-
1075
- specs.find_all { |spec| spec.contains_requirable_file? path }
1058
+ unresolved_specs.find_all {|spec| spec.contains_requirable_file? path }
1076
1059
  end
1077
1060
 
1078
1061
  ##
@@ -1080,9 +1063,7 @@ class Gem::Specification < Gem::BasicSpecification
1080
1063
  # specs that contain the file matching +path+.
1081
1064
 
1082
1065
  def self.find_in_unresolved_tree(path)
1083
- specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
1084
-
1085
- specs.each do |spec|
1066
+ unresolved_specs.each do |spec|
1086
1067
  spec.traverse do |from_spec, dep, to_spec, trail|
1087
1068
  if to_spec.has_conflicts? || to_spec.conficts_when_loaded_with?(trail)
1088
1069
  :next
@@ -1095,6 +1076,11 @@ class Gem::Specification < Gem::BasicSpecification
1095
1076
  []
1096
1077
  end
1097
1078
 
1079
+ def self.unresolved_specs
1080
+ unresolved_deps.values.map {|dep| dep.to_specs }.flatten
1081
+ end
1082
+ private_class_method :unresolved_specs
1083
+
1098
1084
  ##
1099
1085
  # Special loader for YAML files. When a Specification object is loaded
1100
1086
  # from a YAML file, it bypasses the normal Ruby object initialization
@@ -1119,6 +1105,7 @@ class Gem::Specification < Gem::BasicSpecification
1119
1105
 
1120
1106
  spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION
1121
1107
  spec.reset_nil_attributes_to_default
1108
+ spec.flatten_require_paths
1122
1109
 
1123
1110
  spec
1124
1111
  end
@@ -1128,24 +1115,26 @@ class Gem::Specification < Gem::BasicSpecification
1128
1115
  # +prerelease+ is true.
1129
1116
 
1130
1117
  def self.latest_specs(prerelease = false)
1131
- _latest_specs Gem::Specification._all, prerelease
1118
+ _latest_specs Gem::Specification.stubs, prerelease
1119
+ end
1120
+
1121
+ ##
1122
+ # Return the latest installed spec for gem +name+.
1123
+
1124
+ def self.latest_spec_for(name)
1125
+ latest_specs(true).find {|installed_spec| installed_spec.name == name }
1132
1126
  end
1133
1127
 
1134
1128
  def self._latest_specs(specs, prerelease = false) # :nodoc:
1135
- result = Hash.new { |h,k| h[k] = {} }
1136
- native = {}
1129
+ result = {}
1137
1130
 
1138
1131
  specs.reverse_each do |spec|
1139
1132
  next if spec.version.prerelease? unless prerelease
1140
1133
 
1141
- native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY
1142
- result[spec.name][spec.platform] = spec
1134
+ result[spec.name] = spec
1143
1135
  end
1144
1136
 
1145
- result.map(&:last).map(&:values).flatten.reject { |spec|
1146
- minimum = native[spec.name]
1147
- minimum && spec.version < minimum
1148
- }.sort_by{ |tup| tup.name }
1137
+ result.map(&:last).flatten.sort_by {|tup| tup.name }
1149
1138
  end
1150
1139
 
1151
1140
  ##
@@ -1154,22 +1143,29 @@ class Gem::Specification < Gem::BasicSpecification
1154
1143
  def self.load(file)
1155
1144
  return unless file
1156
1145
 
1157
- _spec = LOAD_CACHE[file]
1146
+ _spec = @load_cache_mutex.synchronize { @load_cache[file] }
1158
1147
  return _spec if _spec
1159
1148
 
1160
- file = file.dup.untaint
1149
+ file = file.dup.tap(&Gem::UNTAINT)
1161
1150
  return unless File.file?(file)
1162
1151
 
1163
- code = File.read file, :mode => 'r:UTF-8:-'
1152
+ code = Gem.open_file(file, "r:UTF-8:-", &:read)
1164
1153
 
1165
- code.untaint
1154
+ code.tap(&Gem::UNTAINT)
1166
1155
 
1167
1156
  begin
1168
1157
  _spec = eval code, binding, file
1169
1158
 
1170
1159
  if Gem::Specification === _spec
1171
1160
  _spec.loaded_from = File.expand_path file.to_s
1172
- LOAD_CACHE[file] = _spec
1161
+ @load_cache_mutex.synchronize do
1162
+ prev = @load_cache[file]
1163
+ if prev
1164
+ _spec = prev
1165
+ else
1166
+ @load_cache[file] = _spec
1167
+ end
1168
+ end
1173
1169
  return _spec
1174
1170
  end
1175
1171
 
@@ -1195,7 +1191,7 @@ class Gem::Specification < Gem::BasicSpecification
1195
1191
 
1196
1192
  def self.normalize_yaml_input(input)
1197
1193
  result = input.respond_to?(:read) ? input.read : input
1198
- result = "--- " + result unless result =~ /\A--- /
1194
+ result = "--- " + result unless result.start_with?("--- ")
1199
1195
  result = result.dup
1200
1196
  result.gsub!(/ !!null \n/, " \n")
1201
1197
  # date: 2011-04-26 00:00:00.000000000Z
@@ -1212,7 +1208,7 @@ class Gem::Specification < Gem::BasicSpecification
1212
1208
  # version as well.
1213
1209
 
1214
1210
  def self.outdated
1215
- outdated_and_latest_version.map { |local, _| local.name }
1211
+ outdated_and_latest_version.map {|local, _| local.name }
1216
1212
  end
1217
1213
 
1218
1214
  ##
@@ -1233,28 +1229,17 @@ class Gem::Specification < Gem::BasicSpecification
1233
1229
  Gem::Dependency.new local_spec.name, ">= #{local_spec.version}"
1234
1230
 
1235
1231
  remotes, = fetcher.search_for_dependency dependency
1236
- remotes = remotes.map { |n, _| n.version }
1232
+ remotes = remotes.map {|n, _| n.version }
1237
1233
 
1238
1234
  latest_remote = remotes.sort.last
1239
1235
 
1240
1236
  yield [local_spec, latest_remote] if
1241
- latest_remote and local_spec.version < latest_remote
1237
+ latest_remote && local_spec.version < latest_remote
1242
1238
  end
1243
1239
 
1244
1240
  nil
1245
1241
  end
1246
1242
 
1247
- ##
1248
- # Removes +spec+ from the known specs.
1249
-
1250
- def self.remove_spec(spec)
1251
- warn "Gem::Specification.remove_spec is deprecated and will be removed in RubyGems 3.0" unless Gem::Deprecate.skip
1252
- _all.delete spec
1253
- stubs.delete_if { |s| s.full_name == spec.full_name }
1254
- (@@stubs_by_name[spec.name] || []).delete_if { |s| s.full_name == spec.full_name }
1255
- reset
1256
- end
1257
-
1258
1243
  ##
1259
1244
  # Is +name+ a required attribute?
1260
1245
 
@@ -1275,43 +1260,63 @@ class Gem::Specification < Gem::BasicSpecification
1275
1260
 
1276
1261
  def self.reset
1277
1262
  @@dirs = nil
1278
- Gem.pre_reset_hooks.each { |hook| hook.call }
1279
- @@all = nil
1280
- @@stubs = nil
1281
- @@stubs_by_name = {}
1282
- @@spec_with_requirable_file = {}
1283
- @@active_stub_with_requirable_file = {}
1284
- _clear_load_cache
1263
+ Gem.pre_reset_hooks.each {|hook| hook.call }
1264
+ clear_specs
1265
+ clear_load_cache
1285
1266
  unresolved = unresolved_deps
1286
1267
  unless unresolved.empty?
1287
- w = "W" + "ARN"
1288
- warn "#{w}: Unresolved or ambigious specs during Gem::Specification.reset:"
1268
+ warn "WARN: Unresolved or ambiguous specs during Gem::Specification.reset:"
1289
1269
  unresolved.values.each do |dep|
1290
1270
  warn " #{dep}"
1291
1271
 
1292
1272
  versions = find_all_by_name(dep.name)
1293
1273
  unless versions.empty?
1294
1274
  warn " Available/installed versions of this gem:"
1295
- versions.each { |s| warn " - #{s.version}" }
1275
+ versions.each {|s| warn " - #{s.version}" }
1296
1276
  end
1297
1277
  end
1298
- warn "#{w}: Clearing out unresolved specs. Try 'gem cleanup <gem>'"
1278
+ warn "WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'"
1299
1279
  warn "Please report a bug if this causes problems."
1300
1280
  unresolved.clear
1301
1281
  end
1302
- Gem.post_reset_hooks.each { |hook| hook.call }
1282
+ Gem.post_reset_hooks.each {|hook| hook.call }
1303
1283
  end
1304
1284
 
1305
1285
  # DOC: This method needs documented or nodoc'd
1306
1286
  def self.unresolved_deps
1307
- @unresolved_deps ||= Hash.new { |h, n| h[n] = Gem::Dependency.new n }
1287
+ @unresolved_deps ||= Hash.new {|h, n| h[n] = Gem::Dependency.new n }
1308
1288
  end
1309
1289
 
1310
1290
  ##
1311
1291
  # Load custom marshal format, re-initializing defaults as needed
1312
1292
 
1313
1293
  def self._load(str)
1314
- array = Marshal.load str
1294
+ Gem.load_yaml
1295
+
1296
+ array = begin
1297
+ Marshal.load str
1298
+ rescue ArgumentError => e
1299
+ #
1300
+ # Some very old marshaled specs included references to `YAML::PrivateType`
1301
+ # and `YAML::Syck::DefaultKey` constants due to bugs in the old emitter
1302
+ # that generated them. Workaround the issue by defining the necessary
1303
+ # constants and retrying.
1304
+ #
1305
+ message = e.message
1306
+ raise unless message.include?("YAML::")
1307
+
1308
+ Object.const_set "YAML", Psych unless Object.const_defined?(:YAML)
1309
+
1310
+ if message.include?("YAML::Syck::")
1311
+ YAML.const_set "Syck", YAML unless YAML.const_defined?(:Syck)
1312
+
1313
+ YAML::Syck.const_set "DefaultKey", Class.new if message.include?("YAML::Syck::DefaultKey")
1314
+ elsif message.include?("YAML::PrivateType")
1315
+ YAML.const_set "PrivateType", Class.new
1316
+ end
1317
+
1318
+ retry
1319
+ end
1315
1320
 
1316
1321
  spec = Gem::Specification.new
1317
1322
  spec.instance_variable_set :@specification_version, array[1]
@@ -1319,22 +1324,17 @@ class Gem::Specification < Gem::BasicSpecification
1319
1324
  current_version = CURRENT_SPECIFICATION_VERSION
1320
1325
 
1321
1326
  field_count = if spec.specification_version > current_version
1322
- spec.instance_variable_set :@specification_version,
1323
- current_version
1324
- MARSHAL_FIELDS[current_version]
1325
- else
1326
- MARSHAL_FIELDS[spec.specification_version]
1327
- end
1327
+ spec.instance_variable_set :@specification_version,
1328
+ current_version
1329
+ MARSHAL_FIELDS[current_version]
1330
+ else
1331
+ MARSHAL_FIELDS[spec.specification_version]
1332
+ end
1328
1333
 
1329
1334
  if array.size < field_count
1330
1335
  raise TypeError, "invalid Gem::Specification format #{array.inspect}"
1331
1336
  end
1332
1337
 
1333
- # Cleanup any YAML::PrivateType. They only show up for an old bug
1334
- # where nil => null, so just convert them to nil based on the type.
1335
-
1336
- array.map! { |e| e.kind_of?(YAML::PrivateType) ? nil : e }
1337
-
1338
1338
  spec.instance_variable_set :@rubygems_version, array[0]
1339
1339
  # spec version
1340
1340
  spec.instance_variable_set :@name, array[2]
@@ -1390,7 +1390,7 @@ class Gem::Specification < Gem::BasicSpecification
1390
1390
  @required_rubygems_version,
1391
1391
  @original_platform,
1392
1392
  @dependencies,
1393
- '', # rubyforge_project
1393
+ "", # rubyforge_project
1394
1394
  @email,
1395
1395
  @authors,
1396
1396
  @description,
@@ -1398,7 +1398,7 @@ class Gem::Specification < Gem::BasicSpecification
1398
1398
  true, # has_rdoc
1399
1399
  @new_platform,
1400
1400
  @licenses,
1401
- @metadata
1401
+ @metadata,
1402
1402
  ]
1403
1403
  end
1404
1404
 
@@ -1446,7 +1446,11 @@ class Gem::Specification < Gem::BasicSpecification
1446
1446
  raise e
1447
1447
  end
1448
1448
 
1449
- specs = spec_dep.to_specs
1449
+ begin
1450
+ specs = spec_dep.to_specs
1451
+ rescue Gem::MissingSpecError => e
1452
+ raise Gem::MissingSpecError.new(e.name, e.requirement, "at: #{self.spec_file}")
1453
+ end
1450
1454
 
1451
1455
  if specs.size == 1
1452
1456
  specs.first.activate
@@ -1482,7 +1486,7 @@ class Gem::Specification < Gem::BasicSpecification
1482
1486
  self.summary = sanitize_string(summary)
1483
1487
  self.description = sanitize_string(description)
1484
1488
  self.post_install_message = sanitize_string(post_install_message)
1485
- self.authors = authors.collect { |a| sanitize_string(a) }
1489
+ self.authors = authors.collect {|a| sanitize_string(a) }
1486
1490
  end
1487
1491
 
1488
1492
  ##
@@ -1494,13 +1498,7 @@ class Gem::Specification < Gem::BasicSpecification
1494
1498
  # HACK the #to_s is in here because RSpec has an Array of Arrays of
1495
1499
  # Strings for authors. Need a way to disallow bad values on gemspec
1496
1500
  # generation. (Probably won't happen.)
1497
- string = string.to_s
1498
-
1499
- begin
1500
- Builder::XChar.encode string
1501
- rescue NameError, NoMethodError
1502
- string.to_xs
1503
- end
1501
+ string.to_s
1504
1502
  end
1505
1503
 
1506
1504
  ##
@@ -1511,7 +1509,7 @@ class Gem::Specification < Gem::BasicSpecification
1511
1509
  return nil if executables.nil?
1512
1510
 
1513
1511
  if @bindir
1514
- Array(executables).map { |e| File.join(@bindir, e) }
1512
+ Array(executables).map {|e| File.join(@bindir, e) }
1515
1513
  else
1516
1514
  executables
1517
1515
  end
@@ -1526,10 +1524,10 @@ class Gem::Specification < Gem::BasicSpecification
1526
1524
 
1527
1525
  def add_dependency_with_type(dependency, type, requirements)
1528
1526
  requirements = if requirements.empty?
1529
- Gem::Requirement.default
1530
- else
1531
- requirements.flatten
1532
- end
1527
+ Gem::Requirement.default
1528
+ else
1529
+ requirements.flatten
1530
+ end
1533
1531
 
1534
1532
  unless dependency.respond_to?(:name) &&
1535
1533
  dependency.respond_to?(:requirement)
@@ -1551,23 +1549,14 @@ class Gem::Specification < Gem::BasicSpecification
1551
1549
 
1552
1550
  paths = full_require_paths
1553
1551
 
1554
- # gem directories must come after -I and ENV['RUBYLIB']
1555
- insert_index = Gem.load_path_insert_index
1556
-
1557
- if insert_index
1558
- # gem directories must come after -I and ENV['RUBYLIB']
1559
- $LOAD_PATH.insert(insert_index, *paths)
1560
- else
1561
- # we are probably testing in core, -I and RUBYLIB don't apply
1562
- $LOAD_PATH.unshift(*paths)
1563
- end
1552
+ Gem.add_to_load_path(*paths)
1564
1553
  end
1565
1554
 
1566
1555
  ##
1567
1556
  # Singular reader for #authors. Returns the first author in the list
1568
1557
 
1569
1558
  def author
1570
- val = authors and val.first
1559
+ (val = authors) && val.first
1571
1560
  end
1572
1561
 
1573
1562
  ##
@@ -1586,7 +1575,7 @@ class Gem::Specification < Gem::BasicSpecification
1586
1575
  # a full path.
1587
1576
 
1588
1577
  def bin_dir
1589
- @bin_dir ||= File.join gem_dir, bindir # TODO: this is unfortunate
1578
+ @bin_dir ||= File.join gem_dir, bindir
1590
1579
  end
1591
1580
 
1592
1581
  ##
@@ -1602,7 +1591,7 @@ class Gem::Specification < Gem::BasicSpecification
1602
1591
  def build_args
1603
1592
  if File.exist? build_info_file
1604
1593
  build_info = File.readlines build_info_file
1605
- build_info = build_info.map { |x| x.strip }
1594
+ build_info = build_info.map {|x| x.strip }
1606
1595
  build_info.delete ""
1607
1596
  build_info
1608
1597
  else
@@ -1615,12 +1604,11 @@ class Gem::Specification < Gem::BasicSpecification
1615
1604
  # the gem.build_complete file is missing.
1616
1605
 
1617
1606
  def build_extensions # :nodoc:
1618
- return if default_gem?
1619
1607
  return if extensions.empty?
1620
- return if installed_by_version < Gem::Version.new('2.2.0.preview.2')
1608
+ return if default_gem?
1621
1609
  return if File.exist? gem_build_complete_path
1622
1610
  return if !File.writable?(base_dir)
1623
- return if !File.exist?(File.join(base_dir, 'extensions'))
1611
+ return if !File.exist?(File.join(base_dir, "extensions"))
1624
1612
 
1625
1613
  begin
1626
1614
  # We need to require things in $LOAD_PATH without looking for the
@@ -1628,9 +1616,9 @@ class Gem::Specification < Gem::BasicSpecification
1628
1616
  unresolved_deps = Gem::Specification.unresolved_deps.dup
1629
1617
  Gem::Specification.unresolved_deps.clear
1630
1618
 
1631
- require 'rubygems/config_file'
1632
- require 'rubygems/ext'
1633
- require 'rubygems/user_interaction'
1619
+ require_relative "config_file"
1620
+ require_relative "ext"
1621
+ require_relative "user_interaction"
1634
1622
 
1635
1623
  ui = Gem::SilentUI.new
1636
1624
  Gem::DefaultUserInteraction.use_ui ui do
@@ -1678,12 +1666,12 @@ class Gem::Specification < Gem::BasicSpecification
1678
1666
 
1679
1667
  def conflicts
1680
1668
  conflicts = {}
1681
- self.runtime_dependencies.each { |dep|
1669
+ self.runtime_dependencies.each do |dep|
1682
1670
  spec = Gem.loaded_specs[dep.name]
1683
- if spec and not spec.satisfies_requirement? dep
1671
+ if spec && !spec.satisfies_requirement?(dep)
1684
1672
  (conflicts[spec] ||= []) << dep
1685
1673
  end
1686
- }
1674
+ end
1687
1675
  env_req = Gem.env_requirement(name)
1688
1676
  (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version
1689
1677
  conflicts
@@ -1693,9 +1681,9 @@ class Gem::Specification < Gem::BasicSpecification
1693
1681
  # return true if there will be conflict when spec if loaded together with the list of specs.
1694
1682
 
1695
1683
  def conficts_when_loaded_with?(list_of_specs) # :nodoc:
1696
- result = list_of_specs.any? { |spec|
1697
- spec.dependencies.any? { |dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
1698
- }
1684
+ result = list_of_specs.any? do |spec|
1685
+ spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
1686
+ end
1699
1687
  result
1700
1688
  end
1701
1689
 
@@ -1704,14 +1692,14 @@ class Gem::Specification < Gem::BasicSpecification
1704
1692
 
1705
1693
  def has_conflicts?
1706
1694
  return true unless Gem.env_requirement(name).satisfied_by?(version)
1707
- self.dependencies.any? { |dep|
1695
+ self.dependencies.any? do |dep|
1708
1696
  if dep.runtime?
1709
1697
  spec = Gem.loaded_specs[dep.name]
1710
- spec and not spec.satisfies_requirement? dep
1698
+ spec && !spec.satisfies_requirement?(dep)
1711
1699
  else
1712
1700
  false
1713
1701
  end
1714
- }
1702
+ end
1715
1703
  end
1716
1704
 
1717
1705
  # The date this gem was created.
@@ -1723,12 +1711,12 @@ class Gem::Specification < Gem::BasicSpecification
1723
1711
  # https://reproducible-builds.org/specs/source-date-epoch/
1724
1712
 
1725
1713
  def date
1726
- @date ||= ENV["SOURCE_DATE_EPOCH"] ? Time.utc(*Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc.to_a[3..5].reverse) : TODAY
1714
+ @date ||= Time.utc(*Gem.source_date_epoch.utc.to_a[3..5].reverse)
1727
1715
  end
1728
1716
 
1729
1717
  DateLike = Object.new # :nodoc:
1730
1718
  def DateLike.===(obj) # :nodoc:
1731
- defined?(::Date) and Date === obj
1719
+ defined?(::Date) && Date === obj
1732
1720
  end
1733
1721
 
1734
1722
  DateTimeFormat = # :nodoc:
@@ -1747,24 +1735,18 @@ class Gem::Specification < Gem::BasicSpecification
1747
1735
  # This is the cleanest, most-readable, faster-than-using-Date
1748
1736
  # way to do it.
1749
1737
  @date = case date
1750
- when String then
1751
- if DateTimeFormat =~ date
1752
- Time.utc($1.to_i, $2.to_i, $3.to_i)
1753
-
1754
- # Workaround for where the date format output from psych isn't
1755
- # parsed as a Time object by syck and thus comes through as a
1756
- # string.
1757
- elsif /\A(\d{4})-(\d{2})-(\d{2}) \d{2}:\d{2}:\d{2}\.\d+?Z\z/ =~ date
1758
- Time.utc($1.to_i, $2.to_i, $3.to_i)
1759
- else
1760
- raise(Gem::InvalidSpecificationException,
1761
- "invalid date format in specification: #{date.inspect}")
1762
- end
1763
- when Time, DateLike then
1764
- Time.utc(date.year, date.month, date.day)
1765
- else
1766
- TODAY
1767
- end
1738
+ when String then
1739
+ if DateTimeFormat =~ date
1740
+ Time.utc($1.to_i, $2.to_i, $3.to_i)
1741
+ else
1742
+ raise(Gem::InvalidSpecificationException,
1743
+ "invalid date format in specification: #{date.inspect}")
1744
+ end
1745
+ when Time, DateLike then
1746
+ Time.utc(date.year, date.month, date.day)
1747
+ else
1748
+ TODAY
1749
+ end
1768
1750
  end
1769
1751
 
1770
1752
  ##
@@ -1774,16 +1756,16 @@ class Gem::Specification < Gem::BasicSpecification
1774
1756
  # executable now. See Gem.bin_path.
1775
1757
 
1776
1758
  def default_executable # :nodoc:
1777
- if defined?(@default_executable) and @default_executable
1759
+ if defined?(@default_executable) && @default_executable
1778
1760
  result = @default_executable
1779
- elsif @executables and @executables.size == 1
1761
+ elsif @executables && @executables.size == 1
1780
1762
  result = Array(@executables).first
1781
1763
  else
1782
1764
  result = nil
1783
1765
  end
1784
1766
  result
1785
1767
  end
1786
- deprecate :default_executable, :none, 2018, 12
1768
+ rubygems_deprecate :default_executable
1787
1769
 
1788
1770
  ##
1789
1771
  # The default value for specification attribute +name+
@@ -1808,10 +1790,11 @@ class Gem::Specification < Gem::BasicSpecification
1808
1790
  #
1809
1791
  # [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
1810
1792
 
1811
- def dependent_gems
1793
+ def dependent_gems(check_dev=true)
1812
1794
  out = []
1813
1795
  Gem::Specification.each do |spec|
1814
- spec.dependencies.each do |dep|
1796
+ deps = check_dev ? spec.dependencies : spec.runtime_dependencies
1797
+ deps.each do |dep|
1815
1798
  if self.satisfies_requirement?(dep)
1816
1799
  sats = []
1817
1800
  find_all_satisfiers(dep) do |sat|
@@ -1828,7 +1811,7 @@ class Gem::Specification < Gem::BasicSpecification
1828
1811
  # Returns all specs that matches this spec's runtime dependencies.
1829
1812
 
1830
1813
  def dependent_specs
1831
- runtime_dependencies.map { |dep| dep.to_specs }.flatten
1814
+ runtime_dependencies.map {|dep| dep.to_specs }.flatten
1832
1815
  end
1833
1816
 
1834
1817
  ##
@@ -1842,7 +1825,7 @@ class Gem::Specification < Gem::BasicSpecification
1842
1825
  # List of dependencies that are used for development
1843
1826
 
1844
1827
  def development_dependencies
1845
- dependencies.select { |d| d.type == :development }
1828
+ dependencies.select {|d| d.type == :development }
1846
1829
  end
1847
1830
 
1848
1831
  ##
@@ -1854,7 +1837,7 @@ class Gem::Specification < Gem::BasicSpecification
1854
1837
  # spec.doc_dir 'ri' # => "/path/to/gem_repo/doc/a-1/ri"
1855
1838
 
1856
1839
  def doc_dir(type = nil)
1857
- @doc_dir ||= File.join base_dir, 'doc', full_name
1840
+ @doc_dir ||= File.join base_dir, "doc", full_name
1858
1841
 
1859
1842
  if type
1860
1843
  File.join @doc_dir, type
@@ -1866,17 +1849,17 @@ class Gem::Specification < Gem::BasicSpecification
1866
1849
  def encode_with(coder) # :nodoc:
1867
1850
  mark_version
1868
1851
 
1869
- coder.add 'name', @name
1870
- coder.add 'version', @version
1852
+ coder.add "name", @name
1853
+ coder.add "version", @version
1871
1854
  platform = case @original_platform
1872
- when nil, '' then
1873
- 'ruby'
1874
- when String then
1875
- @original_platform
1876
- else
1877
- @original_platform.to_s
1878
- end
1879
- coder.add 'platform', platform
1855
+ when nil, "" then
1856
+ "ruby"
1857
+ when String then
1858
+ @original_platform
1859
+ else
1860
+ @original_platform.to_s
1861
+ end
1862
+ coder.add "platform", platform
1880
1863
 
1881
1864
  attributes = @@attributes.map(&:to_s) - %w[name version platform]
1882
1865
  attributes.each do |name|
@@ -1892,7 +1875,7 @@ class Gem::Specification < Gem::BasicSpecification
1892
1875
  # Singular accessor for #executables
1893
1876
 
1894
1877
  def executable
1895
- val = executables and val.first
1878
+ (val = executables) && val.first
1896
1879
  end
1897
1880
 
1898
1881
  ##
@@ -1903,29 +1886,23 @@ class Gem::Specification < Gem::BasicSpecification
1903
1886
  end
1904
1887
 
1905
1888
  ##
1906
- # Sets executables to +value+, ensuring it is an array. Don't
1907
- # use this, push onto the array instead.
1889
+ # Sets executables to +value+, ensuring it is an array.
1908
1890
 
1909
1891
  def executables=(value)
1910
- # TODO: warn about setting instead of pushing
1911
1892
  @executables = Array(value)
1912
1893
  end
1913
1894
 
1914
1895
  ##
1915
- # Sets extensions to +extensions+, ensuring it is an array. Don't
1916
- # use this, push onto the array instead.
1896
+ # Sets extensions to +extensions+, ensuring it is an array.
1917
1897
 
1918
1898
  def extensions=(extensions)
1919
- # TODO: warn about setting instead of pushing
1920
1899
  @extensions = Array extensions
1921
1900
  end
1922
1901
 
1923
1902
  ##
1924
- # Sets extra_rdoc_files to +files+, ensuring it is an array. Don't
1925
- # use this, push onto the array instead.
1903
+ # Sets extra_rdoc_files to +files+, ensuring it is an array.
1926
1904
 
1927
1905
  def extra_rdoc_files=(files)
1928
- # TODO: warn about setting instead of pushing
1929
1906
  @extra_rdoc_files = Array files
1930
1907
  end
1931
1908
 
@@ -1980,8 +1957,7 @@ class Gem::Specification < Gem::BasicSpecification
1980
1957
  end
1981
1958
 
1982
1959
  def gems_dir
1983
- # TODO: this logic seems terribly broken, but tests fail if just base_dir
1984
- @gems_dir ||= File.join(loaded_from && base_dir || Gem.dir, "gems")
1960
+ @gems_dir ||= File.join(base_dir, "gems")
1985
1961
  end
1986
1962
 
1987
1963
  ##
@@ -1992,7 +1968,7 @@ class Gem::Specification < Gem::BasicSpecification
1992
1968
  def has_rdoc # :nodoc:
1993
1969
  true
1994
1970
  end
1995
- deprecate :has_rdoc, :none, 2018, 12
1971
+ rubygems_deprecate :has_rdoc
1996
1972
 
1997
1973
  ##
1998
1974
  # Deprecated and ignored.
@@ -2002,16 +1978,16 @@ class Gem::Specification < Gem::BasicSpecification
2002
1978
  def has_rdoc=(ignored) # :nodoc:
2003
1979
  @has_rdoc = true
2004
1980
  end
2005
- deprecate :has_rdoc=, :none, 2018, 12
1981
+ rubygems_deprecate :has_rdoc=
2006
1982
 
2007
1983
  alias :has_rdoc? :has_rdoc # :nodoc:
2008
- deprecate :has_rdoc?, :none, 2018, 12
1984
+ rubygems_deprecate :has_rdoc?
2009
1985
 
2010
1986
  ##
2011
1987
  # True if this gem has files in test_files
2012
1988
 
2013
1989
  def has_unit_tests? # :nodoc:
2014
- not test_files.empty?
1990
+ !test_files.empty?
2015
1991
  end
2016
1992
 
2017
1993
  # :stopdoc:
@@ -2027,9 +2003,9 @@ class Gem::Specification < Gem::BasicSpecification
2027
2003
  yaml_initialize coder.tag, coder.map
2028
2004
  end
2029
2005
 
2006
+ eval <<-RUBY, binding, __FILE__, __LINE__ + 1
2007
+ # frozen_string_literal: true
2030
2008
 
2031
-
2032
- eval <<-RB, binding, __FILE__, __LINE__ + 1
2033
2009
  def set_nil_attributes_to_nil
2034
2010
  #{@@nil_attributes.map {|key| "@#{key} = nil" }.join "; "}
2035
2011
  end
@@ -2039,7 +2015,7 @@ class Gem::Specification < Gem::BasicSpecification
2039
2015
  #{@@non_nil_attributes.map {|key| "@#{key} = #{INITIALIZE_CODE_FOR_DEFAULTS[key]}" }.join ";"}
2040
2016
  end
2041
2017
  private :set_not_nil_attributes_to_default_values
2042
- RB
2018
+ RUBY
2043
2019
 
2044
2020
  ##
2045
2021
  # Specification constructor. Assigns the default values to the attributes
@@ -2064,6 +2040,10 @@ class Gem::Specification < Gem::BasicSpecification
2064
2040
  self.name = name if name
2065
2041
  self.version = version if version
2066
2042
 
2043
+ if (platform = Gem.platforms.last) && platform != Gem::Platform::RUBY && platform != Gem::Platform.local
2044
+ self.platform = platform
2045
+ end
2046
+
2067
2047
  yield self if block_given?
2068
2048
  end
2069
2049
 
@@ -2095,10 +2075,10 @@ class Gem::Specification < Gem::BasicSpecification
2095
2075
  def base_dir
2096
2076
  return Gem.dir unless loaded_from
2097
2077
  @base_dir ||= if default_gem?
2098
- File.dirname File.dirname File.dirname loaded_from
2099
- else
2100
- File.dirname File.dirname loaded_from
2101
- end
2078
+ File.dirname File.dirname File.dirname loaded_from
2079
+ else
2080
+ File.dirname File.dirname loaded_from
2081
+ end
2102
2082
  end
2103
2083
 
2104
2084
  ##
@@ -2166,11 +2146,17 @@ class Gem::Specification < Gem::BasicSpecification
2166
2146
  end
2167
2147
 
2168
2148
  ##
2149
+ # Track removed method calls to warn about during build time.
2169
2150
  # Warn about unknown attributes while loading a spec.
2170
2151
 
2171
2152
  def method_missing(sym, *a, &b) # :nodoc:
2172
- if @specification_version > CURRENT_SPECIFICATION_VERSION and
2173
- sym.to_s =~ /=$/
2153
+ if REMOVED_METHODS.include?(sym)
2154
+ removed_method_calls << sym
2155
+ return
2156
+ end
2157
+
2158
+ if @specification_version > CURRENT_SPECIFICATION_VERSION &&
2159
+ sym.to_s.end_with?("=")
2174
2160
  warn "ignoring #{sym} loading #{full_name}" if $DEBUG
2175
2161
  else
2176
2162
  super
@@ -2182,9 +2168,8 @@ class Gem::Specification < Gem::BasicSpecification
2182
2168
  # probably want to build_extensions
2183
2169
 
2184
2170
  def missing_extensions?
2185
- return false if default_gem?
2186
2171
  return false if extensions.empty?
2187
- return false if installed_by_version < Gem::Version.new('2.2.0.preview.2')
2172
+ return false if default_gem?
2188
2173
  return false if File.exist? gem_build_complete_path
2189
2174
 
2190
2175
  true
@@ -2197,7 +2182,7 @@ class Gem::Specification < Gem::BasicSpecification
2197
2182
  # file list.
2198
2183
 
2199
2184
  def normalize
2200
- if defined?(@extra_rdoc_files) and @extra_rdoc_files
2185
+ if defined?(@extra_rdoc_files) && @extra_rdoc_files
2201
2186
  @extra_rdoc_files.uniq!
2202
2187
  @files ||= []
2203
2188
  @files.concat(@extra_rdoc_files)
@@ -2222,7 +2207,7 @@ class Gem::Specification < Gem::BasicSpecification
2222
2207
  # platform. For use with legacy gems.
2223
2208
 
2224
2209
  def original_name # :nodoc:
2225
- if platform == Gem::Platform::RUBY or platform.nil?
2210
+ if platform == Gem::Platform::RUBY || platform.nil?
2226
2211
  "#{@name}-#{@version}"
2227
2212
  else
2228
2213
  "#{@name}-#{@version}-#{@original_platform}"
@@ -2244,7 +2229,7 @@ class Gem::Specification < Gem::BasicSpecification
2244
2229
  end
2245
2230
 
2246
2231
  def pretty_print(q) # :nodoc:
2247
- q.group 2, 'Gem::Specification.new do |s|', 'end' do
2232
+ q.group 2, "Gem::Specification.new do |s|", "end" do
2248
2233
  q.breakable
2249
2234
 
2250
2235
  attributes = @@attributes - [:name, :version]
@@ -2254,8 +2239,9 @@ class Gem::Specification < Gem::BasicSpecification
2254
2239
 
2255
2240
  attributes.each do |attr_name|
2256
2241
  current_value = self.send attr_name
2257
- if current_value != default_value(attr_name) or
2258
- self.class.required_attribute? attr_name
2242
+ current_value = current_value.sort if %i[files test_files].include? attr_name
2243
+ if current_value != default_value(attr_name) ||
2244
+ self.class.required_attribute?(attr_name)
2259
2245
 
2260
2246
  q.text "s.#{attr_name} = "
2261
2247
 
@@ -2287,7 +2273,6 @@ class Gem::Specification < Gem::BasicSpecification
2287
2273
 
2288
2274
  e = Gem::LoadError.new msg
2289
2275
  e.name = self.name
2290
- # TODO: e.requirement = dep.requirement
2291
2276
 
2292
2277
  raise e
2293
2278
  end
@@ -2304,11 +2289,9 @@ class Gem::Specification < Gem::BasicSpecification
2304
2289
  end
2305
2290
 
2306
2291
  ##
2307
- # Sets rdoc_options to +value+, ensuring it is an array. Don't
2308
- # use this, push onto the array instead.
2292
+ # Sets rdoc_options to +value+, ensuring it is an array.
2309
2293
 
2310
2294
  def rdoc_options=(options)
2311
- # TODO: warn about setting instead of pushing
2312
2295
  @rdoc_options = Array options
2313
2296
  end
2314
2297
 
@@ -2316,7 +2299,7 @@ class Gem::Specification < Gem::BasicSpecification
2316
2299
  # Singular accessor for #require_paths
2317
2300
 
2318
2301
  def require_path
2319
- val = require_paths and val.first
2302
+ (val = require_paths) && val.first
2320
2303
  end
2321
2304
 
2322
2305
  ##
@@ -2327,11 +2310,9 @@ class Gem::Specification < Gem::BasicSpecification
2327
2310
  end
2328
2311
 
2329
2312
  ##
2330
- # Set requirements to +req+, ensuring it is an array. Don't
2331
- # use this, push onto the array instead.
2313
+ # Set requirements to +req+, ensuring it is an array.
2332
2314
 
2333
2315
  def requirements=(req)
2334
- # TODO: warn about setting instead of pushing
2335
2316
  @requirements = Array req
2336
2317
  end
2337
2318
 
@@ -2343,7 +2324,7 @@ class Gem::Specification < Gem::BasicSpecification
2343
2324
  # Returns the full path to this spec's ri directory.
2344
2325
 
2345
2326
  def ri_dir
2346
- @ri_dir ||= File.join base_dir, 'ri', full_name
2327
+ @ri_dir ||= File.join base_dir, "ri", full_name
2347
2328
  end
2348
2329
 
2349
2330
  ##
@@ -2352,18 +2333,18 @@ class Gem::Specification < Gem::BasicSpecification
2352
2333
 
2353
2334
  def ruby_code(obj)
2354
2335
  case obj
2355
- when String then obj.dump + ".freeze"
2356
- when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
2357
- when Hash then
2358
- seg = obj.keys.sort.map { |k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
2336
+ when String then obj.dump + ".freeze"
2337
+ when Array then "[" + obj.map {|x| ruby_code x }.join(", ") + "]"
2338
+ when Hash then
2339
+ seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
2359
2340
  "{ #{seg.join(', ')} }"
2360
- when Gem::Version then obj.to_s.dump
2361
- when DateLike then obj.strftime('%Y-%m-%d').dump
2362
- when Time then obj.strftime('%Y-%m-%d').dump
2363
- when Numeric then obj.inspect
2364
- when true, false, nil then obj.inspect
2365
- when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
2366
- when Gem::Requirement then
2341
+ when Gem::Version then obj.to_s.dump
2342
+ when DateLike then obj.strftime("%Y-%m-%d").dump
2343
+ when Time then obj.strftime("%Y-%m-%d").dump
2344
+ when Numeric then obj.inspect
2345
+ when true, false, nil then obj.inspect
2346
+ when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
2347
+ when Gem::Requirement then
2367
2348
  list = obj.as_list
2368
2349
  "Gem::Requirement.new(#{ruby_code(list.size == 1 ? obj.to_s : list)})"
2369
2350
  else raise Gem::Exception, "ruby_code case not handled: #{obj.class}"
@@ -2383,7 +2364,7 @@ class Gem::Specification < Gem::BasicSpecification
2383
2364
  # True if this gem has the same attributes as +other+.
2384
2365
 
2385
2366
  def same_attributes?(spec)
2386
- @@attributes.all? { |name, default| self.send(name) == spec.send(name) }
2367
+ @@attributes.all? {|name, default| self.send(name) == spec.send(name) }
2387
2368
  end
2388
2369
 
2389
2370
  private :same_attributes?
@@ -2393,14 +2374,14 @@ class Gem::Specification < Gem::BasicSpecification
2393
2374
 
2394
2375
  def satisfies_requirement?(dependency)
2395
2376
  return @name == dependency.name &&
2396
- dependency.requirement.satisfied_by?(@version)
2377
+ dependency.requirement.satisfied_by?(@version)
2397
2378
  end
2398
2379
 
2399
2380
  ##
2400
2381
  # Returns an object you can use to sort specifications in #sort_by.
2401
2382
 
2402
2383
  def sort_obj
2403
- [@name, @version, @new_platform == Gem::Platform::RUBY ? -1 : 1]
2384
+ [@name, @version, Gem::Platform.sort_priority(@new_platform)]
2404
2385
  end
2405
2386
 
2406
2387
  ##
@@ -2447,7 +2428,7 @@ class Gem::Specification < Gem::BasicSpecification
2447
2428
  # Singular accessor for #test_files
2448
2429
 
2449
2430
  def test_file # :nodoc:
2450
- val = test_files and val.first
2431
+ (val = test_files) && val.first
2451
2432
  end
2452
2433
 
2453
2434
  ##
@@ -2469,7 +2450,7 @@ class Gem::Specification < Gem::BasicSpecification
2469
2450
  @test_files = [@test_suite_file].flatten
2470
2451
  @test_suite_file = nil
2471
2452
  end
2472
- if defined?(@test_files) and @test_files
2453
+ if defined?(@test_files) && @test_files
2473
2454
  @test_files
2474
2455
  else
2475
2456
  @test_files = []
@@ -2493,13 +2474,13 @@ class Gem::Specification < Gem::BasicSpecification
2493
2474
 
2494
2475
  result << " s.name = #{ruby_code name}"
2495
2476
  result << " s.version = #{ruby_code version}"
2496
- unless platform.nil? or platform == Gem::Platform::RUBY
2477
+ unless platform.nil? || platform == Gem::Platform::RUBY
2497
2478
  result << " s.platform = #{ruby_code original_platform}"
2498
2479
  end
2499
2480
  result << ""
2500
2481
  result << " s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version="
2501
2482
 
2502
- if metadata and !metadata.empty?
2483
+ if metadata && !metadata.empty?
2503
2484
  result << " s.metadata = #{ruby_code metadata} if s.respond_to? :metadata="
2504
2485
  end
2505
2486
  result << " s.require_paths = #{ruby_code raw_require_paths}"
@@ -2514,18 +2495,22 @@ class Gem::Specification < Gem::BasicSpecification
2514
2495
  :version,
2515
2496
  :has_rdoc,
2516
2497
  :default_executable,
2517
- :metadata
2498
+ :metadata,
2499
+ :signing_key,
2518
2500
  ]
2519
2501
 
2520
2502
  @@attributes.each do |attr_name|
2521
2503
  next if handled.include? attr_name
2522
2504
  current_value = self.send(attr_name)
2523
- if current_value != default_value(attr_name) or
2524
- self.class.required_attribute? attr_name
2505
+ if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name)
2525
2506
  result << " s.#{attr_name} = #{ruby_code current_value}"
2526
2507
  end
2527
2508
  end
2528
2509
 
2510
+ if String === signing_key
2511
+ result << " s.signing_key = #{signing_key.dump}.freeze"
2512
+ end
2513
+
2529
2514
  if @installed_by_version
2530
2515
  result << nil
2531
2516
  result << " s.installed_by_version = \"#{Gem::VERSION}\" if s.respond_to? :installed_by_version"
@@ -2533,33 +2518,14 @@ class Gem::Specification < Gem::BasicSpecification
2533
2518
 
2534
2519
  unless dependencies.empty?
2535
2520
  result << nil
2536
- result << " if s.respond_to? :specification_version then"
2537
- result << " s.specification_version = #{specification_version}"
2521
+ result << " s.specification_version = #{specification_version}"
2538
2522
  result << nil
2539
2523
 
2540
- result << " if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then"
2541
-
2542
2524
  dependencies.each do |dep|
2543
2525
  req = dep.requirements_list.inspect
2544
2526
  dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
2545
- result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
2546
- end
2547
-
2548
- result << " else"
2549
-
2550
- dependencies.each do |dep|
2551
- version_reqs_param = dep.requirements_list.inspect
2552
- result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
2527
+ result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>.freeze, #{req})"
2553
2528
  end
2554
-
2555
- result << ' end'
2556
-
2557
- result << " else"
2558
- dependencies.each do |dep|
2559
- version_reqs_param = dep.requirements_list.inspect
2560
- result << " s.add_dependency(%q<#{dep.name}>.freeze, #{version_reqs_param})"
2561
- end
2562
- result << " end"
2563
2529
  end
2564
2530
 
2565
2531
  result << "end"
@@ -2590,17 +2556,20 @@ class Gem::Specification < Gem::BasicSpecification
2590
2556
  end
2591
2557
 
2592
2558
  def to_yaml(opts = {}) # :nodoc:
2559
+ Gem.load_yaml
2560
+
2593
2561
  # Because the user can switch the YAML engine behind our
2594
2562
  # back, we have to check again here to make sure that our
2595
2563
  # psych code was properly loaded, and load it if not.
2596
2564
  unless Gem.const_defined?(:NoAliasYAMLTree)
2597
- require 'rubygems/psych_tree'
2565
+ require_relative "psych_tree"
2598
2566
  end
2599
2567
 
2600
2568
  builder = Gem::NoAliasYAMLTree.create
2601
2569
  builder << self
2602
2570
  ast = builder.tree
2603
2571
 
2572
+ require "stringio"
2604
2573
  io = StringIO.new
2605
2574
  io.set_encoding Encoding::UTF_8
2606
2575
 
@@ -2618,7 +2587,7 @@ class Gem::Specification < Gem::BasicSpecification
2618
2587
  begin
2619
2588
  dependencies.each do |dep|
2620
2589
  next unless dep.runtime?
2621
- dep.to_specs.each do |dep_spec|
2590
+ dep.matching_specs(true).each do |dep_spec|
2622
2591
  next if visited.has_key?(dep_spec)
2623
2592
  visited[dep_spec] = true
2624
2593
  trail.push(dep_spec)
@@ -2630,7 +2599,7 @@ class Gem::Specification < Gem::BasicSpecification
2630
2599
  unless result == :next
2631
2600
  spec_name = dep_spec.name
2632
2601
  dep_spec.traverse(trail, visited, &block) unless
2633
- trail.any? { |s| s.name == spec_name }
2602
+ trail.any? {|s| s.name == spec_name }
2634
2603
  end
2635
2604
  end
2636
2605
  end
@@ -2647,8 +2616,6 @@ class Gem::Specification < Gem::BasicSpecification
2647
2616
  # checks..
2648
2617
 
2649
2618
  def validate(packaging = true, strict = false)
2650
- require 'rubygems/user_interaction'
2651
- extend Gem::UserInteraction
2652
2619
  normalize
2653
2620
 
2654
2621
  validation_policy = Gem::SpecificationPolicy.new(self)
@@ -2657,30 +2624,27 @@ class Gem::Specification < Gem::BasicSpecification
2657
2624
  end
2658
2625
 
2659
2626
  def keep_only_files_and_directories
2660
- @executables.delete_if { |x| File.directory?(File.join(@bindir, x)) }
2661
- @extensions.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
2662
- @extra_rdoc_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
2663
- @files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
2664
- @test_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
2627
+ @executables.delete_if {|x| File.directory?(File.join(@bindir, x)) }
2628
+ @extensions.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
2629
+ @extra_rdoc_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
2630
+ @files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
2631
+ @test_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
2665
2632
  end
2666
2633
 
2667
2634
  def validate_metadata
2668
2635
  Gem::SpecificationPolicy.new(self).validate_metadata
2669
2636
  end
2637
+ rubygems_deprecate :validate_metadata
2670
2638
 
2671
- ##
2672
- # Checks that dependencies use requirements as we recommend. Warnings are
2673
- # issued when dependencies are open-ended or overly strict for semantic
2674
- # versioning.
2675
2639
  def validate_dependencies
2676
2640
  Gem::SpecificationPolicy.new(self).validate_dependencies
2677
2641
  end
2642
+ rubygems_deprecate :validate_dependencies
2678
2643
 
2679
- ##
2680
- # Checks to see if the files to be packaged are world-readable.
2681
2644
  def validate_permissions
2682
2645
  Gem::SpecificationPolicy.new(self).validate_permissions
2683
2646
  end
2647
+ rubygems_deprecate :validate_permissions
2684
2648
 
2685
2649
  ##
2686
2650
  # Set the version to +version+, potentially also setting
@@ -2689,10 +2653,12 @@ class Gem::Specification < Gem::BasicSpecification
2689
2653
 
2690
2654
  def version=(version)
2691
2655
  @version = Gem::Version.create(version)
2656
+ return if @version.nil?
2657
+
2692
2658
  # skip to set required_ruby_version when pre-released rubygems.
2693
2659
  # It caused to raise CircularDependencyError
2694
2660
  if @version.prerelease? && (@name.nil? || @name.strip != "rubygems")
2695
- self.required_rubygems_version = '> 1.3.1'
2661
+ self.required_rubygems_version = "> 1.3.1"
2696
2662
  end
2697
2663
  invalidate_memoized_attributes
2698
2664
 
@@ -2708,9 +2674,9 @@ class Gem::Specification < Gem::BasicSpecification
2708
2674
  case ivar
2709
2675
  when "date"
2710
2676
  # Force Date to go through the extra coerce logic in date=
2711
- self.date = val.untaint
2677
+ self.date = val.tap(&Gem::UNTAINT)
2712
2678
  else
2713
- instance_variable_set "@#{ivar}", val.untaint
2679
+ instance_variable_set "@#{ivar}", val.tap(&Gem::UNTAINT)
2714
2680
  end
2715
2681
  end
2716
2682
 
@@ -2730,9 +2696,9 @@ class Gem::Specification < Gem::BasicSpecification
2730
2696
  default = self.default_value attribute
2731
2697
 
2732
2698
  value = case default
2733
- when Time, Numeric, Symbol, true, false, nil then default
2734
- else default.dup
2735
- end
2699
+ when Time, Numeric, Symbol, true, false, nil then default
2700
+ else default.dup
2701
+ end
2736
2702
 
2737
2703
  instance_variable_set "@#{attribute}", value
2738
2704
  end
@@ -2740,11 +2706,14 @@ class Gem::Specification < Gem::BasicSpecification
2740
2706
  @installed_by_version ||= nil
2741
2707
  end
2742
2708
 
2709
+ def flatten_require_paths # :nodoc:
2710
+ return unless raw_require_paths.first.is_a?(Array)
2711
+
2712
+ warn "#{name} #{version} includes a gemspec with `require_paths` set to an array of arrays. Newer versions of this gem might've already fixed this"
2713
+ raw_require_paths.flatten!
2714
+ end
2715
+
2743
2716
  def raw_require_paths # :nodoc:
2744
2717
  @require_paths
2745
2718
  end
2746
-
2747
2719
  end
2748
-
2749
- # DOC: What is this and why is it here, randomly, at the end of this file?
2750
- Gem.clear_paths