bundler 1.17.2 → 2.2.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (322) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2095 -1251
  3. data/LICENSE.md +18 -19
  4. data/README.md +10 -11
  5. data/bundler.gemspec +10 -28
  6. data/exe/bundle +22 -3
  7. data/lib/bundler/build_metadata.rb +4 -12
  8. data/lib/bundler/capistrano.rb +4 -4
  9. data/lib/bundler/cli/add.rb +28 -16
  10. data/lib/bundler/cli/binstubs.rb +6 -2
  11. data/lib/bundler/cli/cache.rb +24 -17
  12. data/lib/bundler/cli/check.rb +4 -2
  13. data/lib/bundler/cli/clean.rb +1 -1
  14. data/lib/bundler/cli/common.rb +39 -13
  15. data/lib/bundler/cli/config.rb +161 -86
  16. data/lib/bundler/cli/console.rb +1 -1
  17. data/lib/bundler/cli/doctor.rb +20 -9
  18. data/lib/bundler/cli/exec.rb +8 -25
  19. data/lib/bundler/cli/fund.rb +36 -0
  20. data/lib/bundler/cli/gem.rb +213 -32
  21. data/lib/bundler/cli/info.rb +42 -7
  22. data/lib/bundler/cli/init.rb +2 -2
  23. data/lib/bundler/cli/inject.rb +1 -1
  24. data/lib/bundler/cli/install.rb +34 -44
  25. data/lib/bundler/cli/issue.rb +8 -7
  26. data/lib/bundler/cli/list.rb +19 -11
  27. data/lib/bundler/cli/lock.rb +5 -1
  28. data/lib/bundler/cli/open.rb +11 -8
  29. data/lib/bundler/cli/outdated.rb +142 -118
  30. data/lib/bundler/cli/plugin.rb +19 -2
  31. data/lib/bundler/cli/pristine.rb +6 -1
  32. data/lib/bundler/cli/remove.rb +1 -2
  33. data/lib/bundler/cli/show.rb +2 -2
  34. data/lib/bundler/cli/update.rb +43 -16
  35. data/lib/bundler/cli.rb +211 -150
  36. data/lib/bundler/compact_index_client/cache.rb +6 -14
  37. data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  38. data/lib/bundler/compact_index_client/updater.rb +15 -28
  39. data/lib/bundler/compact_index_client.rb +28 -12
  40. data/lib/bundler/current_ruby.rb +14 -11
  41. data/lib/bundler/definition.rb +207 -368
  42. data/lib/bundler/dep_proxy.rb +16 -9
  43. data/lib/bundler/dependency.rb +19 -14
  44. data/lib/bundler/deployment.rb +1 -1
  45. data/lib/bundler/digest.rb +71 -0
  46. data/lib/bundler/dsl.rb +81 -81
  47. data/lib/bundler/endpoint_specification.rb +1 -1
  48. data/lib/bundler/env.rb +9 -14
  49. data/lib/bundler/environment_preserver.rb +29 -3
  50. data/lib/bundler/errors.rb +20 -3
  51. data/lib/bundler/feature_flag.rb +14 -33
  52. data/lib/bundler/fetcher/base.rb +1 -1
  53. data/lib/bundler/fetcher/compact_index.rb +28 -14
  54. data/lib/bundler/fetcher/dependency.rb +1 -1
  55. data/lib/bundler/fetcher/downloader.rb +14 -8
  56. data/lib/bundler/fetcher/index.rb +8 -8
  57. data/lib/bundler/fetcher.rb +22 -17
  58. data/lib/bundler/friendly_errors.rb +29 -48
  59. data/lib/bundler/gem_helper.rb +79 -43
  60. data/lib/bundler/gem_helpers.rb +38 -29
  61. data/lib/bundler/gem_tasks.rb +1 -1
  62. data/lib/bundler/gem_version_promoter.rb +5 -5
  63. data/lib/bundler/graph.rb +3 -3
  64. data/lib/bundler/index.rb +9 -9
  65. data/lib/bundler/injector.rb +33 -13
  66. data/lib/bundler/inline.rb +41 -30
  67. data/lib/bundler/installer/gem_installer.rb +9 -18
  68. data/lib/bundler/installer/parallel_installer.rb +50 -33
  69. data/lib/bundler/installer/standalone.rb +30 -11
  70. data/lib/bundler/installer.rb +39 -66
  71. data/lib/bundler/lazy_specification.rb +63 -28
  72. data/lib/bundler/lockfile_generator.rb +1 -1
  73. data/lib/bundler/lockfile_parser.rb +19 -52
  74. data/lib/bundler/{ssl_certs → man}/.document +0 -0
  75. data/{man → lib/bundler/man}/bundle-add.1 +10 -2
  76. data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
  77. data/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
  78. data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
  79. data/lib/bundler/man/bundle-cache.1 +55 -0
  80. data/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
  81. data/{man → lib/bundler/man}/bundle-check.1 +1 -1
  82. data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  83. data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
  84. data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
  85. data/{man → lib/bundler/man}/bundle-config.1 +59 -60
  86. data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +77 -78
  87. data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  88. data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  89. data/{man → lib/bundler/man}/bundle-exec.1 +2 -2
  90. data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
  91. data/{man → lib/bundler/man}/bundle-gem.1 +38 -3
  92. data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
  93. data/{man → lib/bundler/man}/bundle-info.1 +1 -1
  94. data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  95. data/{man → lib/bundler/man}/bundle-init.1 +2 -2
  96. data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
  97. data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
  98. data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
  99. data/{man → lib/bundler/man}/bundle-install.1 +37 -7
  100. data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
  101. data/{man → lib/bundler/man}/bundle-list.1 +7 -7
  102. data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  103. data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  104. data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  105. data/{man → lib/bundler/man}/bundle-open.1 +1 -1
  106. data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
  107. data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
  108. data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
  109. data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
  110. data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
  111. data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  112. data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  113. data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  114. data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  115. data/{man → lib/bundler/man}/bundle-show.1 +1 -1
  116. data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
  117. data/{man → lib/bundler/man}/bundle-update.1 +7 -7
  118. data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +6 -6
  119. data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
  120. data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
  121. data/{man → lib/bundler/man}/bundle.1 +7 -3
  122. data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +5 -2
  123. data/{man → lib/bundler/man}/gemfile.5 +44 -21
  124. data/{man → lib/bundler/man}/gemfile.5.ronn +24 -20
  125. data/{man → lib/bundler/man}/index.txt +1 -1
  126. data/lib/bundler/match_platform.rb +1 -1
  127. data/lib/bundler/mirror.rb +5 -5
  128. data/lib/bundler/plugin/api/source.rb +27 -7
  129. data/lib/bundler/plugin/api.rb +1 -1
  130. data/lib/bundler/plugin/dsl.rb +1 -1
  131. data/lib/bundler/plugin/index.rb +27 -4
  132. data/lib/bundler/plugin/installer/rubygems.rb +1 -1
  133. data/lib/bundler/plugin/installer.rb +35 -22
  134. data/lib/bundler/plugin/source_list.rb +5 -1
  135. data/lib/bundler/plugin.rb +100 -42
  136. data/lib/bundler/psyched_yaml.rb +0 -15
  137. data/lib/bundler/remote_specification.rb +5 -4
  138. data/lib/bundler/resolver/spec_group.rb +57 -53
  139. data/lib/bundler/resolver.rb +127 -113
  140. data/lib/bundler/retry.rb +4 -4
  141. data/lib/bundler/ruby_version.rb +5 -20
  142. data/lib/bundler/rubygems_ext.rb +103 -79
  143. data/lib/bundler/rubygems_gem_installer.rb +69 -8
  144. data/lib/bundler/rubygems_integration.rb +181 -446
  145. data/lib/bundler/runtime.rb +24 -34
  146. data/lib/bundler/settings.rb +159 -110
  147. data/lib/bundler/setup.rb +11 -12
  148. data/lib/bundler/shared_helpers.rb +56 -90
  149. data/lib/bundler/similarity_detector.rb +3 -3
  150. data/lib/bundler/source/git/git_proxy.rb +106 -105
  151. data/lib/bundler/source/git.rb +66 -39
  152. data/lib/bundler/source/metadata.rb +9 -9
  153. data/lib/bundler/source/path/installer.rb +10 -10
  154. data/lib/bundler/source/path.rb +23 -12
  155. data/lib/bundler/source/rubygems/remote.rb +3 -4
  156. data/lib/bundler/source/rubygems.rb +136 -120
  157. data/lib/bundler/source/rubygems_aggregate.rb +68 -0
  158. data/lib/bundler/source.rb +27 -6
  159. data/lib/bundler/source_list.rb +101 -66
  160. data/lib/bundler/source_map.rb +58 -0
  161. data/lib/bundler/spec_set.rb +49 -53
  162. data/lib/bundler/stub_specification.rb +40 -34
  163. data/lib/bundler/templates/Executable.bundler +24 -15
  164. data/lib/bundler/templates/Gemfile +1 -1
  165. data/lib/bundler/templates/gems.rb +1 -1
  166. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  167. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  168. data/lib/bundler/templates/newgem/Gemfile.tt +19 -2
  169. data/lib/bundler/templates/newgem/README.md.tt +7 -5
  170. data/lib/bundler/templates/newgem/Rakefile.tt +23 -5
  171. data/lib/bundler/templates/newgem/bin/console.tt +1 -0
  172. data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
  173. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
  174. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +27 -0
  175. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  176. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  177. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  178. data/lib/bundler/templates/newgem/newgem.gemspec.tt +29 -40
  179. data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  180. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  181. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  182. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  183. data/lib/bundler/templates/newgem/standard.yml.tt +2 -0
  184. data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
  185. data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
  186. data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  187. data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  188. data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
  189. data/lib/bundler/ui/rg_proxy.rb +1 -1
  190. data/lib/bundler/ui/shell.rb +7 -11
  191. data/lib/bundler/ui.rb +3 -3
  192. data/lib/bundler/uri_credentials_filter.rb +10 -4
  193. data/lib/bundler/vendor/.document +1 -0
  194. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  195. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
  196. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
  197. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  198. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +126 -0
  199. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  200. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
  201. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  202. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  203. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  204. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  205. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  206. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  207. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
  208. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  209. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
  210. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
  211. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +38 -6
  212. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
  213. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  214. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
  215. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
  216. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
  217. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
  218. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  219. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
  220. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
  221. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
  222. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
  223. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  224. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
  225. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
  226. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
  227. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +20 -9
  228. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
  229. data/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
  230. data/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
  231. data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
  232. data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
  233. data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
  234. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
  235. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
  236. data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
  237. data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
  238. data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  239. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
  240. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
  241. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +21 -5
  242. data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
  243. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
  244. data/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
  245. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +65 -8
  246. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
  247. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
  248. data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
  249. data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
  250. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  251. data/lib/bundler/vendor/thor/lib/thor.rb +16 -9
  252. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
  253. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  254. data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
  255. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  256. data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  257. data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  258. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  259. data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  260. data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  261. data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  262. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  263. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  264. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  265. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  266. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  267. data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  268. data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  269. data/lib/bundler/vendored_fileutils.rb +1 -6
  270. data/lib/bundler/vendored_molinillo.rb +1 -1
  271. data/lib/bundler/vendored_persistent.rb +7 -12
  272. data/lib/bundler/vendored_thor.rb +2 -2
  273. data/lib/bundler/vendored_tmpdir.rb +4 -0
  274. data/lib/bundler/vendored_tsort.rb +4 -0
  275. data/lib/bundler/vendored_uri.rb +4 -0
  276. data/lib/bundler/version.rb +1 -20
  277. data/lib/bundler/version_ranges.rb +51 -5
  278. data/lib/bundler/vlad.rb +2 -2
  279. data/lib/bundler/worker.rb +21 -8
  280. data/lib/bundler/yaml_serializer.rb +3 -4
  281. data/lib/bundler.rb +248 -118
  282. metadata +115 -190
  283. data/exe/bundle_ruby +0 -60
  284. data/lib/bundler/cli/package.rb +0 -49
  285. data/lib/bundler/compatibility_guard.rb +0 -14
  286. data/lib/bundler/gem_remote_fetcher.rb +0 -43
  287. data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
  288. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
  289. data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  290. data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  291. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
  292. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  293. data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
  294. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
  295. data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
  296. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
  297. data/man/bundle-add.1.txt +0 -52
  298. data/man/bundle-binstubs.1.txt +0 -48
  299. data/man/bundle-check.1.txt +0 -33
  300. data/man/bundle-clean.1.txt +0 -26
  301. data/man/bundle-config.1.txt +0 -529
  302. data/man/bundle-doctor.1.txt +0 -44
  303. data/man/bundle-exec.1.txt +0 -178
  304. data/man/bundle-gem.1.txt +0 -91
  305. data/man/bundle-info.1.txt +0 -21
  306. data/man/bundle-init.1.txt +0 -34
  307. data/man/bundle-inject.1.txt +0 -32
  308. data/man/bundle-install.1.txt +0 -396
  309. data/man/bundle-list.1.txt +0 -43
  310. data/man/bundle-lock.1.txt +0 -93
  311. data/man/bundle-open.1.txt +0 -29
  312. data/man/bundle-outdated.1.txt +0 -131
  313. data/man/bundle-package.1 +0 -55
  314. data/man/bundle-package.1.txt +0 -79
  315. data/man/bundle-platform.1.txt +0 -57
  316. data/man/bundle-pristine.1.txt +0 -44
  317. data/man/bundle-remove.1.txt +0 -34
  318. data/man/bundle-show.1.txt +0 -27
  319. data/man/bundle-update.1.txt +0 -391
  320. data/man/bundle-viz.1.txt +0 -39
  321. data/man/bundle.1.txt +0 -113
  322. data/man/gemfile.5.txt +0 -653
@@ -5,24 +5,49 @@ module Bundler
5
5
  attr_reader :path_sources,
6
6
  :git_sources,
7
7
  :plugin_sources,
8
- :global_rubygems_source,
8
+ :global_path_source,
9
9
  :metadata_source
10
10
 
11
+ def global_rubygems_source
12
+ @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
13
+ end
14
+
11
15
  def initialize
12
16
  @path_sources = []
13
17
  @git_sources = []
14
18
  @plugin_sources = []
15
19
  @global_rubygems_source = nil
16
- @rubygems_aggregate = rubygems_aggregate_class.new
20
+ @global_path_source = nil
17
21
  @rubygems_sources = []
18
22
  @metadata_source = Source::Metadata.new
23
+
24
+ @merged_gem_lockfile_sections = false
25
+ end
26
+
27
+ def merged_gem_lockfile_sections?
28
+ @merged_gem_lockfile_sections
29
+ end
30
+
31
+ def merged_gem_lockfile_sections!(replacement_source)
32
+ @merged_gem_lockfile_sections = true
33
+ @global_rubygems_source = replacement_source
34
+ end
35
+
36
+ def aggregate_global_source?
37
+ global_rubygems_source.multiple_remotes?
38
+ end
39
+
40
+ def implicit_global_source?
41
+ global_rubygems_source.no_remotes?
19
42
  end
20
43
 
21
44
  def add_path_source(options = {})
22
45
  if options["gemspec"]
23
46
  add_source_to_list Source::Gemspec.new(options), path_sources
24
47
  else
25
- add_source_to_list Source::Path.new(options), path_sources
48
+ path_source = add_source_to_list Source::Path.new(options), path_sources
49
+ @global_path_source ||= path_source if options["global"]
50
+ path_source
26
51
  end
27
52
  end
28
53
 
@@ -33,35 +58,31 @@ module Bundler
33
58
  end
34
59
 
35
60
  def add_rubygems_source(options = {})
36
- add_source_to_list Source::Rubygems.new(options), @rubygems_sources
61
+ new_source = Source::Rubygems.new(options)
62
+ return @global_rubygems_source if @global_rubygems_source == new_source
63
+
64
+ add_source_to_list new_source, @rubygems_sources
37
65
  end
38
66
 
39
67
  def add_plugin_source(source, options = {})
40
68
  add_source_to_list Plugin.source(source).new(options), @plugin_sources
41
69
  end
42
70
 
43
- def global_rubygems_source=(uri)
44
- if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
45
- @global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
46
- end
47
- add_rubygems_remote(uri)
48
- end
49
-
50
- def add_rubygems_remote(uri)
51
- if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
52
- return if Bundler.feature_flag.disable_multisource?
53
- raise InvalidOption, "`lockfile_uses_separate_rubygems_sources` cannot be set without `disable_multisource` being set"
54
- end
55
- @rubygems_aggregate.add_remote(uri)
56
- @rubygems_aggregate
71
+ def add_global_rubygems_remote(uri)
72
+ global_rubygems_source.add_remote(uri)
73
+ global_rubygems_source
57
74
  end
58
75
 
59
76
  def default_source
60
- global_rubygems_source || @rubygems_aggregate
77
+ global_path_source || global_rubygems_source
61
78
  end
62
79
 
63
80
  def rubygems_sources
64
- @rubygems_sources + [default_source]
81
+ non_global_rubygems_sources + [global_rubygems_source]
82
+ end
83
+
84
+ def non_global_rubygems_sources
85
+ @rubygems_sources
65
86
  end
66
87
 
67
88
  def rubygems_remotes
@@ -72,39 +93,51 @@ module Bundler
72
93
  path_sources + git_sources + plugin_sources + rubygems_sources + [metadata_source]
73
94
  end
74
95
 
96
+ def non_default_explicit_sources
97
+ all_sources - [default_source, metadata_source]
98
+ end
99
+
75
100
  def get(source)
76
- source_list_for(source).find {|s| equal_source?(source, s) || equivalent_source?(source, s) }
101
+ source_list_for(source).find {|s| equivalent_source?(source, s) }
77
102
  end
78
103
 
79
104
  def lock_sources
80
- if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
81
- [[default_source], @rubygems_sources, git_sources, path_sources, plugin_sources].map do |sources|
82
- sources.sort_by(&:to_s)
83
- end.flatten(1)
105
+ lock_other_sources + lock_rubygems_sources
106
+ end
107
+
108
+ def lock_other_sources
109
+ (path_sources + git_sources + plugin_sources).sort_by(&:identifier)
110
+ end
111
+
112
+ def lock_rubygems_sources
113
+ if merged_gem_lockfile_sections?
114
+ [combine_rubygems_sources]
84
115
  else
85
- lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
86
- lock_sources << combine_rubygems_sources
116
+ rubygems_sources.sort_by(&:identifier)
87
117
  end
88
118
  end
89
119
 
90
120
  # Returns true if there are changes
91
121
  def replace_sources!(replacement_sources)
92
- return true if replacement_sources.empty?
122
+ return false if replacement_sources.empty?
93
123
 
94
- [path_sources, git_sources, plugin_sources].each do |source_list|
95
- source_list.map! do |source|
96
- replacement_sources.find {|s| s == source } || source
97
- end
98
- end
124
+ @rubygems_sources, @path_sources, @git_sources, @plugin_sources = map_sources(replacement_sources)
125
+ @global_rubygems_source = global_replacement_source(replacement_sources)
99
126
 
100
- replacement_rubygems = !Bundler.feature_flag.lockfile_uses_separate_rubygems_sources? &&
101
- replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
102
- @rubygems_aggregate = replacement_rubygems if replacement_rubygems
127
+ different_sources?(lock_sources, replacement_sources)
128
+ end
103
129
 
104
- return true if !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
105
- return true if replacement_rubygems && rubygems_remotes.to_set != replacement_rubygems.remotes.to_set
130
+ # Returns true if there are changes
131
+ def expired_sources?(replacement_sources)
132
+ return false if replacement_sources.empty?
133
+
134
+ lock_sources = dup_with_replaced_sources(replacement_sources).lock_sources
135
+
136
+ different_sources?(lock_sources, replacement_sources)
137
+ end
106
138
 
107
- false
139
+ def local_only!
140
+ all_sources.each(&:local_only!)
108
141
  end
109
142
 
110
143
  def cached!
@@ -115,11 +148,33 @@ module Bundler
115
148
  all_sources.each(&:remote!)
116
149
  end
117
150
 
118
- def rubygems_primary_remotes
119
- @rubygems_aggregate.remotes
151
+ private
152
+
153
+ def dup_with_replaced_sources(replacement_sources)
154
+ new_source_list = dup
155
+ new_source_list.replace_sources!(replacement_sources)
156
+ new_source_list
157
+ end
158
+
159
+ def map_sources(replacement_sources)
160
+ [@rubygems_sources, @path_sources, @git_sources, @plugin_sources].map do |sources|
161
+ sources.map do |source|
162
+ replacement_sources.find {|s| s == source } || source
163
+ end
164
+ end
120
165
  end
121
166
 
122
- private
167
+ def global_replacement_source(replacement_sources)
168
+ replacement_source = replacement_sources.find {|s| s == global_rubygems_source }
169
+ return global_rubygems_source unless replacement_source
170
+
171
+ replacement_source.local!
172
+ replacement_source
173
+ end
174
+
175
+ def different_sources?(lock_sources, replacement_sources)
176
+ !equivalent_sources?(lock_sources, replacement_sources)
177
+ end
123
178
 
124
179
  def rubygems_aggregate_class
125
180
  Source::Rubygems
@@ -150,37 +205,17 @@ module Bundler
150
205
  if source.uri =~ /^git\:/
151
206
  Bundler.ui.warn "The git source `#{source.uri}` uses the `git` protocol, " \
152
207
  "which transmits data without encryption. Disable this warning with " \
153
- "`bundle config git.allow_insecure true`, or switch to the `https` " \
208
+ "`bundle config set --local git.allow_insecure true`, or switch to the `https` " \
154
209
  "protocol to keep your data secure."
155
210
  end
156
211
  end
157
212
 
158
- def equal_sources?(lock_sources, replacement_sources)
159
- lock_sources.to_set == replacement_sources.to_set
160
- end
161
-
162
- def equal_source?(source, other_source)
163
- source == other_source
164
- end
165
-
166
- def equivalent_source?(source, other_source)
167
- return false unless Bundler.settings[:allow_deployment_source_credential_changes] && source.is_a?(Source::Rubygems)
168
-
169
- equivalent_rubygems_sources?([source], [other_source])
170
- end
171
-
172
213
  def equivalent_sources?(lock_sources, replacement_sources)
173
- return false unless Bundler.settings[:allow_deployment_source_credential_changes]
174
-
175
- lock_rubygems_sources, lock_other_sources = lock_sources.partition {|s| s.is_a?(Source::Rubygems) }
176
- replacement_rubygems_sources, replacement_other_sources = replacement_sources.partition {|s| s.is_a?(Source::Rubygems) }
177
-
178
- equivalent_rubygems_sources?(lock_rubygems_sources, replacement_rubygems_sources) && equal_sources?(lock_other_sources, replacement_other_sources)
214
+ lock_sources.sort_by(&:identifier) == replacement_sources.sort_by(&:identifier)
179
215
  end
180
216
 
181
- def equivalent_rubygems_sources?(lock_sources, replacement_sources)
182
- actual_remotes = replacement_sources.map(&:remotes).flatten.uniq
183
- lock_sources.all? {|s| s.equivalent_remotes?(actual_remotes) }
217
+ def equivalent_source?(source, other_source)
218
+ source == other_source
184
219
  end
185
220
  end
186
221
  end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class SourceMap
5
+ attr_reader :sources, :dependencies
6
+
7
+ def initialize(sources, dependencies)
8
+ @sources = sources
9
+ @dependencies = dependencies
10
+ end
11
+
12
+ def pinned_spec_names(skip = nil)
13
+ direct_requirements.reject {|_, source| source == skip }.keys
14
+ end
15
+
16
+ def all_requirements
17
+ requirements = direct_requirements.dup
18
+
19
+ unmet_deps = sources.non_default_explicit_sources.map do |source|
20
+ (source.spec_names - pinned_spec_names).each do |indirect_dependency_name|
21
+ previous_source = requirements[indirect_dependency_name]
22
+ if previous_source.nil?
23
+ requirements[indirect_dependency_name] = source
24
+ else
25
+ no_ambiguous_sources = Bundler.feature_flag.bundler_3_mode?
26
+
27
+ msg = ["The gem '#{indirect_dependency_name}' was found in multiple relevant sources."]
28
+ msg.concat [previous_source, source].map {|s| " * #{s}" }.sort
29
+ msg << "You #{no_ambiguous_sources ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
30
+ msg = msg.join("\n")
31
+
32
+ raise SecurityError, msg if no_ambiguous_sources
33
+ Bundler.ui.warn "Warning: #{msg}"
34
+ end
35
+ end
36
+
37
+ source.unmet_deps
38
+ end
39
+
40
+ sources.default_source.add_dependency_names(unmet_deps.flatten - requirements.keys)
41
+
42
+ requirements
43
+ end
44
+
45
+ def direct_requirements
46
+ @direct_requirements ||= begin
47
+ requirements = {}
48
+ default = sources.default_source
49
+ dependencies.each do |dep|
50
+ dep_source = dep.source || default
51
+ dep_source.add_dependency_names(dep.name)
52
+ requirements[dep.name] = dep_source
53
+ end
54
+ requirements
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,46 +1,38 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "tsort"
4
- require "forwardable"
5
- require "set"
3
+ require_relative "vendored_tsort"
6
4
 
7
5
  module Bundler
8
6
  class SpecSet
9
- extend Forwardable
10
- include TSort, Enumerable
11
-
12
- def_delegators :@specs, :<<, :length, :add, :remove, :size, :empty?
13
- def_delegators :sorted, :each
7
+ include Enumerable
8
+ include TSort
14
9
 
15
10
  def initialize(specs)
16
11
  @specs = specs
17
12
  end
18
13
 
19
- def for(dependencies, skip = [], check = false, match_current_platform = false, raise_on_missing = true)
20
- handled = Set.new
14
+ def for(dependencies, check = false, match_current_platform = false)
15
+ handled = []
21
16
  deps = dependencies.dup
22
17
  specs = []
23
- skip += ["bundler"]
24
18
 
25
19
  loop do
26
20
  break unless dep = deps.shift
27
- next if !handled.add?(dep) || skip.include?(dep.name)
21
+ next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
22
+
23
+ handled << dep
28
24
 
29
- if spec = spec_for_dependency(dep, match_current_platform)
30
- specs << spec
25
+ specs_for_dep = spec_for_dependency(dep, match_current_platform)
26
+ if specs_for_dep.any?
27
+ match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep
31
28
 
32
- spec.dependencies.each do |d|
29
+ specs_for_dep.first.dependencies.each do |d|
33
30
  next if d.type == :development
34
- d = DepProxy.new(d, dep.__platform) unless match_current_platform
31
+ d = DepProxy.get_proxy(d, dep.__platform) unless match_current_platform
35
32
  deps << d
36
33
  end
37
34
  elsif check
38
35
  return false
39
- elsif raise_on_missing
40
- others = lookup[dep.name] if match_current_platform
41
- message = "Unable to find a spec satisfying #{dep} in the set. Perhaps the lockfile is corrupted?"
42
- message += " Found #{others.join(", ")} that did not match the current platform." if others && !others.empty?
43
- raise GemNotFound, message
44
36
  end
45
37
  end
46
38
 
@@ -48,11 +40,7 @@ module Bundler
48
40
  specs << spec
49
41
  end
50
42
 
51
- check ? true : SpecSet.new(specs)
52
- end
53
-
54
- def valid_for?(deps)
55
- self.for(deps, [], true)
43
+ check ? true : specs
56
44
  end
57
45
 
58
46
  def [](key)
@@ -64,7 +52,6 @@ module Bundler
64
52
  @specs << value
65
53
  @lookup = nil
66
54
  @sorted = nil
67
- value
68
55
  end
69
56
 
70
57
  def sort!
@@ -79,38 +66,35 @@ module Bundler
79
66
  lookup.dup
80
67
  end
81
68
 
82
- def materialize(deps, missing_specs = nil)
83
- materialized = self.for(deps, [], false, true, !missing_specs).to_a
84
- deps = materialized.map(&:name).uniq
69
+ def materialize(deps)
70
+ materialized = self.for(deps, false, true)
71
+
85
72
  materialized.map! do |s|
86
73
  next s unless s.is_a?(LazySpecification)
87
- s.source.dependency_names = deps if s.source.respond_to?(:dependency_names=)
88
- spec = s.__materialize__
89
- unless spec
90
- unless missing_specs
91
- raise GemNotFound, "Could not find #{s.full_name} in any of the sources"
92
- end
93
- missing_specs << s
94
- end
95
- spec
74
+ s.source.local!
75
+ s.__materialize__ || s
96
76
  end
97
- SpecSet.new(missing_specs ? materialized.compact : materialized)
77
+ SpecSet.new(materialized)
98
78
  end
99
79
 
100
80
  # Materialize for all the specs in the spec set, regardless of what platform they're for
101
81
  # This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
102
82
  # @return [Array<Gem::Specification>]
103
83
  def materialized_for_all_platforms
104
- names = @specs.map(&:name).uniq
105
84
  @specs.map do |s|
106
85
  next s unless s.is_a?(LazySpecification)
107
- s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
86
+ s.source.local!
87
+ s.source.remote!
108
88
  spec = s.__materialize__
109
89
  raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
110
90
  spec
111
91
  end
112
92
  end
113
93
 
94
+ def missing_specs
95
+ @specs.select {|s| s.is_a?(LazySpecification) }
96
+ end
97
+
114
98
  def merge(set)
115
99
  arr = sorted.dup
116
100
  set.each do |set_spec|
@@ -132,7 +116,27 @@ module Bundler
132
116
  what_required(req) << spec
133
117
  end
134
118
 
135
- private
119
+ def <<(spec)
120
+ @specs << spec
121
+ end
122
+
123
+ def length
124
+ @specs.length
125
+ end
126
+
127
+ def size
128
+ @specs.size
129
+ end
130
+
131
+ def empty?
132
+ @specs.empty?
133
+ end
134
+
135
+ def each(&b)
136
+ sorted.each(&b)
137
+ end
138
+
139
+ private
136
140
 
137
141
  def sorted
138
142
  rake = @specs.find {|s| s.name == "rake" }
@@ -147,11 +151,7 @@ module Bundler
147
151
  end
148
152
 
149
153
  def extract_circular_gems(error)
150
- if Bundler.current_ruby.mri? && Bundler.current_ruby.on_19?
151
- error.message.scan(/(\w+) \([^)]/).flatten
152
- else
153
- error.message.scan(/@name="(.*?)"/).flatten
154
- end
154
+ error.message.scan(/@name="(.*?)"/).flatten
155
155
  end
156
156
 
157
157
  def lookup
@@ -172,11 +172,7 @@ module Bundler
172
172
  def spec_for_dependency(dep, match_current_platform)
173
173
  specs_for_platforms = lookup[dep.name]
174
174
  if match_current_platform
175
- Bundler.rubygems.platforms.reverse_each do |pl|
176
- match = GemHelpers.select_best_platform_match(specs_for_platforms, pl)
177
- return match if match
178
- end
179
- nil
175
+ GemHelpers.select_best_platform_match(specs_for_platforms.select{|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
180
176
  else
181
177
  GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform)
182
178
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/remote_specification"
4
-
5
3
  module Bundler
6
4
  class StubSpecification < RemoteSpecification
7
5
  def self.from_stub(stub)
@@ -13,17 +11,13 @@ module Bundler
13
11
 
14
12
  attr_accessor :stub, :ignored
15
13
 
16
- # Pre 2.2.0 did not include extension_dir
17
- # https://github.com/rubygems/rubygems/commit/9485ca2d101b82a946d6f327f4bdcdea6d4946ea
18
- if Bundler.rubygems.provides?(">= 2.2.0")
19
- def source=(source)
20
- super
21
- # Stub has no concept of source, which means that extension_dir may be wrong
22
- # This is the case for git-based gems. So, instead manually assign the extension dir
23
- return unless source.respond_to?(:extension_dir_name)
24
- path = File.join(stub.extensions_dir, source.extension_dir_name)
25
- stub.extension_dir = File.expand_path(path)
26
- end
14
+ def source=(source)
15
+ super
16
+ # Stub has no concept of source, which means that extension_dir may be wrong
17
+ # This is the case for git-based gems. So, instead manually assign the extension dir
18
+ return unless source.respond_to?(:extension_dir_name)
19
+ path = File.join(stub.extensions_dir, source.extension_dir_name)
20
+ stub.extension_dir = File.expand_path(path)
27
21
  end
28
22
 
29
23
  def to_yaml
@@ -32,11 +26,21 @@ module Bundler
32
26
 
33
27
  # @!group Stub Delegates
34
28
 
35
- if Bundler.rubygems.provides?(">= 2.3")
36
- # This is defined directly to avoid having to load every installed spec
37
- def missing_extensions?
38
- stub.missing_extensions?
39
- end
29
+ def manually_installed?
30
+ # This is for manually installed gems which are gems that were fixed in place after a
31
+ # failed installation. Once the issue was resolved, the user then manually created
32
+ # the gem specification using the instructions provided by `gem help install`
33
+ installed_by_version == Gem::Version.new(0)
34
+ end
35
+
36
+ # This is defined directly to avoid having to loading the full spec
37
+ def missing_extensions?
38
+ return false if default_gem?
39
+ return false if extensions.empty?
40
+ return false if File.exist? gem_build_complete_path
41
+ return false if manually_installed?
42
+
43
+ true
40
44
  end
41
45
 
42
46
  def activated
@@ -47,8 +51,16 @@ module Bundler
47
51
  stub.instance_variable_set(:@activated, activated)
48
52
  end
49
53
 
50
- def default_gem
51
- stub.default_gem
54
+ def extensions
55
+ stub.extensions
56
+ end
57
+
58
+ def gem_build_complete_path
59
+ File.join(extension_dir, "gem.build_complete")
60
+ end
61
+
62
+ def default_gem?
63
+ stub.default_gem?
52
64
  end
53
65
 
54
66
  def full_gem_path
@@ -57,33 +69,27 @@ module Bundler
57
69
  stub.full_gem_path || method_missing(:full_gem_path)
58
70
  end
59
71
 
60
- if Bundler.rubygems.provides?(">= 2.2.0")
61
- def full_require_paths
62
- stub.full_require_paths
63
- end
72
+ def full_require_paths
73
+ stub.full_require_paths
74
+ end
64
75
 
65
- # This is what we do in bundler/rubygems_ext
66
- # full_require_paths is always implemented in >= 2.2.0
67
- def load_paths
68
- full_require_paths
69
- end
76
+ def load_paths
77
+ full_require_paths
70
78
  end
71
79
 
72
80
  def loaded_from
73
81
  stub.loaded_from
74
82
  end
75
83
 
76
- if Bundler.rubygems.stubs_provide_full_functionality?
77
- def matches_for_glob(glob)
78
- stub.matches_for_glob(glob)
79
- end
84
+ def matches_for_glob(glob)
85
+ stub.matches_for_glob(glob)
80
86
  end
81
87
 
82
88
  def raw_require_paths
83
89
  stub.raw_require_paths
84
90
  end
85
91
 
86
- private
92
+ private
87
93
 
88
94
  def _remote_specification
89
95
  @_remote_specification ||= begin
@@ -11,7 +11,7 @@
11
11
  require "rubygems"
12
12
 
13
13
  m = Module.new do
14
- module_function
14
+ module_function
15
15
 
16
16
  def invoked_as_script?
17
17
  File.expand_path($0) == File.expand_path(__FILE__)
@@ -31,7 +31,7 @@ m = Module.new do
31
31
  bundler_version = a
32
32
  end
33
33
  next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
- bundler_version = $1 || ">= 0.a"
34
+ bundler_version = $1
35
35
  update_index = i
36
36
  end
37
37
  bundler_version
@@ -60,33 +60,42 @@ m = Module.new do
60
60
  Regexp.last_match(1)
61
61
  end
62
62
 
63
- def bundler_version
64
- @bundler_version ||= begin
63
+ def bundler_requirement
64
+ @bundler_requirement ||=
65
65
  env_var_version || cli_arg_version ||
66
- lockfile_version || "#{Gem::Requirement.default}.a"
67
- end
66
+ bundler_requirement_for(lockfile_version)
67
+ end
68
+
69
+ def bundler_requirement_for(version)
70
+ return "#{Gem::Requirement.default}.a" unless version
71
+
72
+ bundler_gem_version = Gem::Version.new(version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
68
81
  end
69
82
 
70
83
  def load_bundler!
71
84
  ENV["BUNDLE_GEMFILE"] ||= gemfile
72
85
 
73
- # must dup string for RG < 1.8 compatibility
74
- activate_bundler(bundler_version.dup)
86
+ activate_bundler
75
87
  end
76
88
 
77
- def activate_bundler(bundler_version)
78
- if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
79
- bundler_version = "< 2"
80
- end
89
+ def activate_bundler
81
90
  gem_error = activation_error_handling do
82
- gem "bundler", bundler_version
91
+ gem "bundler", bundler_requirement
83
92
  end
84
93
  return if gem_error.nil?
85
94
  require_error = activation_error_handling do
86
95
  require "bundler/version"
87
96
  end
88
- return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
89
- warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
90
99
  exit 42
91
100
  end
92
101