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
@@ -20,31 +20,35 @@ module Bundler
20
20
  Bundler.ui.debug("HTTP #{response.code} #{response.message} #{filtered_uri}")
21
21
 
22
22
  case response
23
- when Net::HTTPSuccess, Net::HTTPNotModified
23
+ when Gem::Net::HTTPSuccess, Gem::Net::HTTPNotModified
24
24
  response
25
- when Net::HTTPRedirection
26
- new_uri = Bundler::URI.parse(response["location"])
25
+ when Gem::Net::HTTPRedirection
26
+ new_uri = Gem::URI.parse(response["location"])
27
27
  if new_uri.host == uri.host
28
28
  new_uri.user = uri.user
29
29
  new_uri.password = uri.password
30
30
  end
31
31
  fetch(new_uri, headers, counter + 1)
32
- when Net::HTTPRequestedRangeNotSatisfiable
32
+ when Gem::Net::HTTPRequestedRangeNotSatisfiable
33
33
  new_headers = headers.dup
34
34
  new_headers.delete("Range")
35
35
  new_headers["Accept-Encoding"] = "gzip"
36
36
  fetch(uri, new_headers)
37
- when Net::HTTPRequestEntityTooLarge
37
+ when Gem::Net::HTTPRequestEntityTooLarge
38
38
  raise FallbackError, response.body
39
- when Net::HTTPTooManyRequests
39
+ when Gem::Net::HTTPTooManyRequests
40
40
  raise TooManyRequestsError, response.body
41
- when Net::HTTPUnauthorized
41
+ when Gem::Net::HTTPUnauthorized
42
42
  raise BadAuthenticationError, uri.host if uri.userinfo
43
43
  raise AuthenticationRequiredError, uri.host
44
- when Net::HTTPNotFound
45
- raise FallbackError, "Net::HTTPNotFound: #{filtered_uri}"
44
+ when Gem::Net::HTTPForbidden
45
+ raise AuthenticationForbiddenError, uri.host
46
+ when Gem::Net::HTTPNotFound
47
+ raise FallbackError, "Gem::Net::HTTPNotFound: #{filtered_uri}"
46
48
  else
47
- raise HTTPError, "#{response.class}#{": #{response.body}" unless response.body.empty?}"
49
+ message = "Gem::#{response.class.name.gsub(/\AGem::/, "")}"
50
+ message += ": #{response.body}" unless response.body.empty?
51
+ raise HTTPError, message
48
52
  end
49
53
  end
50
54
 
@@ -54,21 +58,18 @@ module Bundler
54
58
  filtered_uri = URICredentialsFilter.credential_filtered_uri(uri)
55
59
 
56
60
  Bundler.ui.debug "HTTP GET #{filtered_uri}"
57
- req = Net::HTTP::Get.new uri.request_uri, headers
61
+ req = Gem::Net::HTTP::Get.new uri.request_uri, headers
58
62
  if uri.user
59
63
  user = CGI.unescape(uri.user)
60
64
  password = uri.password ? CGI.unescape(uri.password) : nil
61
65
  req.basic_auth(user, password)
62
66
  end
63
67
  connection.request(uri, req)
64
- rescue NoMethodError => e
65
- raise unless ["undefined method", "use_ssl="].all? {|snippet| e.message.include? snippet }
66
- raise LoadError.new("cannot load such file -- openssl")
67
68
  rescue OpenSSL::SSL::SSLError
68
69
  raise CertificateFailureError.new(uri)
69
70
  rescue *HTTP_ERRORS => e
70
71
  Bundler.ui.trace e
71
- if e.is_a?(SocketError) || e.message =~ /host down:/
72
+ if e.is_a?(SocketError) || e.message.to_s.include?("host down:")
72
73
  raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
73
74
  "connection and try again."
74
75
  else
@@ -80,7 +81,7 @@ module Bundler
80
81
  private
81
82
 
82
83
  def validate_uri_scheme!(uri)
83
- return if uri.scheme =~ /\Ahttps?\z/
84
+ return if /\Ahttps?\z/.match?(uri.scheme)
84
85
  raise InvalidOption,
85
86
  "The request uri `#{uri}` has an invalid scheme (`#{uri.scheme}`). " \
86
87
  "Did you mean `http` or `https`?"
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubygems/remote_fetcher"
4
+
5
+ module Bundler
6
+ class Fetcher
7
+ class GemRemoteFetcher < Gem::RemoteFetcher
8
+ def request(*args)
9
+ super do |req|
10
+ req.delete("User-Agent") if headers["User-Agent"]
11
+ yield req if block_given?
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -6,7 +6,7 @@ module Bundler
6
6
  class Fetcher
7
7
  class Index < Base
8
8
  def specs(_gem_names)
9
- Bundler.rubygems.fetch_all_remote_specs(remote)
9
+ Bundler.rubygems.fetch_all_remote_specs(remote, gem_remote_fetcher)
10
10
  rescue Gem::RemoteFetcher::FetchError => e
11
11
  case e.message
12
12
  when /certificate verify failed/
@@ -15,38 +15,11 @@ module Bundler
15
15
  raise BadAuthenticationError, remote_uri if remote_uri.userinfo
16
16
  raise AuthenticationRequiredError, remote_uri
17
17
  when /403/
18
- raise BadAuthenticationError, remote_uri if remote_uri.userinfo
19
- raise AuthenticationRequiredError, remote_uri
18
+ raise AuthenticationForbiddenError, remote_uri
20
19
  else
21
20
  raise HTTPError, "Could not fetch specs from #{display_uri} due to underlying error <#{e.message}>"
22
21
  end
23
22
  end
24
-
25
- def fetch_spec(spec)
26
- spec -= [nil, "ruby", ""]
27
- spec_file_name = "#{spec.join "-"}.gemspec"
28
-
29
- uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
30
- if uri.scheme == "file"
31
- path = Bundler.rubygems.correct_for_windows_path(uri.path)
32
- Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
33
- elsif cached_spec_path = gemspec_cached_path(spec_file_name)
34
- Bundler.load_gemspec(cached_spec_path)
35
- else
36
- Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
37
- end
38
- rescue MarshalError
39
- raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
40
- "Your network or your gem server is probably having issues right now."
41
- end
42
-
43
- private
44
-
45
- # cached gem specification path, if one exists
46
- def gemspec_cached_path(spec_file_name)
47
- paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
48
- paths.find {|path| File.file? path }
49
- end
50
23
  end
51
24
  end
52
25
  end
@@ -1,14 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "vendored_persistent"
4
+ require_relative "vendored_timeout"
4
5
  require "cgi"
5
- require "securerandom"
6
+ require_relative "vendored_securerandom"
6
7
  require "zlib"
7
- require "rubygems/request"
8
8
 
9
9
  module Bundler
10
10
  # Handles all the fetching with the rubygems server
11
11
  class Fetcher
12
+ autoload :Base, File.expand_path("fetcher/base", __dir__)
12
13
  autoload :CompactIndex, File.expand_path("fetcher/compact_index", __dir__)
13
14
  autoload :Downloader, File.expand_path("fetcher/downloader", __dir__)
14
15
  autoload :Dependency, File.expand_path("fetcher/dependency", __dir__)
@@ -20,6 +21,7 @@ module Bundler
20
21
  class TooManyRequestsError < HTTPError; end
21
22
  # This error is raised if the API returns a 413 (only printed in verbose)
22
23
  class FallbackError < HTTPError; end
24
+
23
25
  # This is the error raised if OpenSSL fails the cert verification
24
26
  class CertificateFailureError < HTTPError
25
27
  def initialize(remote_uri)
@@ -28,19 +30,19 @@ module Bundler
28
30
  " is a chance you are experiencing a man-in-the-middle attack, but" \
29
31
  " most likely your system doesn't have the CA certificates needed" \
30
32
  " for verification. For information about OpenSSL certificates, see" \
31
- " http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile" \
32
- " sources and change 'https' to 'http'."
33
+ " https://railsapps.github.io/openssl-certificate-verify-failed.html."
33
34
  end
34
35
  end
36
+
35
37
  # This is the error raised when a source is HTTPS and OpenSSL didn't load
36
38
  class SSLError < HTTPError
37
39
  def initialize(msg = nil)
38
- super msg || "Could not load OpenSSL.\n" \
39
- "You must recompile Ruby with OpenSSL support or change the sources in your " \
40
- "Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL " \
41
- "using RVM are available at rvm.io/packages/openssl."
40
+ super "Could not load OpenSSL.\n" \
41
+ "You must recompile Ruby with OpenSSL support.\n" \
42
+ "original error: #{msg}\n"
42
43
  end
43
44
  end
45
+
44
46
  # This error is raised if HTTP authentication is required, but not provided.
45
47
  class AuthenticationRequiredError < HTTPError
46
48
  def initialize(remote_uri)
@@ -51,6 +53,7 @@ module Bundler
51
53
  "or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
52
54
  end
53
55
  end
56
+
54
57
  # This error is raised if HTTP authentication is provided, but incorrect.
55
58
  class BadAuthenticationError < HTTPError
56
59
  def initialize(remote_uri)
@@ -60,6 +63,16 @@ module Bundler
60
63
  end
61
64
  end
62
65
 
66
+ # This error is raised if HTTP authentication is correct, but lacks
67
+ # necessary permissions.
68
+ class AuthenticationForbiddenError < HTTPError
69
+ def initialize(remote_uri)
70
+ remote_uri = filter_uri(remote_uri)
71
+ super "Access token could not be authenticated for #{remote_uri}.\n" \
72
+ "Make sure it's valid and has the necessary scopes configured."
73
+ end
74
+ end
75
+
63
76
  # Exceptions classes that should bypass retry attempts. If your password didn't work the
64
77
  # first time, it's not going to the third time.
65
78
  NET_ERRORS = [:HTTPBadGateway, :HTTPBadRequest, :HTTPFailedDependency,
@@ -69,9 +82,9 @@ module Bundler
69
82
  :HTTPRequestURITooLong, :HTTPUnauthorized, :HTTPUnprocessableEntity,
70
83
  :HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze
71
84
  FAIL_ERRORS = begin
72
- fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError]
73
- fail_errors << Gem::Requirement::BadRequirementError if defined?(Gem::Requirement::BadRequirementError)
74
- fail_errors.concat(NET_ERRORS.map {|e| SharedHelpers.const_get_safely(e, Net) }.compact)
85
+ fail_errors = [AuthenticationRequiredError, BadAuthenticationError, AuthenticationForbiddenError, FallbackError, SecurityError]
86
+ fail_errors << Gem::Requirement::BadRequirementError
87
+ fail_errors.concat(NET_ERRORS.map {|e| Gem::Net.const_get(e) })
75
88
  end.freeze
76
89
 
77
90
  class << self
@@ -83,6 +96,7 @@ module Bundler
83
96
  self.max_retries = Bundler.settings[:retry] # How many retries for the API call
84
97
 
85
98
  def initialize(remote)
99
+ @cis = nil
86
100
  @remote = remote
87
101
 
88
102
  Socket.do_not_reverse_lookup = true
@@ -98,15 +112,17 @@ module Bundler
98
112
  spec -= [nil, "ruby", ""]
99
113
  spec_file_name = "#{spec.join "-"}.gemspec"
100
114
 
101
- uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
102
- if uri.scheme == "file"
103
- path = Bundler.rubygems.correct_for_windows_path(uri.path)
104
- Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
115
+ uri = Gem::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
116
+ spec = if uri.scheme == "file"
117
+ path = Gem::Util.correct_for_windows_path(uri.path)
118
+ Bundler.safe_load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
105
119
  elsif cached_spec_path = gemspec_cached_path(spec_file_name)
106
120
  Bundler.load_gemspec(cached_spec_path)
107
121
  else
108
- Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
122
+ Bundler.safe_load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
109
123
  end
124
+ raise MarshalError, "is #{spec.inspect}" unless spec.is_a?(Gem::Specification)
125
+ spec
110
126
  rescue MarshalError
111
127
  raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
112
128
  "Your network or your gem server is probably having issues right now."
@@ -121,25 +137,13 @@ module Bundler
121
137
 
122
138
  # return the specs in the bundler format as an index
123
139
  def specs(gem_names, source)
124
- old = Bundler.rubygems.sources
125
140
  index = Bundler::Index.new
126
141
 
127
- if Bundler::Fetcher.disable_endpoint
128
- @use_api = false
129
- specs = fetchers.last.specs(gem_names)
130
- else
131
- specs = []
132
- fetchers.shift until fetchers.first.available? || fetchers.empty?
133
- fetchers.dup.each do |f|
134
- break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names)
135
- fetchers.delete(f)
136
- end
137
- @use_api = false if fetchers.none?(&:api_fetcher?)
138
- end
139
-
140
- specs.each do |name, version, platform, dependencies, metadata|
142
+ fetch_specs(gem_names).each do |name, version, platform, dependencies, metadata|
141
143
  spec = if dependencies
142
- EndpointSpecification.new(name, version, platform, dependencies, metadata)
144
+ EndpointSpecification.new(name, version, platform, self, dependencies, metadata).tap do |es|
145
+ source.checksum_store.replace(es, es.checksum)
146
+ end
143
147
  else
144
148
  RemoteSpecification.new(name, version, platform, self)
145
149
  end
@@ -150,22 +154,8 @@ module Bundler
150
154
 
151
155
  index
152
156
  rescue CertificateFailureError
153
- Bundler.ui.info "" if gem_names && use_api # newline after dots
157
+ Bundler.ui.info "" if gem_names && api_fetcher? # newline after dots
154
158
  raise
155
- ensure
156
- Bundler.rubygems.sources = old
157
- end
158
-
159
- def use_api
160
- return @use_api if defined?(@use_api)
161
-
162
- fetchers.shift until fetchers.first.available?
163
-
164
- @use_api = if remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint
165
- false
166
- else
167
- fetchers.first.api_fetcher?
168
- end
169
159
  end
170
160
 
171
161
  def user_agent
@@ -193,7 +183,7 @@ module Bundler
193
183
  agent << " ci/#{cis.join(",")}" if cis.any?
194
184
 
195
185
  # add a random ID so we can consolidate runs server-side
196
- agent << " " << SecureRandom.hex(8)
186
+ agent << " " << Gem::SecureRandom.hex(8)
197
187
 
198
188
  # add any user agent strings set in the config
199
189
  extra_ua = Bundler.settings[:user_agent]
@@ -203,10 +193,6 @@ module Bundler
203
193
  end
204
194
  end
205
195
 
206
- def fetchers
207
- @fetchers ||= FETCHERS.map {|f| f.new(downloader, @remote, uri) }
208
- end
209
-
210
196
  def http_proxy
211
197
  return unless uri = connection.proxy_uri
212
198
  uri.to_s
@@ -216,36 +202,67 @@ module Bundler
216
202
  "#<#{self.class}:0x#{object_id} uri=#{uri}>"
217
203
  end
218
204
 
205
+ def api_fetcher?
206
+ fetchers.first.api_fetcher?
207
+ end
208
+
209
+ def gem_remote_fetcher
210
+ @gem_remote_fetcher ||= begin
211
+ require_relative "fetcher/gem_remote_fetcher"
212
+ fetcher = GemRemoteFetcher.new Gem.configuration[:http_proxy]
213
+ fetcher.headers["User-Agent"] = user_agent
214
+ fetcher.headers["X-Gemfile-Source"] = @remote.original_uri.to_s if @remote.original_uri
215
+ fetcher
216
+ end
217
+ end
218
+
219
219
  private
220
220
 
221
- FETCHERS = [CompactIndex, Dependency, Index].freeze
221
+ def available_fetchers
222
+ if Bundler::Fetcher.disable_endpoint
223
+ [Index]
224
+ elsif remote_uri.scheme == "file"
225
+ Bundler.ui.debug("Using a local server, bundler won't use the CompactIndex API")
226
+ [Index]
227
+ else
228
+ [CompactIndex, Dependency, Index]
229
+ end
230
+ end
231
+
232
+ def fetchers
233
+ @fetchers ||= available_fetchers.map {|f| f.new(downloader, @remote, uri, gem_remote_fetcher) }.drop_while {|f| !f.available? }
234
+ end
235
+
236
+ def fetch_specs(gem_names)
237
+ fetchers.reject!(&:api_fetcher?) unless gem_names
238
+ fetchers.reject! do |f|
239
+ specs = f.specs(gem_names)
240
+ return specs if specs
241
+ true
242
+ end
243
+ []
244
+ end
222
245
 
223
246
  def cis
224
- env_cis = {
225
- "TRAVIS" => "travis",
226
- "CIRCLECI" => "circle",
227
- "SEMAPHORE" => "semaphore",
228
- "JENKINS_URL" => "jenkins",
229
- "BUILDBOX" => "buildbox",
230
- "GO_SERVER_URL" => "go",
231
- "SNAP_CI" => "snap",
232
- "GITLAB_CI" => "gitlab",
233
- "CI_NAME" => ENV["CI_NAME"],
234
- "CI" => "ci",
235
- }
236
- env_cis.find_all {|env, _| ENV[env] }.map {|_, ci| ci }
247
+ @cis ||= Bundler::CIDetector.ci_strings
237
248
  end
238
249
 
239
250
  def connection
240
251
  @connection ||= begin
241
252
  needs_ssl = remote_uri.scheme == "https" ||
242
- Bundler.settings[:ssl_verify_mode] ||
243
- Bundler.settings[:ssl_client_cert]
244
- raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
253
+ Bundler.settings[:ssl_verify_mode] ||
254
+ Bundler.settings[:ssl_client_cert]
255
+ if needs_ssl
256
+ begin
257
+ require "openssl"
258
+ rescue StandardError, LoadError => e
259
+ raise SSLError.new(e.message)
260
+ end
261
+ end
245
262
 
246
- con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
247
- if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
248
- con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
263
+ con = Gem::Net::HTTP::Persistent.new name: "bundler", proxy: :ENV
264
+ if gem_proxy = Gem.configuration[:http_proxy]
265
+ con.proxy = Gem::URI.parse(gem_proxy) if gem_proxy != :no_proxy
249
266
  end
250
267
 
251
268
  if remote_uri.scheme == "https"
@@ -255,8 +272,8 @@ module Bundler
255
272
  end
256
273
 
257
274
  ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
258
- (Bundler.rubygems.configuration.ssl_client_cert if
259
- Bundler.rubygems.configuration.respond_to?(:ssl_client_cert))
275
+ (Gem.configuration.ssl_client_cert if
276
+ Gem.configuration.respond_to?(:ssl_client_cert))
260
277
  if ssl_client_cert
261
278
  pem = File.read(ssl_client_cert)
262
279
  con.cert = OpenSSL::X509::Certificate.new(pem)
@@ -274,22 +291,21 @@ module Bundler
274
291
  # cached gem specification path, if one exists
275
292
  def gemspec_cached_path(spec_file_name)
276
293
  paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
277
- paths = paths.select {|path| File.file? path }
278
- paths.first
294
+ paths.find {|path| File.file? path }
279
295
  end
280
296
 
281
297
  HTTP_ERRORS = [
282
- Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
298
+ Gem::Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
283
299
  Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
284
- Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
285
- PersistentHTTP::Error, Zlib::BufError, Errno::EHOSTUNREACH
300
+ Gem::Net::HTTPBadResponse, Gem::Net::HTTPHeaderSyntaxError, Gem::Net::ProtocolError,
301
+ Gem::Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH
286
302
  ].freeze
287
303
 
288
304
  def bundler_cert_store
289
305
  store = OpenSSL::X509::Store.new
290
306
  ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
291
- (Bundler.rubygems.configuration.ssl_ca_cert if
292
- Bundler.rubygems.configuration.respond_to?(:ssl_ca_cert))
307
+ (Gem.configuration.ssl_ca_cert if
308
+ Gem.configuration.respond_to?(:ssl_ca_cert))
293
309
  if ssl_ca_cert
294
310
  if File.directory? ssl_ca_cert
295
311
  store.add_path ssl_ca_cert
@@ -298,13 +314,12 @@ module Bundler
298
314
  end
299
315
  else
300
316
  store.set_default_paths
317
+ require "rubygems/request"
301
318
  Gem::Request.get_cert_files.each {|c| store.add_file c }
302
319
  end
303
320
  store
304
321
  end
305
322
 
306
- private
307
-
308
323
  def remote_uri
309
324
  @remote.uri
310
325
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module ForcePlatform
5
+ # The `:force_ruby_platform` value used by dependencies for resolution, and
6
+ # by locked specifications for materialization is `false` by default, except
7
+ # for TruffleRuby. TruffleRuby generally needs to force the RUBY platform
8
+ # variant unless the name is explicitly allowlisted.
9
+
10
+ def default_force_ruby_platform
11
+ return false unless RUBY_ENGINE == "truffleruby"
12
+
13
+ !Gem::Platform::REUSE_AS_BINARY_ON_TRUFFLERUBY.include?(name)
14
+ end
15
+ end
16
+ end
@@ -29,18 +29,18 @@ module Bundler
29
29
  Bundler.ui.error error.message
30
30
  Bundler.ui.trace error.orig_exception
31
31
  when BundlerError
32
- Bundler.ui.error error.message, :wrap => true
33
- Bundler.ui.trace error
32
+ if Bundler.ui.debug?
33
+ Bundler.ui.trace error
34
+ else
35
+ Bundler.ui.error error.message, wrap: true
36
+ end
34
37
  when Thor::Error
35
38
  Bundler.ui.error error.message
36
- when LoadError
37
- raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
38
- Bundler.ui.error "\nCould not load OpenSSL. #{error.class}: #{error}\n#{error.backtrace.join("\n ")}"
39
39
  when Interrupt
40
40
  Bundler.ui.error "\nQuitting..."
41
41
  Bundler.ui.trace error
42
42
  when Gem::InvalidSpecificationException
43
- Bundler.ui.error error.message, :wrap => true
43
+ Bundler.ui.error error.message, wrap: true
44
44
  when SystemExit
45
45
  when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact
46
46
  Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \
@@ -61,40 +61,11 @@ module Bundler
61
61
  end
62
62
 
63
63
  def request_issue_report_for(e)
64
- Bundler.ui.error <<-EOS.gsub(/^ {8}/, ""), nil, nil
64
+ Bundler.ui.error <<~EOS, nil, nil
65
65
  --- ERROR REPORT TEMPLATE -------------------------------------------------------
66
- # Error Report
67
-
68
- ## Questions
69
-
70
- Please fill out answers to these questions, it'll help us figure out
71
- why things are going wrong.
72
-
73
- - **What did you do?**
74
-
75
- I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}`
76
-
77
- - **What did you expect to happen?**
78
-
79
- I expected Bundler to...
80
-
81
- - **What happened instead?**
82
-
83
- Instead, what happened was...
84
-
85
- - **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**
86
-
87
- I tried...
88
-
89
- - **Have you read our issues document, https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/ISSUES.md?**
90
-
91
- ...
92
-
93
- ## Backtrace
94
66
 
95
67
  ```
96
- #{e.class}: #{e.message}
97
- #{e.backtrace && e.backtrace.join("\n ").chomp}
68
+ #{exception_message(e)}
98
69
  ```
99
70
 
100
71
  #{Bundler::Env.report}
@@ -104,13 +75,27 @@ module Bundler
104
75
 
105
76
  Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."
106
77
 
107
- Bundler.ui.error <<-EOS.gsub(/^ {8}/, ""), nil, :yellow
78
+ Bundler.ui.error <<~EOS, nil, :yellow
108
79
 
109
80
  First, try this link to see if there are any existing issue reports for this error:
110
81
  #{issues_url(e)}
111
82
 
112
- If there aren't any reports for this error yet, please copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
113
- https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md
83
+ If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}, and copy and paste the report template above in there.
84
+ EOS
85
+ end
86
+
87
+ def exception_message(error)
88
+ message = serialized_exception_for(error)
89
+ cause = error.cause
90
+ return message unless cause
91
+
92
+ message + serialized_exception_for(cause)
93
+ end
94
+
95
+ def serialized_exception_for(e)
96
+ <<~EOS
97
+ #{e.class}: #{e.message}
98
+ #{e.backtrace&.join("\n ")&.chomp}
114
99
  EOS
115
100
  end
116
101
 
@@ -121,6 +106,10 @@ module Bundler
121
106
  "https://github.com/rubygems/rubygems/search?q=" \
122
107
  "#{CGI.escape(message)}&type=Issues"
123
108
  end
109
+
110
+ def new_issue_url
111
+ "https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md"
112
+ end
124
113
  end
125
114
 
126
115
  def self.with_friendly_errors