bundler 2.2.27 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (353) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1328 -4
  3. data/README.md +4 -8
  4. data/bundler.gemspec +11 -11
  5. data/exe/bundle +5 -26
  6. data/exe/bundler +1 -1
  7. data/lib/bundler/.document +1 -0
  8. data/lib/bundler/build_metadata.rb +4 -4
  9. data/lib/bundler/capistrano.rb +1 -1
  10. data/lib/bundler/checksum.rb +254 -0
  11. data/lib/bundler/ci_detector.rb +75 -0
  12. data/lib/bundler/cli/add.rb +7 -5
  13. data/lib/bundler/cli/binstubs.rb +10 -6
  14. data/lib/bundler/cli/cache.rb +1 -1
  15. data/lib/bundler/cli/check.rb +4 -4
  16. data/lib/bundler/cli/common.rb +13 -3
  17. data/lib/bundler/cli/config.rb +18 -8
  18. data/lib/bundler/cli/console.rb +2 -5
  19. data/lib/bundler/cli/doctor.rb +16 -9
  20. data/lib/bundler/cli/exec.rb +2 -1
  21. data/lib/bundler/cli/fund.rb +1 -1
  22. data/lib/bundler/cli/gem.rb +153 -40
  23. data/lib/bundler/cli/info.rb +27 -17
  24. data/lib/bundler/cli/init.rb +6 -2
  25. data/lib/bundler/cli/inject.rb +1 -1
  26. data/lib/bundler/cli/install.rb +34 -42
  27. data/lib/bundler/cli/issue.rb +5 -4
  28. data/lib/bundler/cli/lock.rb +54 -28
  29. data/lib/bundler/cli/open.rb +9 -9
  30. data/lib/bundler/cli/outdated.rb +34 -29
  31. data/lib/bundler/cli/platform.rb +8 -6
  32. data/lib/bundler/cli/plugin.rb +9 -15
  33. data/lib/bundler/cli/pristine.rb +38 -30
  34. data/lib/bundler/cli/remove.rb +1 -2
  35. data/lib/bundler/cli/show.rb +5 -5
  36. data/lib/bundler/cli/update.rb +12 -7
  37. data/lib/bundler/cli/viz.rb +1 -1
  38. data/lib/bundler/cli.rb +265 -313
  39. data/lib/bundler/compact_index_client/cache.rb +53 -67
  40. data/lib/bundler/compact_index_client/cache_file.rb +148 -0
  41. data/lib/bundler/compact_index_client/gem_parser.rb +7 -3
  42. data/lib/bundler/compact_index_client/parser.rb +84 -0
  43. data/lib/bundler/compact_index_client/updater.rb +73 -77
  44. data/lib/bundler/compact_index_client.rb +59 -87
  45. data/lib/bundler/constants.rb +9 -2
  46. data/lib/bundler/current_ruby.rb +12 -16
  47. data/lib/bundler/definition.rb +604 -347
  48. data/lib/bundler/dependency.rb +33 -71
  49. data/lib/bundler/digest.rb +71 -0
  50. data/lib/bundler/dsl.rb +136 -102
  51. data/lib/bundler/endpoint_specification.rb +42 -16
  52. data/lib/bundler/env.rb +5 -7
  53. data/lib/bundler/environment_preserver.rb +8 -22
  54. data/lib/bundler/errors.rb +113 -13
  55. data/lib/bundler/feature_flag.rb +1 -2
  56. data/lib/bundler/fetcher/base.rb +11 -11
  57. data/lib/bundler/fetcher/compact_index.rb +32 -52
  58. data/lib/bundler/fetcher/dependency.rb +3 -7
  59. data/lib/bundler/fetcher/downloader.rb +17 -16
  60. data/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
  61. data/lib/bundler/fetcher/index.rb +2 -29
  62. data/lib/bundler/fetcher.rb +98 -83
  63. data/lib/bundler/force_platform.rb +16 -0
  64. data/lib/bundler/friendly_errors.rb +29 -40
  65. data/lib/bundler/gem_helper.rb +12 -24
  66. data/lib/bundler/gem_helpers.rb +47 -7
  67. data/lib/bundler/gem_version_promoter.rb +68 -109
  68. data/lib/bundler/graph.rb +9 -9
  69. data/lib/bundler/index.rb +71 -79
  70. data/lib/bundler/injector.rb +25 -13
  71. data/lib/bundler/inline.rb +41 -28
  72. data/lib/bundler/installer/gem_installer.rb +22 -13
  73. data/lib/bundler/installer/parallel_installer.rb +19 -66
  74. data/lib/bundler/installer/standalone.rb +58 -17
  75. data/lib/bundler/installer.rb +31 -93
  76. data/lib/bundler/lazy_specification.rb +151 -72
  77. data/lib/bundler/lockfile_generator.rb +13 -4
  78. data/lib/bundler/lockfile_parser.rb +146 -71
  79. data/lib/bundler/man/bundle-add.1 +54 -44
  80. data/lib/bundler/man/bundle-add.1.ronn +62 -21
  81. data/lib/bundler/man/bundle-binstubs.1 +10 -19
  82. data/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
  83. data/lib/bundler/man/bundle-cache.1 +38 -25
  84. data/lib/bundler/man/bundle-cache.1.ronn +40 -4
  85. data/lib/bundler/man/bundle-check.1 +7 -14
  86. data/lib/bundler/man/bundle-check.1.ronn +7 -2
  87. data/lib/bundler/man/bundle-clean.1 +4 -11
  88. data/lib/bundler/man/bundle-clean.1.ronn +1 -1
  89. data/lib/bundler/man/bundle-config.1 +48 -227
  90. data/lib/bundler/man/bundle-config.1.ronn +41 -34
  91. data/lib/bundler/man/bundle-console.1 +33 -0
  92. data/lib/bundler/man/bundle-console.1.ronn +39 -0
  93. data/lib/bundler/man/bundle-doctor.1 +5 -19
  94. data/lib/bundler/man/bundle-doctor.1.ronn +1 -1
  95. data/lib/bundler/man/bundle-env.1 +9 -0
  96. data/lib/bundler/man/bundle-env.1.ronn +10 -0
  97. data/lib/bundler/man/bundle-exec.1 +20 -78
  98. data/lib/bundler/man/bundle-exec.1.ronn +12 -10
  99. data/lib/bundler/man/bundle-fund.1 +22 -0
  100. data/lib/bundler/man/bundle-fund.1.ronn +25 -0
  101. data/lib/bundler/man/bundle-gem.1 +57 -72
  102. data/lib/bundler/man/bundle-gem.1.ronn +57 -9
  103. data/lib/bundler/man/bundle-help.1 +9 -0
  104. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  105. data/lib/bundler/man/bundle-info.1 +8 -11
  106. data/lib/bundler/man/bundle-info.1.ronn +9 -5
  107. data/lib/bundler/man/bundle-init.1 +7 -12
  108. data/lib/bundler/man/bundle-init.1.ronn +4 -1
  109. data/lib/bundler/man/bundle-inject.1 +17 -19
  110. data/lib/bundler/man/bundle-inject.1.ronn +12 -2
  111. data/lib/bundler/man/bundle-install.1 +43 -163
  112. data/lib/bundler/man/bundle-install.1.ronn +33 -51
  113. data/lib/bundler/man/bundle-issue.1 +45 -0
  114. data/lib/bundler/man/bundle-issue.1.ronn +37 -0
  115. data/lib/bundler/man/bundle-licenses.1 +9 -0
  116. data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  117. data/lib/bundler/man/bundle-list.1 +4 -19
  118. data/lib/bundler/man/bundle-list.1.ronn +4 -1
  119. data/lib/bundler/man/bundle-lock.1 +25 -34
  120. data/lib/bundler/man/bundle-lock.1.ronn +25 -4
  121. data/lib/bundler/man/bundle-open.1 +18 -18
  122. data/lib/bundler/man/bundle-open.1.ronn +10 -1
  123. data/lib/bundler/man/bundle-outdated.1 +23 -75
  124. data/lib/bundler/man/bundle-outdated.1.ronn +21 -22
  125. data/lib/bundler/man/bundle-platform.1 +16 -28
  126. data/lib/bundler/man/bundle-platform.1.ronn +14 -7
  127. data/lib/bundler/man/bundle-plugin.1 +58 -0
  128. data/lib/bundler/man/bundle-plugin.1.ronn +63 -0
  129. data/lib/bundler/man/bundle-pristine.1 +5 -16
  130. data/lib/bundler/man/bundle-pristine.1.ronn +1 -1
  131. data/lib/bundler/man/bundle-remove.1 +4 -14
  132. data/lib/bundler/man/bundle-remove.1.ronn +1 -1
  133. data/lib/bundler/man/bundle-show.1 +7 -11
  134. data/lib/bundler/man/bundle-show.1.ronn +4 -0
  135. data/lib/bundler/man/bundle-update.1 +31 -144
  136. data/lib/bundler/man/bundle-update.1.ronn +16 -7
  137. data/lib/bundler/man/bundle-version.1 +22 -0
  138. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  139. data/lib/bundler/man/bundle-viz.1 +9 -18
  140. data/lib/bundler/man/bundle-viz.1.ronn +9 -3
  141. data/lib/bundler/man/bundle.1 +17 -51
  142. data/lib/bundler/man/bundle.1.ronn +12 -7
  143. data/lib/bundler/man/gemfile.5 +132 -346
  144. data/lib/bundler/man/gemfile.5.ronn +127 -86
  145. data/lib/bundler/man/index.txt +8 -0
  146. data/lib/bundler/match_metadata.rb +17 -0
  147. data/lib/bundler/match_platform.rb +1 -2
  148. data/lib/bundler/match_remote_metadata.rb +29 -0
  149. data/lib/bundler/materialization.rb +59 -0
  150. data/lib/bundler/mirror.rb +8 -10
  151. data/lib/bundler/plugin/api/source.rb +11 -14
  152. data/lib/bundler/plugin/events.rb +24 -0
  153. data/lib/bundler/plugin/index.rb +13 -5
  154. data/lib/bundler/plugin/installer/git.rb +0 -4
  155. data/lib/bundler/plugin/installer/path.rb +18 -0
  156. data/lib/bundler/plugin/installer/rubygems.rb +0 -8
  157. data/lib/bundler/plugin/installer.rb +43 -20
  158. data/lib/bundler/plugin/source_list.rb +4 -4
  159. data/lib/bundler/plugin.rb +35 -7
  160. data/lib/bundler/process_lock.rb +10 -14
  161. data/lib/bundler/remote_specification.rb +17 -6
  162. data/lib/bundler/resolver/base.rb +117 -0
  163. data/lib/bundler/resolver/candidate.rb +82 -0
  164. data/lib/bundler/resolver/incompatibility.rb +15 -0
  165. data/lib/bundler/resolver/package.rb +90 -0
  166. data/lib/bundler/resolver/root.rb +25 -0
  167. data/lib/bundler/resolver/spec_group.rb +54 -66
  168. data/lib/bundler/resolver.rb +440 -306
  169. data/lib/bundler/retry.rb +2 -2
  170. data/lib/bundler/ruby_dsl.rb +42 -7
  171. data/lib/bundler/ruby_version.rb +22 -22
  172. data/lib/bundler/rubygems_ext.rb +323 -84
  173. data/lib/bundler/rubygems_gem_installer.rb +93 -65
  174. data/lib/bundler/rubygems_integration.rb +89 -237
  175. data/lib/bundler/runtime.rb +30 -20
  176. data/lib/bundler/safe_marshal.rb +31 -0
  177. data/lib/bundler/self_manager.rb +205 -0
  178. data/lib/bundler/settings.rb +145 -58
  179. data/lib/bundler/setup.rb +13 -1
  180. data/lib/bundler/shared_helpers.rb +94 -51
  181. data/lib/bundler/source/git/git_proxy.rb +283 -82
  182. data/lib/bundler/source/git.rb +187 -78
  183. data/lib/bundler/source/metadata.rb +16 -16
  184. data/lib/bundler/source/path/installer.rb +1 -22
  185. data/lib/bundler/source/path.rb +17 -27
  186. data/lib/bundler/source/rubygems/remote.rb +1 -1
  187. data/lib/bundler/source/rubygems.rb +165 -245
  188. data/lib/bundler/source/rubygems_aggregate.rb +1 -1
  189. data/lib/bundler/source.rb +7 -6
  190. data/lib/bundler/source_list.rb +41 -33
  191. data/lib/bundler/source_map.rb +15 -2
  192. data/lib/bundler/spec_set.rb +193 -58
  193. data/lib/bundler/stub_specification.rb +39 -7
  194. data/lib/bundler/templates/Executable +3 -5
  195. data/lib/bundler/templates/Executable.bundler +7 -12
  196. data/lib/bundler/templates/Executable.standalone +4 -4
  197. data/lib/bundler/templates/Gemfile +0 -2
  198. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
  199. data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  200. data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
  201. data/lib/bundler/templates/newgem/README.md.tt +12 -12
  202. data/lib/bundler/templates/newgem/Rakefile.tt +28 -4
  203. data/lib/bundler/templates/newgem/bin/console.tt +0 -4
  204. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  205. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  206. data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
  207. data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  208. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
  209. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  210. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +20 -10
  211. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  212. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
  213. data/lib/bundler/templates/newgem/newgem.gemspec.tt +26 -18
  214. data/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
  215. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  216. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  217. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  218. data/lib/bundler/ui/rg_proxy.rb +1 -1
  219. data/lib/bundler/ui/shell.rb +61 -16
  220. data/lib/bundler/ui/silent.rb +33 -6
  221. data/lib/bundler/uri_credentials_filter.rb +3 -3
  222. data/lib/bundler/uri_normalizer.rb +23 -0
  223. data/lib/bundler/vendor/.document +1 -0
  224. data/lib/bundler/vendor/connection_pool/.document +1 -0
  225. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  226. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  227. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  228. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
  229. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +92 -78
  230. data/lib/bundler/vendor/fileutils/.document +1 -0
  231. data/lib/bundler/vendor/fileutils/COPYING +56 -0
  232. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -418
  233. data/lib/bundler/vendor/net-http-persistent/.document +1 -0
  234. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  235. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +4 -3
  236. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +23 -11
  237. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +1 -1
  238. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +102 -64
  239. data/lib/bundler/vendor/pub_grub/.document +1 -0
  240. data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  241. data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  242. data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  243. data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  244. data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
  245. data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  246. data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  247. data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  248. data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  249. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +61 -0
  250. data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  251. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  252. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
  253. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
  254. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
  255. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  256. data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  257. data/lib/bundler/vendor/securerandom/.document +1 -0
  258. data/lib/bundler/vendor/securerandom/COPYING +56 -0
  259. data/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
  260. data/lib/bundler/vendor/thor/.document +1 -0
  261. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  262. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +3 -2
  263. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +1 -1
  264. data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +1 -1
  265. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +15 -19
  266. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +16 -6
  267. data/lib/bundler/vendor/thor/lib/thor/actions.rb +21 -17
  268. data/lib/bundler/vendor/thor/lib/thor/base.rb +140 -14
  269. data/lib/bundler/vendor/thor/lib/thor/command.rb +13 -4
  270. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +10 -0
  271. data/lib/bundler/vendor/thor/lib/thor/error.rb +16 -20
  272. data/lib/bundler/vendor/thor/lib/thor/group.rb +12 -1
  273. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -1
  274. data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +2 -2
  275. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +17 -1
  276. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +33 -17
  277. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +28 -9
  278. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +65 -8
  279. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +2 -2
  280. data/lib/bundler/vendor/thor/lib/thor/runner.rb +40 -30
  281. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +56 -162
  282. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -46
  283. data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
  284. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -46
  285. data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +118 -0
  286. data/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
  287. data/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
  288. data/lib/bundler/vendor/thor/lib/thor/shell.rb +2 -2
  289. data/lib/bundler/vendor/thor/lib/thor/util.rb +9 -8
  290. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  291. data/lib/bundler/vendor/thor/lib/thor.rb +166 -8
  292. data/lib/bundler/vendor/tsort/.document +1 -0
  293. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  294. data/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
  295. data/lib/bundler/vendor/uri/.document +1 -0
  296. data/lib/bundler/vendor/uri/COPYING +56 -0
  297. data/lib/bundler/vendor/uri/lib/uri/common.rb +351 -219
  298. data/lib/bundler/vendor/uri/lib/uri/file.rb +10 -4
  299. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +3 -3
  300. data/lib/bundler/vendor/uri/lib/uri/generic.rb +49 -39
  301. data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
  302. data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
  303. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
  304. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  305. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
  306. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +26 -26
  307. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +131 -50
  308. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  309. data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  310. data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  311. data/lib/bundler/vendor/uri/lib/uri.rb +12 -12
  312. data/lib/bundler/vendored_net_http.rb +23 -0
  313. data/lib/bundler/vendored_persistent.rb +0 -36
  314. data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
  315. data/lib/bundler/vendored_securerandom.rb +12 -0
  316. data/lib/bundler/vendored_timeout.rb +12 -0
  317. data/lib/bundler/{vendored_tmpdir.rb → vendored_tsort.rb} +1 -1
  318. data/lib/bundler/vendored_uri.rb +18 -1
  319. data/lib/bundler/version.rb +5 -1
  320. data/lib/bundler/vlad.rb +1 -1
  321. data/lib/bundler/worker.rb +7 -9
  322. data/lib/bundler/yaml_serializer.rb +22 -13
  323. data/lib/bundler.rb +176 -151
  324. metadata +98 -41
  325. data/lib/bundler/dep_proxy.rb +0 -55
  326. data/lib/bundler/gemdeps.rb +0 -29
  327. data/lib/bundler/psyched_yaml.rb +0 -22
  328. data/lib/bundler/templates/gems.rb +0 -8
  329. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -5
  330. data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  331. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
  332. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  333. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
  334. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  335. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  336. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  337. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  338. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  339. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  340. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  341. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  342. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
  343. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
  344. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
  345. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  346. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
  347. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  348. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
  349. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  350. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  351. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
  352. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
  353. data/lib/bundler/version_ranges.rb +0 -122
data/lib/bundler/retry.rb CHANGED
@@ -50,13 +50,13 @@ module Bundler
50
50
  end
51
51
  return true unless name
52
52
  Bundler.ui.info "" unless Bundler.ui.debug? # Add new line in case dots preceded this
53
- Bundler.ui.warn "Retrying #{name} due to error (#{current_run.next}/#{total_runs}): #{e.class} #{e.message}", Bundler.ui.debug?
53
+ Bundler.ui.warn "Retrying #{name} due to error (#{current_run.next}/#{total_runs}): #{e.class} #{e.message}", true
54
54
  end
55
55
 
56
56
  def keep_trying?
57
57
  return true if current_run.zero?
58
58
  return false if last_attempt?
59
- return true if @failed
59
+ true if @failed
60
60
  end
61
61
 
62
62
  def last_attempt?
@@ -3,16 +3,51 @@
3
3
  module Bundler
4
4
  module RubyDsl
5
5
  def ruby(*ruby_version)
6
- options = ruby_version.last.is_a?(Hash) ? ruby_version.pop : {}
6
+ options = ruby_version.pop if ruby_version.last.is_a?(Hash)
7
7
  ruby_version.flatten!
8
- raise GemfileError, "Please define :engine_version" if options[:engine] && options[:engine_version].nil?
9
- raise GemfileError, "Please define :engine" if options[:engine_version] && options[:engine].nil?
10
8
 
11
- if options[:engine] == "ruby" && options[:engine_version] &&
12
- ruby_version != Array(options[:engine_version])
13
- raise GemfileEvalError, "ruby_version must match the :engine_version for MRI"
9
+ if options
10
+ patchlevel = options[:patchlevel]
11
+ engine = options[:engine]
12
+ engine_version = options[:engine_version]
13
+
14
+ raise GemfileError, "Please define :engine_version" if engine && engine_version.nil?
15
+ raise GemfileError, "Please define :engine" if engine_version && engine.nil?
16
+
17
+ if options[:file]
18
+ raise GemfileError, "Do not pass version argument when using :file option" unless ruby_version.empty?
19
+ ruby_version << normalize_ruby_file(options[:file])
20
+ end
21
+
22
+ if engine == "ruby" && engine_version && ruby_version != Array(engine_version)
23
+ raise GemfileEvalError, "ruby_version must match the :engine_version for MRI"
24
+ end
25
+ end
26
+
27
+ @ruby_version = RubyVersion.new(ruby_version, patchlevel, engine, engine_version)
28
+ end
29
+
30
+ # Support the various file formats found in .ruby-version files.
31
+ #
32
+ # 3.2.2
33
+ # ruby-3.2.2
34
+ #
35
+ # Also supports .tool-versions files for asdf. Lines not starting with "ruby" are ignored.
36
+ #
37
+ # ruby 2.5.1 # comment is ignored
38
+ # ruby 2.5.1# close comment and extra spaces doesn't confuse
39
+ #
40
+ # Intentionally does not support `3.2.1@gemset` since rvm recommends using .ruby-gemset instead
41
+ #
42
+ # Loads the file relative to the dirname of the Gemfile itself.
43
+ def normalize_ruby_file(filename)
44
+ file_content = Bundler.read_file(gemfile.dirname.join(filename))
45
+ # match "ruby-3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
46
+ if /^ruby(-|\s+)([^\s#]+)/.match(file_content)
47
+ $2
48
+ else
49
+ file_content.strip
14
50
  end
15
- @ruby_version = RubyVersion.new(ruby_version, options[:patchlevel], options[:engine], options[:engine_version])
16
51
  end
17
52
  end
18
53
  end
@@ -23,21 +23,27 @@ module Bundler
23
23
  # specified must match the version.
24
24
 
25
25
  @versions = Array(versions).map do |v|
26
- op, v = Gem::Requirement.parse(v)
26
+ normalized_v = normalize_version(v)
27
+
28
+ unless Gem::Requirement::PATTERN.match?(normalized_v)
29
+ raise InvalidArgumentError, "#{v} is not a valid requirement on the Ruby version"
30
+ end
31
+
32
+ op, v = Gem::Requirement.parse(normalized_v)
27
33
  op == "=" ? v.to_s : "#{op} #{v}"
28
34
  end
29
35
 
30
36
  @gem_version = Gem::Requirement.create(@versions.first).requirements.first.last
31
- @input_engine = engine && engine.to_s
32
- @engine = engine && engine.to_s || "ruby"
37
+ @input_engine = engine&.to_s
38
+ @engine = engine&.to_s || "ruby"
33
39
  @engine_versions = (engine_version && Array(engine_version)) || @versions
34
40
  @engine_gem_version = Gem::Requirement.create(@engine_versions.first).requirements.first.last
35
- @patchlevel = patchlevel
41
+ @patchlevel = patchlevel || (@gem_version.prerelease? ? "-1" : nil)
36
42
  end
37
43
 
38
44
  def to_s(versions = self.versions)
39
45
  output = String.new("ruby #{versions_string(versions)}")
40
- output << "p#{patchlevel}" if patchlevel
46
+ output << "p#{patchlevel}" if patchlevel && patchlevel != "-1"
41
47
  output << " (#{engine} #{versions_string(engine_versions)})" unless engine == "ruby"
42
48
 
43
49
  output
@@ -46,10 +52,10 @@ module Bundler
46
52
  # @private
47
53
  PATTERN = /
48
54
  ruby\s
49
- ([\d.]+) # ruby version
55
+ (\d+\.\d+\.\d+(?:\.\S+)?) # ruby version
50
56
  (?:p(-?\d+))? # optional patchlevel
51
57
  (?:\s\((\S+)\s(.+)\))? # optional engine info
52
- /xo.freeze
58
+ /xo
53
59
 
54
60
  # Returns a RubyVersion from the given string.
55
61
  # @param [String] the version string to match.
@@ -103,28 +109,22 @@ module Bundler
103
109
 
104
110
  def self.system
105
111
  ruby_engine = RUBY_ENGINE.dup
106
- ruby_version = ENV.fetch("BUNDLER_SPEC_RUBY_VERSION") { RUBY_VERSION }.dup
107
- ruby_engine_version = RUBY_ENGINE_VERSION.dup
112
+ ruby_version = Gem.ruby_version.to_s
113
+ ruby_engine_version = RUBY_ENGINE == "ruby" ? ruby_version : RUBY_ENGINE_VERSION.dup
108
114
  patchlevel = RUBY_PATCHLEVEL.to_s
109
115
 
110
- @ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
116
+ @system ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
111
117
  end
112
118
 
113
- def to_gem_version_with_patchlevel
114
- @gem_version_with_patch ||= begin
115
- Gem::Version.create("#{@gem_version}.#{@patchlevel}")
116
- rescue ArgumentError
117
- @gem_version
118
- end
119
- end
119
+ private
120
120
 
121
- def exact?
122
- return @exact if defined?(@exact)
123
- @exact = versions.all? {|v| Gem::Requirement.create(v).exact? }
121
+ # Ruby's official preview version format uses a `-`: Example: 3.3.0-preview2
122
+ # However, RubyGems recognizes preview version format with a `.`: Example: 3.3.0.preview2
123
+ # Returns version string after replacing `-` with `.`
124
+ def normalize_version(version)
125
+ version.tr("-", ".")
124
126
  end
125
127
 
126
- private
127
-
128
128
  def matches?(requirements, version)
129
129
  # Handles RUBY_PATCHLEVEL of -1 for instances like ruby-head
130
130
  return requirements == version if requirements.to_s == "-1" || version.to_s == "-1"
@@ -1,35 +1,102 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pathname"
4
-
5
- require "rubygems/specification"
6
-
7
- # Possible use in Gem::Specification#source below and require
8
- # shouldn't be deferred.
3
+ require "rubygems" unless defined?(Gem)
4
+
5
+ # We can't let `Gem::Source` be autoloaded in the `Gem::Specification#source`
6
+ # redefinition below, so we need to load it upfront. The reason is that if
7
+ # Bundler monkeypatches are loaded before RubyGems activates an executable (for
8
+ # example, through `ruby -rbundler -S irb`), gem activation might end up calling
9
+ # the redefined `Gem::Specification#source` and triggering the `Gem::Source`
10
+ # autoload. That would result in requiring "rubygems/source" inside another
11
+ # require, which would trigger a monitor error and cause the `autoload` to
12
+ # eventually fail. A better solution is probably to completely avoid autoloading
13
+ # `Gem::Source` from the redefined `Gem::Specification#source`.
9
14
  require "rubygems/source"
10
15
 
11
- require_relative "match_platform"
16
+ # Cherry-pick fixes to `Gem.ruby_version` to be useful for modern Bundler
17
+ # versions and ignore patchlevels
18
+ # (https://github.com/rubygems/rubygems/pull/5472,
19
+ # https://github.com/rubygems/rubygems/pull/5486). May be removed once RubyGems
20
+ # 3.3.12 support is dropped.
21
+ unless Gem.ruby_version.to_s == RUBY_VERSION || RUBY_PATCHLEVEL == -1
22
+ Gem.instance_variable_set(:@ruby_version, Gem::Version.new(RUBY_VERSION))
23
+ end
12
24
 
13
25
  module Gem
26
+ # Can be removed once RubyGems 3.5.11 support is dropped
27
+ unless Gem.respond_to?(:freebsd_platform?)
28
+ def self.freebsd_platform?
29
+ RbConfig::CONFIG["host_os"].to_s.include?("bsd")
30
+ end
31
+ end
32
+
33
+ # Can be removed once RubyGems 3.5.18 support is dropped
34
+ unless Gem.respond_to?(:open_file_with_lock)
35
+ class << self
36
+ remove_method :open_file_with_flock if Gem.respond_to?(:open_file_with_flock)
37
+
38
+ def open_file_with_flock(path, &block)
39
+ # read-write mode is used rather than read-only in order to support NFS
40
+ mode = IO::RDWR | IO::APPEND | IO::CREAT | IO::BINARY
41
+ mode |= IO::SHARE_DELETE if IO.const_defined?(:SHARE_DELETE)
42
+
43
+ File.open(path, mode) do |io|
44
+ begin
45
+ io.flock(File::LOCK_EX)
46
+ rescue Errno::ENOSYS, Errno::ENOTSUP
47
+ end
48
+ yield io
49
+ end
50
+ end
51
+
52
+ def open_file_with_lock(path, &block)
53
+ file_lock = "#{path}.lock"
54
+ open_file_with_flock(file_lock, &block)
55
+ ensure
56
+ FileUtils.rm_f file_lock
57
+ end
58
+ end
59
+ end
60
+
61
+ require "rubygems/specification"
62
+
63
+ # Can be removed once RubyGems 3.5.14 support is dropped
64
+ VALIDATES_FOR_RESOLUTION = Specification.new.respond_to?(:validate_for_resolution).freeze
65
+
66
+ # Can be removed once RubyGems 3.3.15 support is dropped
67
+ FLATTENS_REQUIRED_PATHS = Specification.new.respond_to?(:flatten_require_paths).freeze
68
+
14
69
  class Specification
15
- attr_accessor :remote, :location, :relative_loaded_from
70
+ # Can be removed once RubyGems 3.5.15 support is dropped
71
+ correct_array_attributes = @@default_value.select {|_k,v| v.is_a?(Array) }.keys
72
+ unless @@array_attributes == correct_array_attributes
73
+ @@array_attributes = correct_array_attributes # rubocop:disable Style/ClassVars
74
+ end
75
+
76
+ require_relative "match_metadata"
77
+ require_relative "match_platform"
78
+
79
+ include ::Bundler::MatchMetadata
80
+ include ::Bundler::MatchPlatform
81
+
82
+ attr_accessor :remote, :relative_loaded_from
16
83
 
17
- remove_method :source
18
- attr_writer :source
19
- def source
20
- (defined?(@source) && @source) || Gem::Source::Installed.new
84
+ module AllowSettingSource
85
+ attr_writer :source
86
+
87
+ def source
88
+ (defined?(@source) && @source) || super
89
+ end
21
90
  end
22
91
 
92
+ prepend AllowSettingSource
93
+
23
94
  alias_method :rg_full_gem_path, :full_gem_path
24
95
  alias_method :rg_loaded_from, :loaded_from
25
96
 
26
97
  def full_gem_path
27
- # this cannot check source.is_a?(Bundler::Plugin::API::Source)
28
- # because that _could_ trip the autoload, and if there are unresolved
29
- # gems at that time, this method could be called inside another require,
30
- # thus raising with that constant being undefined. Better to check a method
31
- if source.respond_to?(:path) || (source.respond_to?(:bundler_plugin_api_source?) && source.bundler_plugin_api_source?)
32
- Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
98
+ if source.respond_to?(:root)
99
+ File.expand_path(File.dirname(loaded_from), source.root)
33
100
  else
34
101
  rg_full_gem_path
35
102
  end
@@ -49,7 +116,9 @@ module Gem
49
116
 
50
117
  alias_method :rg_extension_dir, :extension_dir
51
118
  def extension_dir
52
- @bundler_extension_dir ||= if source.respond_to?(:extension_dir_name)
119
+ # following instance variable is already used in original method
120
+ # and that is the reason to prefix it with bundler_ and add rubocop exception
121
+ @bundler_extension_dir ||= if source.respond_to?(:extension_dir_name) # rubocop:disable Naming/MemoizedInstanceVariableName
53
122
  unique_extension_dir = [source.extension_dir_name, File.basename(full_gem_path)].uniq.join("-")
54
123
  File.expand_path(File.join(extensions_dir, unique_extension_dir))
55
124
  else
@@ -57,11 +126,34 @@ module Gem
57
126
  end
58
127
  end
59
128
 
60
- remove_method :gem_dir if instance_methods(false).include?(:gem_dir)
129
+ # Can be removed once RubyGems 3.5.21 support is dropped
130
+ remove_method :gem_dir if method_defined?(:gem_dir, false)
131
+
61
132
  def gem_dir
62
133
  full_gem_path
63
134
  end
64
135
 
136
+ unless const_defined?(:LATEST_RUBY_WITHOUT_PATCH_VERSIONS)
137
+ LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1")
138
+
139
+ alias_method :rg_required_ruby_version=, :required_ruby_version=
140
+ def required_ruby_version=(req)
141
+ self.rg_required_ruby_version = req
142
+
143
+ @required_ruby_version.requirements.map! do |op, v|
144
+ if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4
145
+ [op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))]
146
+ else
147
+ [op, v]
148
+ end
149
+ end
150
+ end
151
+ end
152
+
153
+ def insecurely_materialized?
154
+ false
155
+ end
156
+
65
157
  def groups
66
158
  @groups ||= []
67
159
  end
@@ -85,6 +177,37 @@ module Gem
85
177
  dependencies - development_dependencies
86
178
  end
87
179
 
180
+ def deleted_gem?
181
+ !default_gem? && !File.directory?(full_gem_path)
182
+ end
183
+
184
+ unless VALIDATES_FOR_RESOLUTION
185
+ def validate_for_resolution
186
+ SpecificationPolicy.new(self).validate_for_resolution
187
+ end
188
+ end
189
+
190
+ unless FLATTENS_REQUIRED_PATHS
191
+ def flatten_require_paths
192
+ return unless raw_require_paths.first.is_a?(Array)
193
+
194
+ 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"
195
+ raw_require_paths.flatten!
196
+ end
197
+
198
+ class << self
199
+ module RequirePathFlattener
200
+ def from_yaml(input)
201
+ spec = super(input)
202
+ spec.flatten_require_paths
203
+ spec
204
+ end
205
+ end
206
+
207
+ prepend RequirePathFlattener
208
+ end
209
+ end
210
+
88
211
  private
89
212
 
90
213
  def dependencies_to_gemfile(dependencies, group = nil)
@@ -104,21 +227,47 @@ module Gem
104
227
  end
105
228
  end
106
229
 
230
+ unless VALIDATES_FOR_RESOLUTION
231
+ class SpecificationPolicy
232
+ def validate_for_resolution
233
+ validate_required!
234
+ end
235
+ end
236
+ end
237
+
238
+ module BetterPermissionError
239
+ def data
240
+ super
241
+ rescue Errno::EACCES
242
+ raise Bundler::PermissionError.new(loaded_from, :read)
243
+ end
244
+ end
245
+
246
+ require "rubygems/stub_specification"
247
+
248
+ class StubSpecification
249
+ prepend BetterPermissionError
250
+ end
251
+
107
252
  class Dependency
253
+ require_relative "force_platform"
254
+
255
+ include ::Bundler::ForcePlatform
256
+
257
+ attr_reader :force_ruby_platform
258
+
108
259
  attr_accessor :source, :groups
109
260
 
110
261
  alias_method :eql?, :==
111
262
 
112
- def encode_with(coder)
113
- to_yaml_properties.each do |ivar|
114
- coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar)
263
+ unless method_defined?(:encode_with, false)
264
+ def encode_with(coder)
265
+ [:@name, :@requirement, :@type, :@prerelease, :@version_requirements].each do |ivar|
266
+ coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar)
267
+ end
115
268
  end
116
269
  end
117
270
 
118
- def to_yaml_properties
119
- instance_variables.reject {|p| ["@source", "@groups"].include?(p.to_s) }
120
- end
121
-
122
271
  def to_lock
123
272
  out = String.new(" #{name}")
124
273
  unless requirement.none?
@@ -127,61 +276,67 @@ module Gem
127
276
  end
128
277
  out
129
278
  end
130
- end
131
-
132
- # comparison is done order independently since rubygems 3.2.0.rc.2
133
- unless Gem::Requirement.new("> 1", "< 2") == Gem::Requirement.new("< 2", "> 1")
134
- class Requirement
135
- module OrderIndependentComparison
136
- def ==(other)
137
- if _requirements_sorted? && other._requirements_sorted?
138
- super
139
- else
140
- _with_sorted_requirements == other._with_sorted_requirements
141
- end
142
- end
143
-
144
- protected
145
-
146
- def _requirements_sorted?
147
- return @_are_requirements_sorted if defined?(@_are_requirements_sorted)
148
- strings = as_list
149
- @_are_requirements_sorted = strings == strings.sort
150
- end
151
279
 
152
- def _with_sorted_requirements
153
- @_with_sorted_requirements ||= _requirements_sorted? ? self : self.class.new(as_list.sort)
280
+ if Gem.rubygems_version < Gem::Version.new("3.5.22")
281
+ module FilterIgnoredSpecs
282
+ def matching_specs(platform_only = false)
283
+ super.reject(&:ignored?)
154
284
  end
155
285
  end
156
286
 
157
- prepend OrderIndependentComparison
287
+ prepend FilterIgnoredSpecs
158
288
  end
159
289
  end
160
290
 
161
- if Gem::Requirement.new("~> 2.0").hash == Gem::Requirement.new("~> 2.0.0").hash
162
- class Requirement
163
- module CorrectHashForLambdaOperator
164
- def hash
165
- if requirements.any? {|r| r.first == "~>" }
166
- requirements.map {|r| r.first == "~>" ? [r[0], r[1].to_s] : r }.sort.hash
167
- else
168
- super
169
- end
170
- end
291
+ require "rubygems/platform"
292
+
293
+ class Platform
294
+ JAVA = Gem::Platform.new("java")
295
+ MSWIN = Gem::Platform.new("mswin32")
296
+ MSWIN64 = Gem::Platform.new("mswin64")
297
+ MINGW = Gem::Platform.new("x86-mingw32")
298
+ X64_MINGW = [Gem::Platform.new("x64-mingw32"),
299
+ Gem::Platform.new("x64-mingw-ucrt")].freeze
300
+ WINDOWS = [MSWIN, MSWIN64, MINGW, X64_MINGW].flatten.freeze
301
+ X64_LINUX = Gem::Platform.new("x86_64-linux")
302
+ X64_LINUX_MUSL = Gem::Platform.new("x86_64-linux-musl")
303
+
304
+ if X64_LINUX === X64_LINUX_MUSL
305
+ remove_method :===
306
+
307
+ def ===(other)
308
+ return nil unless Gem::Platform === other
309
+
310
+ # universal-mingw32 matches x64-mingw-ucrt
311
+ return true if (@cpu == "universal" || other.cpu == "universal") &&
312
+ @os.start_with?("mingw") && other.os.start_with?("mingw")
313
+
314
+ # cpu
315
+ ([nil,"universal"].include?(@cpu) || [nil, "universal"].include?(other.cpu) || @cpu == other.cpu ||
316
+ (@cpu == "arm" && other.cpu.start_with?("armv"))) &&
317
+
318
+ # os
319
+ @os == other.os &&
320
+
321
+ # version
322
+ (
323
+ (@os != "linux" && (@version.nil? || other.version.nil?)) ||
324
+ (@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
325
+ @version == other.version
326
+ )
171
327
  end
172
328
 
173
- prepend CorrectHashForLambdaOperator
174
- end
175
- end
329
+ # This is a copy of RubyGems 3.3.23 or higher `normalized_linux_method`.
330
+ # Once only 3.3.23 is supported, we can use the method in RubyGems.
331
+ def normalized_linux_version_ext
332
+ return nil unless @version
176
333
 
177
- require "rubygems/platform"
334
+ without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
335
+ return nil if without_gnu_nor_abi_modifiers.empty?
178
336
 
179
- class Platform
180
- JAVA = Gem::Platform.new("java") unless defined?(JAVA)
181
- MSWIN = Gem::Platform.new("mswin32") unless defined?(MSWIN)
182
- MSWIN64 = Gem::Platform.new("mswin64") unless defined?(MSWIN64)
183
- MINGW = Gem::Platform.new("x86-mingw32") unless defined?(MINGW)
184
- X64_MINGW = Gem::Platform.new("x64-mingw32") unless defined?(X64_MINGW)
337
+ without_gnu_nor_abi_modifiers
338
+ end
339
+ end
185
340
  end
186
341
 
187
342
  Platform.singleton_class.module_eval do
@@ -193,38 +348,122 @@ module Gem
193
348
  def match_gem?(platform, gem_name)
194
349
  match_platforms?(platform, Gem.platforms)
195
350
  end
351
+ end
352
+
353
+ match_platforms_defined = Gem::Platform.respond_to?(:match_platforms?, true)
354
+
355
+ if !match_platforms_defined || Gem::Platform.send(:match_platforms?, Gem::Platform::X64_LINUX_MUSL, [Gem::Platform::X64_LINUX])
196
356
 
197
357
  private
198
358
 
359
+ remove_method :match_platforms? if match_platforms_defined
360
+
199
361
  def match_platforms?(platform, platforms)
200
362
  platforms.any? do |local_platform|
201
363
  platform.nil? ||
202
364
  local_platform == platform ||
203
- (local_platform != Gem::Platform::RUBY && local_platform =~ platform)
365
+ (local_platform != Gem::Platform::RUBY && platform =~ local_platform)
204
366
  end
205
367
  end
206
368
  end
207
369
  end
208
370
 
209
- require "rubygems/util"
371
+ # On universal Rubies, resolve the "universal" arch to the real CPU arch, without changing the extension directory.
372
+ class BasicSpecification
373
+ if /^universal\.(?<arch>.*?)-/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
374
+ local_platform = Platform.local
375
+ if local_platform.cpu == "universal"
376
+ ORIGINAL_LOCAL_PLATFORM = local_platform.to_s.freeze
377
+
378
+ local_platform.cpu = if arch == "arm64e" # arm64e is only permitted for Apple system binaries
379
+ "arm64"
380
+ else
381
+ arch
382
+ end
210
383
 
211
- Util.singleton_class.module_eval do
212
- if Util.singleton_methods.include?(:glob_files_in_dir) # since 3.0.0.beta.2
213
- remove_method :glob_files_in_dir
384
+ def extensions_dir
385
+ @extensions_dir ||=
386
+ Gem.default_ext_dir_for(base_dir) || File.join(base_dir, "extensions", ORIGINAL_LOCAL_PLATFORM, Gem.extension_api_version)
387
+ end
388
+ end
214
389
  end
215
390
 
216
- def glob_files_in_dir(glob, base_path)
217
- if RUBY_VERSION >= "2.5"
218
- Dir.glob(glob, :base => base_path).map! {|f| File.expand_path(f, base_path) }
391
+ # Can be removed once RubyGems 3.5.22 support is dropped
392
+ unless new.respond_to?(:ignored?)
393
+ def ignored?
394
+ return @ignored unless @ignored.nil?
395
+
396
+ @ignored = missing_extensions?
397
+ end
398
+ end
399
+ end
400
+
401
+ require "rubygems/name_tuple"
402
+
403
+ class NameTuple
404
+ # Versions of RubyGems before about 3.5.0 don't to_s the platform.
405
+ unless Gem::NameTuple.new("a", Gem::Version.new("1"), Gem::Platform.new("x86_64-linux")).platform.is_a?(String)
406
+ alias_method :initialize_with_platform, :initialize
407
+
408
+ def initialize(name, version, platform=Gem::Platform::RUBY)
409
+ if Gem::Platform === platform
410
+ initialize_with_platform(name, version, platform.to_s)
411
+ else
412
+ initialize_with_platform(name, version, platform)
413
+ end
414
+ end
415
+ end
416
+
417
+ def lock_name
418
+ if platform == Gem::Platform::RUBY
419
+ "#{name} (#{version})"
219
420
  else
220
- Dir.glob(File.join(base_path.to_s.gsub(/[\[\]]/, '\\\\\\&'), glob)).map! {|f| File.expand_path(f) }
421
+ "#{name} (#{version}-#{platform})"
221
422
  end
222
423
  end
223
424
  end
224
- end
225
425
 
226
- module Gem
227
- class Specification
228
- include ::Bundler::MatchPlatform
426
+ unless Gem.rubygems_version >= Gem::Version.new("3.5.19")
427
+ class Resolver::ActivationRequest
428
+ remove_method :installed?
429
+
430
+ def installed?
431
+ case @spec
432
+ when Gem::Resolver::VendorSpecification then
433
+ true
434
+ else
435
+ this_spec = full_spec
436
+
437
+ Gem::Specification.any? do |s|
438
+ s == this_spec && s.base_dir == this_spec.base_dir
439
+ end
440
+ end
441
+ end
442
+ end
443
+ end
444
+
445
+ if Gem.rubygems_version < Gem::Version.new("3.6.0")
446
+ class Package; end
447
+ require "rubygems/package/tar_reader"
448
+ require "rubygems/package/tar_reader/entry"
449
+
450
+ module FixFullNameEncoding
451
+ def full_name
452
+ super.force_encoding(Encoding::UTF_8)
453
+ end
454
+ end
455
+
456
+ Package::TarReader::Entry.prepend(FixFullNameEncoding)
457
+ end
458
+
459
+ require "rubygems/uri"
460
+
461
+ # Can be removed once RubyGems 3.3.15 support is dropped
462
+ unless Gem::Uri.respond_to?(:redact)
463
+ class Uri
464
+ def self.redact(uri)
465
+ new(uri).redacted
466
+ end
467
+ end
229
468
  end
230
469
  end