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
@@ -12,6 +12,8 @@ module Bundler
12
12
  end
13
13
  File.open File.join(bundler_path, "setup.rb"), "w" do |file|
14
14
  file.puts "require 'rbconfig'"
15
+ file.puts prevent_gem_activation
16
+ file.puts define_path_helpers
15
17
  file.puts reverse_rubygems_kernel_mixin
16
18
  paths.each do |path|
17
19
  if Pathname.new(path).absolute?
@@ -26,44 +28,83 @@ module Bundler
26
28
  private
27
29
 
28
30
  def paths
29
- @specs.map do |spec|
31
+ @specs.flat_map do |spec|
30
32
  next if spec.name == "bundler"
31
33
  Array(spec.require_paths).map do |path|
32
- gem_path(path, spec).sub(version_dir, '#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}')
34
+ gem_path(path, spec).
35
+ sub(version_dir, '#{RUBY_ENGINE}/#{Gem.ruby_api_version}').
36
+ sub(extensions_dir, 'extensions/\k<platform>/#{Gem.extension_api_version}')
33
37
  # This is a static string intentionally. It's interpolated at a later time.
34
38
  end
35
- end.flatten.compact
39
+ end.compact
36
40
  end
37
41
 
38
42
  def version_dir
39
- "#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}"
43
+ "#{RUBY_ENGINE}/#{Gem.ruby_api_version}"
44
+ end
45
+
46
+ def extensions_dir
47
+ %r{extensions/(?<platform>[^/]+)/#{Regexp.escape(Gem.extension_api_version)}}
40
48
  end
41
49
 
42
50
  def bundler_path
43
- Bundler.root.join(Bundler.settings[:path], "bundler")
51
+ Bundler.root.join(Bundler.settings[:path].to_s, "bundler")
44
52
  end
45
53
 
46
54
  def gem_path(path, spec)
47
55
  full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
48
- if spec.source.instance_of?(Source::Path)
56
+ if spec.source.instance_of?(Source::Path) && spec.source.path.absolute?
49
57
  full_path
50
58
  else
51
- Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
59
+ SharedHelpers.relative_path_to(full_path, from: Bundler.root.join(bundler_path))
52
60
  end
53
- rescue TypeError
54
- error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
55
- raise Gem::InvalidSpecificationException.new(error_message)
61
+ end
62
+
63
+ def prevent_gem_activation
64
+ <<~'END'
65
+ module Kernel
66
+ remove_method(:gem) if private_method_defined?(:gem)
67
+
68
+ def gem(*)
69
+ end
70
+
71
+ private :gem
72
+ end
73
+ END
74
+ end
75
+
76
+ def define_path_helpers
77
+ <<~'END'
78
+ unless defined?(Gem)
79
+ module Gem
80
+ def self.ruby_api_version
81
+ RbConfig::CONFIG["ruby_version"]
82
+ end
83
+
84
+ def self.extension_api_version
85
+ if 'no' == RbConfig::CONFIG['ENABLE_SHARED']
86
+ "#{ruby_api_version}-static"
87
+ else
88
+ ruby_api_version
89
+ end
90
+ end
91
+ end
92
+ end
93
+ END
56
94
  end
57
95
 
58
96
  def reverse_rubygems_kernel_mixin
59
97
  <<~END
60
- kernel = (class << ::Kernel; self; end)
61
- [kernel, ::Kernel].each do |k|
62
- if k.private_method_defined?(:gem_original_require)
63
- private_require = k.private_method_defined?(:require)
64
- k.send(:remove_method, :require)
65
- k.send(:define_method, :require, k.instance_method(:gem_original_require))
66
- k.send(:private, :require) if private_require
98
+ if Gem.respond_to?(:discover_gems_on_require=)
99
+ Gem.discover_gems_on_require = false
100
+ else
101
+ [::Kernel.singleton_class, ::Kernel].each do |k|
102
+ if k.private_method_defined?(:gem_original_require)
103
+ private_require = k.private_method_defined?(:require)
104
+ k.send(:remove_method, :require)
105
+ k.send(:define_method, :require, k.instance_method(:gem_original_require))
106
+ k.send(:private, :require) if private_require
107
+ end
67
108
  end
68
109
  end
69
110
  END
@@ -13,7 +13,7 @@ module Bundler
13
13
  Installer.ambiguous_gems = []
14
14
  end
15
15
 
16
- attr_reader :post_install_messages
16
+ attr_reader :post_install_messages, :definition
17
17
 
18
18
  # Begins the installation process for Bundler.
19
19
  # For more information see the #run method on this class.
@@ -66,12 +66,10 @@ module Bundler
66
66
  # require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
67
67
  # information.
68
68
  def run(options)
69
- create_bundle_path
69
+ Bundler.create_bundle_path
70
70
 
71
71
  ProcessLock.lock do
72
- if Bundler.frozen_bundle?
73
- @definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
74
- end
72
+ @definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
75
73
 
76
74
  if @definition.dependencies.empty?
77
75
  Bundler.ui.warn "The Gemfile specifies no dependencies"
@@ -79,18 +77,15 @@ module Bundler
79
77
  return
80
78
  end
81
79
 
82
- if resolve_if_needed(options)
80
+ if @definition.setup_domain!(options)
83
81
  ensure_specs_are_compatible!
84
- load_plugins
85
- options.delete(:jobs)
86
- else
87
- options[:jobs] = 1 # to avoid the overhead of Bundler::Worker
82
+ Bundler.load_plugins(@definition)
88
83
  end
89
84
  install(options)
90
85
 
91
86
  Gem::Specification.reset # invalidate gem specification cache so that installed gems are immediately available
92
87
 
93
- lock unless Bundler.frozen_bundle?
88
+ lock
94
89
  Standalone.new(options[:standalone], @definition).generate if options[:standalone]
95
90
  end
96
91
  end
@@ -119,7 +114,7 @@ module Bundler
119
114
  relative_gemfile_path = relative_gemfile_path
120
115
  ruby_command = Thor::Util.ruby_command
121
116
  ruby_command = ruby_command
122
- template_path = File.expand_path("../templates/Executable", __FILE__)
117
+ template_path = File.expand_path("templates/Executable", __dir__)
123
118
  if spec.name == "bundler"
124
119
  template_path += ".bundler"
125
120
  spec.executables = %(bundle)
@@ -136,16 +131,12 @@ module Bundler
136
131
 
137
132
  mode = Gem.win_platform? ? "wb:UTF-8" : "w"
138
133
  require "erb"
139
- content = if RUBY_VERSION >= "2.6"
140
- ERB.new(template, :trim_mode => "-").result(binding)
141
- else
142
- ERB.new(template, nil, "-").result(binding)
143
- end
134
+ content = ERB.new(template, trim_mode: "-").result(binding)
144
135
 
145
- File.write(binstub_path, content, :mode => mode, :perm => 0o777 & ~File.umask)
136
+ File.write(binstub_path, content, mode: mode, perm: 0o777 & ~File.umask)
146
137
  if Gem.win_platform? || options[:all_platforms]
147
138
  prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
148
- File.write("#{binstub_path}.cmd", prefix + content, :mode => mode)
139
+ File.write("#{binstub_path}.cmd", prefix + content, mode: mode)
149
140
  end
150
141
  end
151
142
 
@@ -172,7 +163,7 @@ module Bundler
172
163
  end
173
164
  standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
174
165
  standalone_path = standalone_path
175
- template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__))
166
+ template = File.read(File.expand_path("templates/Executable.standalone", __dir__))
176
167
  ruby_command = Thor::Util.ruby_command
177
168
  ruby_command = ruby_command
178
169
 
@@ -183,16 +174,12 @@ module Bundler
183
174
 
184
175
  mode = Gem.win_platform? ? "wb:UTF-8" : "w"
185
176
  require "erb"
186
- content = if RUBY_VERSION >= "2.6"
187
- ERB.new(template, :trim_mode => "-").result(binding)
188
- else
189
- ERB.new(template, nil, "-").result(binding)
190
- end
177
+ content = ERB.new(template, trim_mode: "-").result(binding)
191
178
 
192
- File.write("#{bin_path}/#{executable}", content, :mode => mode, :perm => 0o755)
179
+ File.write("#{bin_path}/#{executable}", content, mode: mode, perm: 0o755)
193
180
  if Gem.win_platform? || options[:all_platforms]
194
181
  prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
195
- File.write("#{bin_path}/#{executable}.cmd", prefix + content, :mode => mode)
182
+ File.write("#{bin_path}/#{executable}.cmd", prefix + content, mode: mode)
196
183
  end
197
184
  end
198
185
  end
@@ -204,88 +191,39 @@ module Bundler
204
191
  # that said, it's a rare situation (other than rake), and parallel
205
192
  # installation is SO MUCH FASTER. so we let people opt in.
206
193
  def install(options)
207
- force = options["force"]
208
- jobs = installation_parallelization(options)
209
- install_in_parallel jobs, options[:standalone], force
210
- end
211
-
212
- def installation_parallelization(options)
213
- if jobs = options.delete(:jobs)
214
- return jobs
194
+ standalone = options[:standalone]
195
+ force = options[:force]
196
+ local = options[:local]
197
+ jobs = installation_parallelization
198
+ spec_installations = ParallelInstaller.call(self, @definition.specs, jobs, standalone, force, local: local)
199
+ spec_installations.each do |installation|
200
+ post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
215
201
  end
202
+ end
216
203
 
204
+ def installation_parallelization
217
205
  if jobs = Bundler.settings[:jobs]
218
206
  return jobs
219
207
  end
220
208
 
221
- # Parallelization has some issues on Windows, so it's not yet the default
222
- return 1 if Gem.win_platform?
223
-
224
209
  Bundler.settings.processor_count
225
210
  end
226
211
 
227
- def load_plugins
228
- Bundler.rubygems.load_plugins
229
-
230
- requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
231
- path_plugin_files = requested_path_gems.map do |spec|
232
- begin
233
- Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
234
- rescue TypeError
235
- error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
236
- raise Gem::InvalidSpecificationException, error_message
237
- end
238
- end.flatten
239
- Bundler.rubygems.load_plugin_files(path_plugin_files)
240
- Bundler.rubygems.load_env_plugins
241
- end
242
-
243
212
  def ensure_specs_are_compatible!
244
- system_ruby = Bundler::RubyVersion.system
245
- rubygems_version = Gem::Version.create(Gem::VERSION)
246
213
  @definition.specs.each do |spec|
247
- if required_ruby_version = spec.required_ruby_version
248
- unless required_ruby_version.satisfied_by?(system_ruby.gem_version)
249
- raise InstallError, "#{spec.full_name} requires ruby version #{required_ruby_version}, " \
250
- "which is incompatible with the current version, #{system_ruby}"
251
- end
214
+ unless spec.matches_current_ruby?
215
+ raise InstallError, "#{spec.full_name} requires ruby version #{spec.required_ruby_version}, " \
216
+ "which is incompatible with the current version, #{Gem.ruby_version}"
252
217
  end
253
- next unless required_rubygems_version = spec.required_rubygems_version
254
- unless required_rubygems_version.satisfied_by?(rubygems_version)
255
- raise InstallError, "#{spec.full_name} requires rubygems version #{required_rubygems_version}, " \
256
- "which is incompatible with the current version, #{rubygems_version}"
218
+ unless spec.matches_current_rubygems?
219
+ raise InstallError, "#{spec.full_name} requires rubygems version #{spec.required_rubygems_version}, " \
220
+ "which is incompatible with the current version, #{Gem.rubygems_version}"
257
221
  end
258
222
  end
259
223
  end
260
224
 
261
- def install_in_parallel(size, standalone, force = false)
262
- spec_installations = ParallelInstaller.call(self, @definition.specs, size, standalone, force)
263
- spec_installations.each do |installation|
264
- post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
265
- end
266
- end
267
-
268
- def create_bundle_path
269
- SharedHelpers.filesystem_access(Bundler.bundle_path.to_s) do |p|
270
- Bundler.mkdir_p(p)
271
- end unless Bundler.bundle_path.exist?
272
- rescue Errno::EEXIST
273
- raise PathError, "Could not install to path `#{Bundler.bundle_path}` " \
274
- "because a file already exists at that path. Either remove or rename the file so the directory can be created."
275
- end
276
-
277
- # returns whether or not a re-resolve was needed
278
- def resolve_if_needed(options)
279
- if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
280
- return false if @definition.nothing_changed? && !@definition.missing_specs?
281
- end
282
-
283
- options["local"] ? @definition.resolve_with_cache! : @definition.resolve_remotely!
284
- true
285
- end
286
-
287
- def lock(opts = {})
288
- @definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
225
+ def lock
226
+ @definition.lock
289
227
  end
290
228
  end
291
229
  end
@@ -1,55 +1,117 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "match_platform"
3
+ require_relative "force_platform"
4
4
 
5
5
  module Bundler
6
6
  class LazySpecification
7
+ include MatchMetadata
7
8
  include MatchPlatform
9
+ include ForcePlatform
8
10
 
9
- attr_reader :name, :version, :dependencies, :platform
10
- attr_accessor :source, :remote
11
+ attr_reader :name, :version, :platform, :materialization
12
+ attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version
13
+
14
+ #
15
+ # For backwards compatibility with existing lockfiles, if the most specific
16
+ # locked platform is not a specific platform like x86_64-linux or
17
+ # universal-java-11, then we keep the previous behaviour of resolving the
18
+ # best platform variant at materiliazation time. For previous bundler
19
+ # versions (before 2.2.0) this was always the case (except when the lockfile
20
+ # only included non-ruby platforms), but we're also keeping this behaviour
21
+ # on newer bundlers unless users generate the lockfile from scratch or
22
+ # explicitly add a more specific platform.
23
+ #
24
+ attr_accessor :most_specific_locked_platform
25
+
26
+ alias_method :runtime_dependencies, :dependencies
27
+
28
+ def self.from_spec(s)
29
+ lazy_spec = new(s.name, s.version, s.platform, s.source)
30
+ lazy_spec.dependencies = s.runtime_dependencies
31
+ lazy_spec.required_ruby_version = s.required_ruby_version
32
+ lazy_spec.required_rubygems_version = s.required_rubygems_version
33
+ lazy_spec
34
+ end
11
35
 
12
36
  def initialize(name, version, platform, source = nil)
13
37
  @name = name
14
38
  @version = version
15
39
  @dependencies = []
16
- @platform = platform || Gem::Platform::RUBY
17
- @source = source
18
- @specification = nil
40
+ @required_ruby_version = Gem::Requirement.default
41
+ @required_rubygems_version = Gem::Requirement.default
42
+ @platform = platform || Gem::Platform::RUBY
43
+
44
+ @original_source = source
45
+ @source = source
46
+
47
+ @force_ruby_platform = default_force_ruby_platform
48
+ @most_specific_locked_platform = nil
49
+ @materialization = nil
50
+ end
51
+
52
+ def missing?
53
+ @materialization == self
54
+ end
55
+
56
+ def incomplete?
57
+ @materialization.nil?
58
+ end
59
+
60
+ def source_changed?
61
+ @original_source != source
19
62
  end
20
63
 
21
64
  def full_name
22
- if platform == Gem::Platform::RUBY || platform.nil?
65
+ @full_name ||= if platform == Gem::Platform::RUBY
23
66
  "#{@name}-#{@version}"
24
67
  else
25
68
  "#{@name}-#{@version}-#{platform}"
26
69
  end
27
70
  end
28
71
 
72
+ def lock_name
73
+ @lock_name ||= name_tuple.lock_name
74
+ end
75
+
76
+ def name_tuple
77
+ Gem::NameTuple.new(@name, @version, @platform)
78
+ end
79
+
29
80
  def ==(other)
30
- identifier == other.identifier
81
+ full_name == other.full_name
31
82
  end
32
83
 
33
84
  def eql?(other)
34
- identifier.eql?(other.identifier)
85
+ full_name.eql?(other.full_name)
35
86
  end
36
87
 
37
88
  def hash
38
- identifier.hash
89
+ full_name.hash
39
90
  end
40
91
 
92
+ ##
93
+ # Does this locked specification satisfy +dependency+?
94
+ #
95
+ # NOTE: Rubygems default requirement is ">= 0", which doesn't match
96
+ # prereleases of 0 versions, like "0.0.0.dev" or "0.0.0.SNAPSHOT". However,
97
+ # bundler users expect those to work. We need to make sure that Gemfile
98
+ # dependencies without explicit requirements (which use ">= 0" under the
99
+ # hood by default) are still valid for locked specs using this kind of
100
+ # versions. The method implements an ad-hoc fix for that. A better solution
101
+ # might be to change default rubygems requirement of dependencies to be ">=
102
+ # 0.A" but that's a major refactoring likely to break things. Hopefully we
103
+ # can attempt it in the future.
104
+ #
105
+
41
106
  def satisfies?(dependency)
42
- @name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
107
+ effective_requirement = dependency.requirement == Gem::Requirement.default ? Gem::Requirement.new(">= 0.A") : dependency.requirement
108
+
109
+ @name == dependency.name && effective_requirement.satisfied_by?(Gem::Version.new(@version))
43
110
  end
44
111
 
45
112
  def to_lock
46
113
  out = String.new
47
-
48
- if platform == Gem::Platform::RUBY || platform.nil?
49
- out << " #{name} (#{version})\n"
50
- else
51
- out << " #{name} (#{version}-#{platform})\n"
52
- end
114
+ out << " #{lock_name}\n"
53
115
 
54
116
  dependencies.sort_by(&:to_s).uniq.each do |dep|
55
117
  next if dep.type == :development
@@ -59,45 +121,80 @@ module Bundler
59
121
  out
60
122
  end
61
123
 
62
- def __materialize__
63
- @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
64
- source.gemspec.tap {|s| s.source = source }
124
+ def materialize_strictly
125
+ source.local!
126
+
127
+ matching_specs = source.specs.search(self)
128
+ return self if matching_specs.empty?
129
+
130
+ __materialize__(matching_specs)
131
+ end
132
+
133
+ def materialized_for_installation
134
+ @materialization = materialize_for_installation
135
+
136
+ self unless incomplete?
137
+ end
138
+
139
+ def materialize_for_installation
140
+ source.local!
141
+
142
+ if use_exact_resolved_specifications?
143
+ materialize_strictly
65
144
  else
66
- search_object = if source.is_a?(Source::Path)
67
- Dependency.new(name, version)
68
- else
69
- ruby_platform_materializes_to_ruby_platform? ? self : Dependency.new(name, version)
70
- end
71
- platform_object = Gem::Platform.new(platform)
72
- candidates = source.specs.search(search_object)
73
- same_platform_candidates = candidates.select do |spec|
74
- MatchPlatform.platforms_match?(spec.platform, platform_object)
75
- end
76
- installable_candidates = same_platform_candidates.select do |spec|
77
- !spec.is_a?(EndpointSpecification) ||
78
- (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
79
- spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
145
+ matching_specs = source.specs.search([name, version])
146
+ return self if matching_specs.empty?
147
+
148
+ target_platform = source.is_a?(Source::Path) ? platform : local_platform
149
+
150
+ installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
151
+
152
+ specification = __materialize__(installable_candidates, fallback_to_non_installable: false)
153
+ return specification unless specification.nil?
154
+
155
+ if target_platform != platform
156
+ installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
80
157
  end
81
- search = installable_candidates.last || same_platform_candidates.last
82
- search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
83
- search
158
+
159
+ __materialize__(installable_candidates)
84
160
  end
85
161
  end
86
162
 
87
- def respond_to?(*args)
88
- super || @specification ? @specification.respond_to?(*args) : nil
89
- end
163
+ # If in frozen mode, we fallback to a non-installable candidate because by
164
+ # doing this we avoid re-resolving and potentially end up changing the
165
+ # lock file, which is not allowed. In that case, we will give a proper error
166
+ # about the mismatch higher up the stack, right before trying to install the
167
+ # bad gem.
168
+ def __materialize__(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
169
+ search = candidates.reverse.find do |spec|
170
+ spec.is_a?(StubSpecification) || spec.matches_current_metadata?
171
+ end
172
+ if search.nil? && fallback_to_non_installable
173
+ search = candidates.last
174
+ elsif search && search.full_name == full_name
175
+ # We don't validate locally installed dependencies but accept what's in
176
+ # the lockfile instead for performance, since loading locally installed
177
+ # dependencies would mean evaluating all gemspecs, which would affect
178
+ # `bundler/setup` performance
179
+ if search.is_a?(StubSpecification)
180
+ search.dependencies = dependencies
181
+ else
182
+ if !source.is_a?(Source::Path) && search.runtime_dependencies.sort != dependencies.sort
183
+ raise IncorrectLockfileDependencies.new(self)
184
+ end
90
185
 
91
- def to_s
92
- @__to_s ||= if platform == Gem::Platform::RUBY || platform.nil?
93
- "#{name} (#{version})"
94
- else
95
- "#{name} (#{version}-#{platform})"
186
+ search.locked_platform = platform if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification)
187
+ end
96
188
  end
189
+ search
97
190
  end
98
191
 
99
- def identifier
100
- @__identifier ||= [name, version, platform_string]
192
+ def inspect
193
+ "#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>"
194
+ end
195
+
196
+ def to_s
197
+ lock_name
101
198
  end
102
199
 
103
200
  def git_version
@@ -105,38 +202,20 @@ module Bundler
105
202
  " #{source.revision[0..6]}"
106
203
  end
107
204
 
108
- protected
109
-
110
- def platform_string
111
- platform_string = platform.to_s
112
- platform_string == Index::RUBY ? Index::NULL : platform_string
205
+ def force_ruby_platform!
206
+ @force_ruby_platform = true
113
207
  end
114
208
 
115
209
  private
116
210
 
117
- def to_ary
118
- nil
211
+ def use_exact_resolved_specifications?
212
+ !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
119
213
  end
120
214
 
121
- def method_missing(method, *args, &blk)
122
- raise "LazySpecification has not been materialized yet (calling :#{method} #{args.inspect})" unless @specification
123
-
124
- return super unless respond_to?(method)
125
-
126
- @specification.send(method, *args, &blk)
127
- end
128
-
129
- #
130
- # For backwards compatibility with existing lockfiles, if the most specific
131
- # locked platform is RUBY, we keep the previous behaviour of resolving the
132
- # best platform variant at materiliazation time. For previous bundler
133
- # versions (before 2.2.0) this was always the case (except when the lockfile
134
- # only included non-ruby platforms), but we're also keeping this behaviour
135
- # on newer bundlers unless users generate the lockfile from scratch or
136
- # explicitly add a more specific platform.
137
- #
138
215
  def ruby_platform_materializes_to_ruby_platform?
139
- !Bundler.most_specific_locked_platform?(Gem::Platform::RUBY) || Bundler.settings[:force_ruby_platform]
216
+ generic_platform = generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
217
+
218
+ (most_specific_locked_platform != generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
140
219
  end
141
220
  end
142
221
  end
@@ -19,6 +19,7 @@ module Bundler
19
19
  add_sources
20
20
  add_platforms
21
21
  add_dependencies
22
+ add_checksums
22
23
  add_locked_ruby_version
23
24
  add_bundled_with
24
25
 
@@ -28,7 +29,7 @@ module Bundler
28
29
  private
29
30
 
30
31
  def add_sources
31
- definition.send(:sources).lock_sources.each_with_index do |source, idx|
32
+ definition.sources.lock_sources.each_with_index do |source, idx|
32
33
  out << "\n" unless idx.zero?
33
34
 
34
35
  # Add the source header
@@ -45,7 +46,7 @@ module Bundler
45
46
  # gems with the same name, but different platform
46
47
  # are ordered consistently
47
48
  specs.sort_by(&:full_name).each do |spec|
48
- next if spec.name == "bundler".freeze
49
+ next if spec.name == "bundler"
49
50
  out << spec.to_lock
50
51
  end
51
52
  end
@@ -60,18 +61,26 @@ module Bundler
60
61
  handled = []
61
62
  definition.dependencies.sort_by(&:to_s).each do |dep|
62
63
  next if handled.include?(dep.name)
63
- out << dep.to_lock
64
+ out << dep.to_lock << "\n"
64
65
  handled << dep.name
65
66
  end
66
67
  end
67
68
 
69
+ def add_checksums
70
+ return unless definition.locked_checksums
71
+ checksums = definition.resolve.map do |spec|
72
+ spec.source.checksum_store.to_lock(spec)
73
+ end
74
+ add_section("CHECKSUMS", checksums)
75
+ end
76
+
68
77
  def add_locked_ruby_version
69
78
  return unless locked_ruby_version = definition.locked_ruby_version
70
79
  add_section("RUBY VERSION", locked_ruby_version.to_s)
71
80
  end
72
81
 
73
82
  def add_bundled_with
74
- add_section("BUNDLED WITH", definition.locked_bundler_version.to_s)
83
+ add_section("BUNDLED WITH", definition.bundler_version_to_lock.to_s)
75
84
  end
76
85
 
77
86
  def add_section(name, value)