bundler 2.1.4 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (338) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2468 -1430
  3. data/README.md +8 -10
  4. data/bundler.gemspec +10 -13
  5. data/exe/bundle +7 -8
  6. data/exe/bundler +1 -1
  7. data/lib/bundler/.document +1 -0
  8. data/lib/bundler/build_metadata.rb +3 -11
  9. data/lib/bundler/cli/add.rb +2 -2
  10. data/lib/bundler/cli/binstubs.rb +6 -2
  11. data/lib/bundler/cli/cache.rb +3 -8
  12. data/lib/bundler/cli/check.rb +5 -3
  13. data/lib/bundler/cli/clean.rb +1 -1
  14. data/lib/bundler/cli/common.rb +32 -3
  15. data/lib/bundler/cli/config.rb +10 -1
  16. data/lib/bundler/cli/console.rb +3 -3
  17. data/lib/bundler/cli/doctor.rb +23 -6
  18. data/lib/bundler/cli/exec.rb +5 -10
  19. data/lib/bundler/cli/fund.rb +36 -0
  20. data/lib/bundler/cli/gem.rb +258 -45
  21. data/lib/bundler/cli/info.rb +38 -6
  22. data/lib/bundler/cli/init.rb +7 -3
  23. data/lib/bundler/cli/inject.rb +1 -1
  24. data/lib/bundler/cli/install.rb +27 -57
  25. data/lib/bundler/cli/issue.rb +5 -4
  26. data/lib/bundler/cli/list.rb +19 -11
  27. data/lib/bundler/cli/lock.rb +11 -4
  28. data/lib/bundler/cli/open.rb +1 -2
  29. data/lib/bundler/cli/outdated.rb +106 -79
  30. data/lib/bundler/cli/platform.rb +2 -2
  31. data/lib/bundler/cli/plugin.rb +10 -0
  32. data/lib/bundler/cli/pristine.rb +5 -0
  33. data/lib/bundler/cli/remove.rb +1 -2
  34. data/lib/bundler/cli/show.rb +2 -2
  35. data/lib/bundler/cli/update.rb +20 -9
  36. data/lib/bundler/cli/viz.rb +1 -1
  37. data/lib/bundler/cli.rb +149 -85
  38. data/lib/bundler/compact_index_client/cache.rb +7 -24
  39. data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  40. data/lib/bundler/compact_index_client/updater.rb +56 -51
  41. data/lib/bundler/compact_index_client.rb +3 -9
  42. data/lib/bundler/constants.rb +1 -1
  43. data/lib/bundler/current_ruby.rb +17 -6
  44. data/lib/bundler/definition.rb +343 -440
  45. data/lib/bundler/dependency.rb +23 -77
  46. data/lib/bundler/digest.rb +71 -0
  47. data/lib/bundler/dsl.rb +77 -85
  48. data/lib/bundler/endpoint_specification.rb +20 -14
  49. data/lib/bundler/env.rb +3 -3
  50. data/lib/bundler/environment_preserver.rb +30 -2
  51. data/lib/bundler/errors.rb +31 -14
  52. data/lib/bundler/feature_flag.rb +0 -9
  53. data/lib/bundler/fetcher/base.rb +7 -9
  54. data/lib/bundler/fetcher/compact_index.rb +20 -27
  55. data/lib/bundler/fetcher/dependency.rb +1 -1
  56. data/lib/bundler/fetcher/downloader.rb +11 -11
  57. data/lib/bundler/fetcher/index.rb +2 -30
  58. data/lib/bundler/fetcher.rb +24 -29
  59. data/lib/bundler/force_platform.rb +18 -0
  60. data/lib/bundler/friendly_errors.rb +45 -49
  61. data/lib/bundler/gem_helper.rb +53 -31
  62. data/lib/bundler/gem_helpers.rb +42 -24
  63. data/lib/bundler/gem_version_promoter.rb +54 -99
  64. data/lib/bundler/graph.rb +4 -4
  65. data/lib/bundler/index.rb +14 -52
  66. data/lib/bundler/injector.rb +40 -8
  67. data/lib/bundler/inline.rb +6 -15
  68. data/lib/bundler/installer/gem_installer.rb +19 -24
  69. data/lib/bundler/installer/parallel_installer.rb +32 -42
  70. data/lib/bundler/installer/standalone.rb +58 -11
  71. data/lib/bundler/installer.rb +47 -87
  72. data/lib/bundler/lazy_specification.rb +76 -35
  73. data/lib/bundler/lockfile_generator.rb +3 -3
  74. data/lib/bundler/lockfile_parser.rb +24 -49
  75. data/lib/bundler/man/.document +1 -0
  76. data/{man → lib/bundler/man}/bundle-add.1 +21 -5
  77. data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +16 -4
  78. data/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
  79. data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
  80. data/{man → lib/bundler/man}/bundle-cache.1 +7 -1
  81. data/{man/bundle-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +7 -0
  82. data/{man → lib/bundler/man}/bundle-check.1 +1 -1
  83. data/{man → lib/bundler/man}/bundle-clean.1 +2 -2
  84. data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
  85. data/{man → lib/bundler/man}/bundle-config.1 +65 -47
  86. data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +74 -65
  87. data/lib/bundler/man/bundle-console.1 +53 -0
  88. data/lib/bundler/man/bundle-console.1.ronn +44 -0
  89. data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  90. data/{man → lib/bundler/man}/bundle-exec.1 +2 -2
  91. data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
  92. data/lib/bundler/man/bundle-gem.1 +105 -0
  93. data/lib/bundler/man/bundle-gem.1.ronn +117 -0
  94. data/lib/bundler/man/bundle-help.1 +13 -0
  95. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  96. data/{man → lib/bundler/man}/bundle-info.1 +1 -1
  97. data/{man → lib/bundler/man}/bundle-init.1 +1 -1
  98. data/{man → lib/bundler/man}/bundle-inject.1 +5 -2
  99. data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
  100. data/{man → lib/bundler/man}/bundle-install.1 +35 -33
  101. data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +33 -34
  102. data/{man → lib/bundler/man}/bundle-list.1 +7 -7
  103. data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  104. data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  105. data/{man → lib/bundler/man}/bundle-open.1 +1 -1
  106. data/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
  107. data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
  108. data/{man → lib/bundler/man}/bundle-platform.1 +16 -6
  109. data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
  110. data/lib/bundler/man/bundle-plugin.1 +81 -0
  111. data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  112. data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  113. data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  114. data/{man → lib/bundler/man}/bundle-show.1 +1 -1
  115. data/{man → lib/bundler/man}/bundle-update.1 +5 -5
  116. data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +5 -4
  117. data/lib/bundler/man/bundle-version.1 +35 -0
  118. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  119. data/{man → lib/bundler/man}/bundle-viz.1 +4 -1
  120. data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
  121. data/{man → lib/bundler/man}/bundle.1 +15 -10
  122. data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +12 -7
  123. data/{man → lib/bundler/man}/gemfile.5 +120 -83
  124. data/{man → lib/bundler/man}/gemfile.5.ronn +109 -88
  125. data/{man → lib/bundler/man}/index.txt +4 -0
  126. data/lib/bundler/match_metadata.rb +13 -0
  127. data/lib/bundler/match_platform.rb +0 -1
  128. data/lib/bundler/match_remote_metadata.rb +29 -0
  129. data/lib/bundler/mirror.rb +7 -9
  130. data/lib/bundler/plugin/api/source.rb +25 -9
  131. data/lib/bundler/plugin/dsl.rb +1 -1
  132. data/lib/bundler/plugin/index.rb +17 -5
  133. data/lib/bundler/plugin/installer/git.rb +0 -4
  134. data/lib/bundler/plugin/installer/rubygems.rb +1 -9
  135. data/lib/bundler/plugin/installer.rb +11 -11
  136. data/lib/bundler/plugin/source_list.rb +5 -1
  137. data/lib/bundler/plugin.rb +58 -11
  138. data/lib/bundler/process_lock.rb +1 -1
  139. data/lib/bundler/remote_specification.rb +15 -6
  140. data/lib/bundler/resolver/base.rb +46 -0
  141. data/lib/bundler/resolver/candidate.rb +92 -0
  142. data/lib/bundler/resolver/incompatibility.rb +15 -0
  143. data/lib/bundler/resolver/package.rb +63 -0
  144. data/lib/bundler/resolver/root.rb +25 -0
  145. data/lib/bundler/resolver/spec_group.rb +49 -74
  146. data/lib/bundler/resolver.rb +320 -344
  147. data/lib/bundler/retry.rb +2 -2
  148. data/lib/bundler/ruby_dsl.rb +1 -1
  149. data/lib/bundler/ruby_version.rb +6 -19
  150. data/lib/bundler/rubygems_ext.rb +231 -32
  151. data/lib/bundler/rubygems_gem_installer.rb +89 -16
  152. data/lib/bundler/rubygems_integration.rb +72 -162
  153. data/lib/bundler/runtime.rb +23 -31
  154. data/lib/bundler/self_manager.rb +168 -0
  155. data/lib/bundler/settings.rb +145 -72
  156. data/lib/bundler/setup.rb +2 -2
  157. data/lib/bundler/shared_helpers.rb +19 -34
  158. data/lib/bundler/similarity_detector.rb +1 -1
  159. data/lib/bundler/source/git/git_proxy.rb +244 -114
  160. data/lib/bundler/source/git.rb +62 -46
  161. data/lib/bundler/source/metadata.rb +3 -8
  162. data/lib/bundler/source/path/installer.rb +11 -32
  163. data/lib/bundler/source/path.rb +15 -9
  164. data/lib/bundler/source/rubygems/remote.rb +1 -1
  165. data/lib/bundler/source/rubygems.rb +167 -199
  166. data/lib/bundler/source/rubygems_aggregate.rb +68 -0
  167. data/lib/bundler/source.rb +25 -5
  168. data/lib/bundler/source_list.rb +112 -64
  169. data/lib/bundler/source_map.rb +71 -0
  170. data/lib/bundler/spec_set.rb +64 -61
  171. data/lib/bundler/stub_specification.rb +30 -10
  172. data/lib/bundler/templates/Executable +3 -5
  173. data/lib/bundler/templates/Executable.bundler +10 -15
  174. data/lib/bundler/templates/Executable.standalone +4 -4
  175. data/lib/bundler/templates/Gemfile +0 -2
  176. data/lib/bundler/templates/gems.rb +0 -3
  177. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  178. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  179. data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  180. data/lib/bundler/templates/newgem/Gemfile.tt +15 -1
  181. data/lib/bundler/templates/newgem/README.md.tt +13 -16
  182. data/lib/bundler/templates/newgem/Rakefile.tt +33 -5
  183. data/lib/bundler/templates/newgem/bin/console.tt +1 -0
  184. data/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
  185. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  186. data/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +2 -0
  187. data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  188. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  189. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
  190. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  191. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
  192. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  193. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  194. data/lib/bundler/templates/newgem/newgem.gemspec.tt +34 -18
  195. data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  196. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  197. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  198. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  199. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  200. data/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
  201. data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
  202. data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  203. data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  204. data/lib/bundler/ui/shell.rb +37 -14
  205. data/lib/bundler/ui/silent.rb +21 -5
  206. data/lib/bundler/uri_credentials_filter.rb +3 -1
  207. data/lib/bundler/vendor/.document +1 -0
  208. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  209. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  210. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  211. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
  212. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +41 -74
  213. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  214. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
  215. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  216. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +82 -189
  217. data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  218. data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  219. data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  220. data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  221. data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +151 -0
  222. data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  223. data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  224. data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  225. data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  226. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +53 -0
  227. data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  228. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  229. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +124 -0
  230. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +409 -0
  231. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +240 -0
  232. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  233. data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  234. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  235. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  236. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
  237. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  238. data/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
  239. data/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
  240. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  241. data/lib/bundler/vendor/thor/lib/thor/error.rb +10 -5
  242. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  243. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
  244. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +28 -7
  245. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  246. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  247. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  248. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  249. data/lib/bundler/vendor/thor/lib/thor.rb +5 -13
  250. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  251. data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  252. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  253. data/lib/bundler/vendor/uri/lib/uri/common.rb +76 -91
  254. data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
  255. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
  256. data/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
  257. data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
  258. data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
  259. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
  260. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  261. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
  262. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +14 -21
  263. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -17
  264. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  265. data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  266. data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  267. data/lib/bundler/vendor/uri/lib/uri.rb +3 -3
  268. data/lib/bundler/vendored_persistent.rb +1 -40
  269. data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
  270. data/lib/bundler/vendored_tsort.rb +4 -0
  271. data/lib/bundler/version.rb +5 -1
  272. data/lib/bundler/worker.rb +25 -12
  273. data/lib/bundler/yaml_serializer.rb +1 -1
  274. data/lib/bundler.rb +95 -108
  275. metadata +132 -118
  276. data/lib/bundler/dep_proxy.rb +0 -48
  277. data/lib/bundler/gemdeps.rb +0 -29
  278. data/lib/bundler/psyched_yaml.rb +0 -37
  279. data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  280. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
  281. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  282. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  283. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
  284. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  285. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  286. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  287. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  288. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  289. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  290. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  291. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  292. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -158
  293. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
  294. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
  295. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  296. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
  297. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  298. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
  299. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  300. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  301. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
  302. data/lib/bundler/version_ranges.rb +0 -122
  303. data/man/bundle-add.1.txt +0 -58
  304. data/man/bundle-binstubs.1.txt +0 -48
  305. data/man/bundle-cache.1.txt +0 -78
  306. data/man/bundle-check.1.txt +0 -33
  307. data/man/bundle-clean.1.txt +0 -26
  308. data/man/bundle-config.1.txt +0 -528
  309. data/man/bundle-doctor.1.txt +0 -44
  310. data/man/bundle-exec.1.txt +0 -178
  311. data/man/bundle-gem.1 +0 -80
  312. data/man/bundle-gem.1.txt +0 -91
  313. data/man/bundle-gem.ronn +0 -78
  314. data/man/bundle-info.1.txt +0 -21
  315. data/man/bundle-init.1.txt +0 -34
  316. data/man/bundle-inject.1.txt +0 -32
  317. data/man/bundle-install.1.txt +0 -401
  318. data/man/bundle-list.1.txt +0 -43
  319. data/man/bundle-lock.1.txt +0 -93
  320. data/man/bundle-open.1.txt +0 -29
  321. data/man/bundle-outdated.1.txt +0 -131
  322. data/man/bundle-platform.1.txt +0 -57
  323. data/man/bundle-pristine.1.txt +0 -44
  324. data/man/bundle-remove.1.txt +0 -34
  325. data/man/bundle-show.1.txt +0 -27
  326. data/man/bundle-update.1.txt +0 -390
  327. data/man/bundle-viz.1.txt +0 -39
  328. data/man/bundle.1.txt +0 -116
  329. data/man/gemfile.5.txt +0 -649
  330. /data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  331. /data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  332. /data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  333. /data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +0 -0
  334. /data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  335. /data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
  336. /data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  337. /data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  338. /data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
@@ -9,14 +9,18 @@ module Bundler
9
9
  end
10
10
 
11
11
  def run
12
- Bundler.ui.level = "error" if options[:quiet]
12
+ Bundler.ui.level = "warn" if options[:quiet]
13
+
14
+ update_bundler = options[:bundler]
15
+
16
+ Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler
13
17
 
14
18
  Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
15
19
 
16
20
  sources = Array(options[:source])
17
21
  groups = Array(options[:group]).map(&:to_sym)
18
22
 
19
- full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !options[:bundler]
23
+ full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !update_bundler
20
24
 
21
25
  if full_update && !options[:all]
22
26
  if Bundler.feature_flag.update_requires_all_flag?
@@ -27,9 +31,14 @@ module Bundler
27
31
  raise InvalidOption, "Cannot specify --all along with specific options."
28
32
  end
29
33
 
34
+ conservative = options[:conservative]
35
+
30
36
  if full_update
31
- # We're doing a full update
32
- Bundler.definition(true)
37
+ if conservative
38
+ Bundler.definition(:conservative => conservative)
39
+ else
40
+ Bundler.definition(true)
41
+ end
33
42
  else
34
43
  unless Bundler.default_lockfile.exist?
35
44
  raise GemfileLockNotFound, "This Bundle hasn't been installed yet. " \
@@ -43,8 +52,8 @@ module Bundler
43
52
  end
44
53
 
45
54
  Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
46
- :lock_shared_dependencies => options[:conservative],
47
- :bundler => options[:bundler])
55
+ :conservative => conservative,
56
+ :bundler => update_bundler)
48
57
  end
49
58
 
50
59
  Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
@@ -61,7 +70,7 @@ module Bundler
61
70
 
62
71
  if locked_gems = Bundler.definition.locked_gems
63
72
  previous_locked_info = locked_gems.specs.reduce({}) do |h, s|
64
- h[s.name] = { :spec => s, :version => s.version, :source => s.source.to_s }
73
+ h[s.name] = { :spec => s, :version => s.version, :source => s.source.identifier }
65
74
  h
66
75
  end
67
76
  end
@@ -82,7 +91,7 @@ module Bundler
82
91
  locked_spec = locked_info[:spec]
83
92
  new_spec = Bundler.definition.specs[name].first
84
93
  unless new_spec
85
- if Bundler.rubygems.platforms.none? {|p| locked_spec.match_platform(p) }
94
+ unless locked_spec.match_platform(Bundler.local_platform)
86
95
  Bundler.ui.warn "Bundler attempted to update #{name} but it was not considered because it is for a different platform from the current one"
87
96
  end
88
97
 
@@ -90,7 +99,7 @@ module Bundler
90
99
  end
91
100
 
92
101
  locked_source = locked_info[:source]
93
- new_source = new_spec.source.to_s
102
+ new_source = new_spec.source.identifier
94
103
  next if locked_source != new_source
95
104
 
96
105
  new_version = new_spec.version
@@ -106,6 +115,8 @@ module Bundler
106
115
  Bundler.ui.confirm "Bundle updated!"
107
116
  Bundler::CLI::Common.output_without_groups_message(:update)
108
117
  Bundler::CLI::Common.output_post_install_messages installer.post_install_messages
118
+
119
+ Bundler::CLI::Common.output_fund_metadata_summary
109
120
  end
110
121
  end
111
122
  end
@@ -23,7 +23,7 @@ module Bundler
23
23
  Bundler.ui.warn "Make sure you have the graphviz ruby gem. You can install it with:"
24
24
  Bundler.ui.warn "`gem install ruby-graphviz`"
25
25
  rescue StandardError => e
26
- raise unless e.message =~ /GraphViz not installed or dot not in PATH/
26
+ raise unless e.message.to_s.include?("GraphViz not installed or dot not in PATH")
27
27
  Bundler.ui.error e.message
28
28
  Bundler.ui.warn "Please install GraphViz. On a Mac with Homebrew, you can run `brew install graphviz`."
29
29
  end
data/lib/bundler/cli.rb CHANGED
@@ -10,10 +10,12 @@ module Bundler
10
10
 
11
11
  AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean].freeze
12
12
  PARSEABLE_COMMANDS = %w[check config help exec platform show version].freeze
13
+ EXTENSIONS = ["c", "rust"].freeze
13
14
 
14
15
  COMMAND_ALIASES = {
15
16
  "check" => "c",
16
17
  "install" => "i",
18
+ "plugin" => "",
17
19
  "list" => "ls",
18
20
  "exec" => ["e", "ex", "exe"],
19
21
  "cache" => ["package", "pack"],
@@ -21,6 +23,8 @@ module Bundler
21
23
  }.freeze
22
24
 
23
25
  def self.start(*)
26
+ check_deprecated_ext_option(ARGV) if ARGV.include?("--ext")
27
+
24
28
  super
25
29
  ensure
26
30
  Bundler::SharedHelpers.print_major_deprecations!
@@ -57,9 +61,11 @@ module Bundler
57
61
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
58
62
  if custom_gemfile && !custom_gemfile.empty?
59
63
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
60
- Bundler.reset_paths!
64
+ Bundler.reset_settings_and_root!
61
65
  end
62
66
 
67
+ Bundler.self_manager.restart_with_locked_bundler_if_needed
68
+
63
69
  Bundler.settings.set_command_option_if_given :retry, options[:retry]
64
70
 
65
71
  current_cmd = args.last[:current_command].name
@@ -72,14 +78,6 @@ module Bundler
72
78
  Bundler.ui = UI::Shell.new(options)
73
79
  Bundler.ui.level = "debug" if options["verbose"]
74
80
  unprinted_warnings.each {|w| Bundler.ui.warn(w) }
75
-
76
- if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
77
- Bundler.ui.warn(
78
- "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \
79
- "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \
80
- "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true
81
- )
82
- end
83
81
  end
84
82
 
85
83
  check_unknown_options!(:except => [:config, :exec])
@@ -122,16 +120,17 @@ module Bundler
122
120
  else command = "bundle-#{cli}"
123
121
  end
124
122
 
125
- man_path = File.expand_path("../../../man", __FILE__)
126
- man_pages = Hash[Dir.glob(File.join(man_path, "*")).grep(/.*\.\d*\Z/).collect do |f|
123
+ man_path = File.expand_path("man", __dir__)
124
+ man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
127
125
  [File.basename(f, ".*"), f]
128
126
  end]
129
127
 
130
128
  if man_pages.include?(command)
129
+ man_page = man_pages[command]
131
130
  if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
132
- Kernel.exec "man #{man_pages[command]}"
131
+ Kernel.exec "man #{man_page}"
133
132
  else
134
- puts File.read("#{man_path}/#{File.basename(man_pages[command])}.txt")
133
+ puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
135
134
  end
136
135
  elsif command_path = Bundler.which("bundler-#{cli}")
137
136
  Kernel.exec(command_path, "--help")
@@ -190,6 +189,7 @@ module Bundler
190
189
  method_option "install", :type => :boolean, :banner =>
191
190
  "Runs 'bundle install' after removing the gems from the Gemfile"
192
191
  def remove(*gems)
192
+ SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install")
193
193
  require_relative "cli/remove"
194
194
  Remove.new(gems, options).run
195
195
  end
@@ -221,6 +221,8 @@ module Bundler
221
221
  "Specify the number of jobs to run in parallel"
222
222
  method_option "local", :type => :boolean, :banner =>
223
223
  "Do not attempt to fetch gems remotely and use the gem cache instead"
224
+ method_option "prefer-local", :type => :boolean, :banner =>
225
+ "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
224
226
  method_option "no-cache", :type => :boolean, :banner =>
225
227
  "Don't update the existing gem cache."
226
228
  method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
@@ -239,7 +241,7 @@ module Bundler
239
241
  "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
240
242
  method_option "trust-policy", :alias => "P", :type => :string, :banner =>
241
243
  "Gem trust policy (like gem install -P). Must be one of " +
242
- Bundler.rubygems.security_policy_keys.join("|")
244
+ Bundler.rubygems.security_policy_keys.join("|")
243
245
  method_option "without", :type => :array, :banner =>
244
246
  "Exclude gems that are part of the specified named group."
245
247
  method_option "with", :type => :array, :banner =>
@@ -247,10 +249,12 @@ module Bundler
247
249
  def install
248
250
  SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
249
251
 
250
- %w[clean deployment frozen no-cache no-prune path shebang system without with].each do |option|
252
+ %w[clean deployment frozen no-prune path shebang system without with].each do |option|
251
253
  remembered_flag_deprecation(option)
252
254
  end
253
255
 
256
+ remembered_negative_flag_deprecation("no-deployment")
257
+
254
258
  require_relative "cli/install"
255
259
  Bundler.settings.temporary(:no_install => false) do
256
260
  Install.new(options.dup).run
@@ -291,6 +295,8 @@ module Bundler
291
295
  "Prefer updating only to next minor version"
292
296
  method_option "major", :type => :boolean, :banner =>
293
297
  "Prefer updating to next major version (default)"
298
+ method_option "pre", :type => :boolean, :banner =>
299
+ "Always choose the highest allowed version when updating gems, regardless of prerelease status"
294
300
  method_option "strict", :type => :boolean, :banner =>
295
301
  "Do not allow any gem to be updated past latest --patch | --minor | --major"
296
302
  method_option "conservative", :type => :boolean, :banner =>
@@ -305,45 +311,25 @@ module Bundler
305
311
  end
306
312
  end
307
313
 
308
- unless Bundler.feature_flag.bundler_3_mode?
309
- desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
310
- long_desc <<-D
311
- Show lists the names and versions of all gems that are required by your Gemfile.
312
- Calling show with [GEM] will list the exact location of that gem on your machine.
313
- D
314
- method_option "paths", :type => :boolean,
315
- :banner => "List the paths of all gems that are required by your Gemfile."
316
- method_option "outdated", :type => :boolean,
317
- :banner => "Show verbose output including whether gems are outdated."
318
- def show(gem_name = nil)
319
- if ARGV[0] == "show"
320
- rest = ARGV[1..-1]
321
-
322
- if flag = rest.find{|arg| ["--verbose", "--outdated"].include?(arg) }
323
- Bundler::SharedHelpers.major_deprecation(2, "the `#{flag}` flag to `bundle show` was undocumented and will be removed without replacement")
324
- else
325
- new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
326
-
327
- new_arguments = rest.map do |arg|
328
- next arg if arg != "--paths"
329
- next "--path" if new_command == "info"
330
- end
331
-
332
- old_argv = ARGV.join(" ")
333
- new_argv = [new_command, *new_arguments.compact].join(" ")
334
-
335
- Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
336
- end
337
- end
338
- require_relative "cli/show"
339
- Show.new(options, gem_name).run
340
- end
314
+ desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
315
+ long_desc <<-D
316
+ Show lists the names and versions of all gems that are required by your Gemfile.
317
+ Calling show with [GEM] will list the exact location of that gem on your machine.
318
+ D
319
+ method_option "paths", :type => :boolean,
320
+ :banner => "List the paths of all gems that are required by your Gemfile."
321
+ method_option "outdated", :type => :boolean,
322
+ :banner => "Show verbose output including whether gems are outdated."
323
+ def show(gem_name = nil)
324
+ SharedHelpers.major_deprecation(2, "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement") if ARGV.include?("--outdated")
325
+ require_relative "cli/show"
326
+ Show.new(options, gem_name).run
341
327
  end
342
328
 
343
329
  desc "list", "List all gems in the bundle"
344
330
  method_option "name-only", :type => :boolean, :banner => "print only the gem names"
345
- method_option "only-group", :type => :string, :banner => "print gems from a particular group"
346
- method_option "without-group", :type => :string, :banner => "print all gems except from a group"
331
+ method_option "only-group", :type => :array, :default => [], :banner => "print gems from a given set of groups"
332
+ method_option "without-group", :type => :array, :default => [], :banner => "print all gems except from a given set of groups"
347
333
  method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
348
334
  def list
349
335
  require_relative "cli/list"
@@ -354,6 +340,7 @@ module Bundler
354
340
 
355
341
  desc "info GEM [OPTIONS]", "Show information for the given gem"
356
342
  method_option "path", :type => :boolean, :banner => "Print full path to gem"
343
+ method_option "version", :type => :boolean, :banner => "Print gem version"
357
344
  def info(gem_name)
358
345
  require_relative "cli/info"
359
346
  Info.new(options, gem_name).run
@@ -375,6 +362,8 @@ module Bundler
375
362
  "Make binstubs that can work without the Bundler runtime"
376
363
  method_option "all", :type => :boolean, :banner =>
377
364
  "Install binstubs for all gems"
365
+ method_option "all-platforms", :type => :boolean, :default => false, :banner =>
366
+ "Install binstubs for all platforms"
378
367
  def binstubs(*gems)
379
368
  require_relative "cli/binstubs"
380
369
  Binstubs.new(options, gems).run
@@ -387,8 +376,12 @@ module Bundler
387
376
  method_option "version", :aliases => "-v", :type => :string
388
377
  method_option "group", :aliases => "-g", :type => :string
389
378
  method_option "source", :aliases => "-s", :type => :string
379
+ method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string."
380
+ method_option "path", :type => :string
390
381
  method_option "git", :type => :string
382
+ method_option "github", :type => :string
391
383
  method_option "branch", :type => :string
384
+ method_option "ref", :type => :string
392
385
  method_option "skip-install", :type => :boolean, :banner =>
393
386
  "Adds gem to the Gemfile but does not install it"
394
387
  method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem"
@@ -406,7 +399,7 @@ module Bundler
406
399
  are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
407
400
 
408
401
  For more information on patch level options (--major, --minor, --patch,
409
- --update-strict) see documentation on the same options on the update command.
402
+ --strict) see documentation on the same options on the update command.
410
403
  D
411
404
  method_option "group", :type => :string, :banner => "List gems from a specific group"
412
405
  method_option "groups", :type => :boolean, :banner => "List gems organized by groups"
@@ -414,10 +407,9 @@ module Bundler
414
407
  "Do not attempt to fetch gems remotely and use the gem cache instead"
415
408
  method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
416
409
  method_option "source", :type => :array, :banner => "Check against a specific source"
417
- strict_is_update = Bundler.feature_flag.forget_cli_options?
418
- method_option "filter-strict", :type => :boolean, :aliases => strict_is_update ? [] : %w[--strict], :banner =>
410
+ method_option "filter-strict", :type => :boolean, :aliases => "--strict", :banner =>
419
411
  "Only list newer versions allowed by your Gemfile requirements"
420
- method_option "update-strict", :type => :boolean, :aliases => strict_is_update ? %w[--strict] : [], :banner =>
412
+ method_option "update-strict", :type => :boolean, :banner =>
421
413
  "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
422
414
  method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version"
423
415
  method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)"
@@ -434,11 +426,18 @@ module Bundler
434
426
  Outdated.new(options, gems).run
435
427
  end
436
428
 
437
- desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
438
- unless Bundler.feature_flag.cache_all?
439
- method_option "all", :type => :boolean,
440
- :banner => "Include all sources (including path and git)."
429
+ desc "fund [OPTIONS]", "Lists information about gems seeking funding assistance"
430
+ method_option "group", :aliases => "-g", :type => :array, :banner =>
431
+ "Fetch funding information for a specific group"
432
+ def fund
433
+ require_relative "cli/fund"
434
+ Fund.new(options).run
441
435
  end
436
+
437
+ desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
438
+ method_option "all", :type => :boolean,
439
+ :default => Bundler.feature_flag.cache_all?,
440
+ :banner => "Include all sources (including path and git)."
442
441
  method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
443
442
  method_option "cache-path", :type => :string, :banner =>
444
443
  "Specify a different cache path than the default (vendor/cache)."
@@ -457,6 +456,18 @@ module Bundler
457
456
  bundle without having to download any additional gems.
458
457
  D
459
458
  def cache
459
+ SharedHelpers.major_deprecation 2,
460
+ "The `--all` flag is deprecated because it relies on being " \
461
+ "remembered across bundler invocations, which bundler will no longer " \
462
+ "do in future versions. Instead please use `bundle config set cache_all true`, " \
463
+ "and stop using this flag" if ARGV.include?("--all")
464
+
465
+ SharedHelpers.major_deprecation 2,
466
+ "The `--path` flag is deprecated because its semantics are unclear. " \
467
+ "Use `bundle config cache_path` to configure the path of your cache of gems, " \
468
+ "and `bundle config path` to configure the path where your gems are installed, " \
469
+ "and stop using this flag" if ARGV.include?("--path")
470
+
460
471
  require_relative "cli/cache"
461
472
  Cache.new(options).run
462
473
  end
@@ -464,7 +475,7 @@ module Bundler
464
475
  map aliases_for("cache")
465
476
 
466
477
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
467
- method_option :keep_file_descriptors, :type => :boolean, :default => false
478
+ method_option :keep_file_descriptors, :type => :boolean, :default => true
468
479
  method_option :gemfile, :type => :string, :required => false
469
480
  long_desc <<-D
470
481
  Exec runs a command, providing it access to the gems in the bundle. While using
@@ -472,6 +483,10 @@ module Bundler
472
483
  into the system wide RubyGems repository.
473
484
  D
474
485
  def exec(*args)
486
+ if ARGV.include?("--no-keep-file-descriptors")
487
+ SharedHelpers.major_deprecation(2, "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to")
488
+ end
489
+
475
490
  require_relative "cli/exec"
476
491
  Exec.new(options, args).run
477
492
  end
@@ -486,8 +501,8 @@ module Bundler
486
501
  By default, setting a configuration value sets it for all projects
487
502
  on the machine.
488
503
 
489
- If a global setting is superceded by local configuration, this command
490
- will show the current value, as well as any superceded values and
504
+ If a global setting is superseded by local configuration, this command
505
+ will show the current value, as well as any superseded values and
491
506
  where they were specified.
492
507
  D
493
508
  require_relative "cli/config"
@@ -507,7 +522,7 @@ module Bundler
507
522
  end
508
523
  end
509
524
 
510
- desc "version", "Prints the bundler's version information"
525
+ desc "version", "Prints Bundler version information"
511
526
  def version
512
527
  cli_help = current_command.name == "cli_help"
513
528
  if cli_help || ARGV.include?("version")
@@ -550,7 +565,7 @@ module Bundler
550
565
  method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
551
566
  method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
552
567
  def viz
553
- SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
568
+ SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
554
569
  require_relative "cli/viz"
555
570
  Viz.new(options.dup).run
556
571
  end
@@ -560,15 +575,23 @@ module Bundler
560
575
 
561
576
  desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
562
577
  method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library."
563
- method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set gem.coc true`."
578
+ method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
564
579
  method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
565
580
  :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
566
581
  :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
567
- method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code"
582
+ method_option :ext, :type => :string, :desc => "Generate the boilerplate for C extension code.", :enum => EXTENSIONS
568
583
  method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
569
- method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set gem.mit true`."
570
- method_option :test, :type => :string, :lazy_default => "rspec", :aliases => "-t", :banner => "rspec",
571
- :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config set gem.test rspec`."
584
+ method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
585
+ method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
586
+ method_option :changelog, :type => :boolean, :desc => "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
587
+ method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library",
588
+ :desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
589
+ method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
590
+ :desc => "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
591
+ method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "",
592
+ :desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
593
+ method_option :github_username, :type => :string, :default => Bundler.settings["gem.github_username"], :banner => "Set your username on GitHub", :desc => "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
594
+
572
595
  def gem(name)
573
596
  end
574
597
 
@@ -595,14 +618,14 @@ module Bundler
595
618
  private :gem
596
619
 
597
620
  def self.source_root
598
- File.expand_path(File.join(File.dirname(__FILE__), "templates"))
621
+ File.expand_path("templates", __dir__)
599
622
  end
600
623
 
601
624
  desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true
602
625
  method_option "dry-run", :type => :boolean, :default => false, :banner =>
603
626
  "Only print out changes, do not clean gems"
604
627
  method_option "force", :type => :boolean, :default => false, :banner =>
605
- "Forces clean even if --path is not set"
628
+ "Forces cleaning up unused gems even if Bundler is configured to use globally installed gems. As a consequence, removes all system gems except for the ones in the current application."
606
629
  def clean
607
630
  require_relative "cli/clean"
608
631
  Clean.new(options.dup).run
@@ -650,10 +673,14 @@ module Bundler
650
673
  "If updating, prefer updating only to next minor version"
651
674
  method_option "major", :type => :boolean, :banner =>
652
675
  "If updating, prefer updating to next major version (default)"
676
+ method_option "pre", :type => :boolean, :banner =>
677
+ "If updating, always choose the highest allowed version, regardless of prerelease status"
653
678
  method_option "strict", :type => :boolean, :banner =>
654
679
  "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
655
680
  method_option "conservative", :type => :boolean, :banner =>
656
681
  "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
682
+ method_option "bundler", :type => :string, :lazy_default => "> 0.a", :banner =>
683
+ "Update the locked version of bundler"
657
684
  def lock
658
685
  require_relative "cli/lock"
659
686
  Lock.new(options).run
@@ -731,11 +758,43 @@ module Bundler
731
758
  end
732
759
  end
733
760
 
734
- private
761
+ def self.check_deprecated_ext_option(arguments)
762
+ # when deprecated version of `--ext` is called
763
+ # print out deprecation warning and pretend `--ext=c` was provided
764
+ if deprecated_ext_value?(arguments)
765
+ SharedHelpers.major_deprecation 2, "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been deprecated. Please select a language, e.g. `--ext=rust` to generate a Rust extension. This gem will now be generated as if `--ext=c` was used."
766
+ arguments[arguments.index("--ext")] = "--ext=c"
767
+ end
768
+ end
769
+
770
+ def self.deprecated_ext_value?(arguments)
771
+ index = arguments.index("--ext")
772
+ next_argument = arguments[index+1]
773
+
774
+ # it is ok when --ext is followed with valid extension value
775
+ # for example `bundle gem hello --ext c`
776
+ return false if EXTENSIONS.include?(next_argument)
777
+
778
+ # deprecated call when --ext is called with no value in last position
779
+ # for example `bundle gem hello_gem --ext`
780
+ return true if next_argument.nil?
781
+
782
+ # deprecated call when --ext is followed by other parameter
783
+ # for example `bundle gem --ext --no-ci hello_gem`
784
+ return true if next_argument.start_with?("-")
785
+
786
+ # deprecated call when --ext is followed by gem name
787
+ # for example `bundle gem --ext hello_gem`
788
+ return true if next_argument
789
+
790
+ false
791
+ end
792
+
793
+ private
735
794
 
736
795
  # Automatically invoke `bundle install` and resume if
737
796
  # Bundler.settings[:auto_install] exists. This is set through config cmd
738
- # `bundle config set auto_install 1`.
797
+ # `bundle config set --global auto_install 1`.
739
798
  #
740
799
  # Note that this method `nil`s out the global Definition object, so it
741
800
  # should be called first, before you instantiate anything like an
@@ -793,35 +852,40 @@ module Bundler
793
852
 
794
853
  current = Gem::Version.new(VERSION)
795
854
  return if current >= latest
796
- latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max
797
-
798
- installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
799
- if latest_installed && latest_installed > current
800
- suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
801
- suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
802
- else
803
- suggestion = installation
804
- end
805
855
 
806
- Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
856
+ Bundler.ui.warn \
857
+ "The latest bundler is #{latest}, but you are currently running #{current}.\n" \
858
+ "To update to the most recent version, run `bundle update --bundler`"
807
859
  rescue RuntimeError
808
860
  nil
809
861
  end
810
862
 
863
+ def remembered_negative_flag_deprecation(name)
864
+ positive_name = name.gsub(/\Ano-/, "")
865
+ option = current_command.options[positive_name]
866
+ flag_name = "--no-" + option.switch_name.gsub(/\A--/, "")
867
+
868
+ flag_deprecation(positive_name, flag_name, option)
869
+ end
870
+
811
871
  def remembered_flag_deprecation(name)
812
872
  option = current_command.options[name]
813
873
  flag_name = option.switch_name
814
874
 
815
- name_index = ARGV.find {|arg| flag_name == arg }
875
+ flag_deprecation(name, flag_name, option)
876
+ end
877
+
878
+ def flag_deprecation(name, flag_name, option)
879
+ name_index = ARGV.find {|arg| flag_name == arg.split("=")[0] }
816
880
  return unless name_index
817
881
 
818
882
  value = options[name]
819
883
  value = value.join(" ").to_s if option.type == :array
820
884
 
821
- Bundler::SharedHelpers.major_deprecation 2,\
885
+ Bundler::SharedHelpers.major_deprecation 2,
822
886
  "The `#{flag_name}` flag is deprecated because it relies on being " \
823
887
  "remembered across bundler invocations, which bundler will no longer " \
824
- "do in future versions. Instead please use `bundle config set #{name} " \
888
+ "do in future versions. Instead please use `bundle config set --local #{name.tr("-", "_")} " \
825
889
  "'#{value}'`, and stop using this flag"
826
890
  end
827
891
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "gem_parser"
4
+
3
5
  module Bundler
4
6
  class CompactIndexClient
5
7
  class Cache
@@ -66,7 +68,7 @@ module Bundler
66
68
 
67
69
  def info_path(name)
68
70
  name = name.to_s
69
- if name =~ /[^a-z0-9_-]/
71
+ if /[^a-z0-9_-]/.match?(name)
70
72
  name += "-#{SharedHelpers.digest(:MD5).hexdigest(name).downcase}"
71
73
  info_roots.last.join(name)
72
74
  else
@@ -74,16 +76,7 @@ module Bundler
74
76
  end
75
77
  end
76
78
 
77
- def specific_dependency(name, version, platform)
78
- pattern = [version, platform].compact.join("-")
79
- return nil if pattern.empty?
80
-
81
- gem_lines = info_path(name).read
82
- gem_line = gem_lines[/^#{Regexp.escape(pattern)}\b.*/, 0]
83
- gem_line ? parse_gem(gem_line) : nil
84
- end
85
-
86
- private
79
+ private
87
80
 
88
81
  def lines(path)
89
82
  return [] unless path.file?
@@ -92,19 +85,9 @@ module Bundler
92
85
  header ? lines[header + 1..-1] : lines
93
86
  end
94
87
 
95
- def parse_gem(string)
96
- version_and_platform, rest = string.split(" ", 2)
97
- version, platform = version_and_platform.split("-", 2)
98
- dependencies, requirements = rest.split("|", 2).map {|s| s.split(",") } if rest
99
- dependencies = dependencies ? dependencies.map {|d| parse_dependency(d) } : []
100
- requirements = requirements ? requirements.map {|r| parse_dependency(r) } : []
101
- [version, platform, dependencies, requirements]
102
- end
103
-
104
- def parse_dependency(string)
105
- dependency = string.split(":")
106
- dependency[-1] = dependency[-1].split("&") if dependency.size > 1
107
- dependency
88
+ def parse_gem(line)
89
+ @dependency_parser ||= GemParser.new
90
+ @dependency_parser.parse(line)
108
91
  end
109
92
 
110
93
  def info_roots
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class CompactIndexClient
5
+ if defined?(Gem::Resolver::APISet::GemParser)
6
+ GemParser = Gem::Resolver::APISet::GemParser
7
+ else
8
+ class GemParser
9
+ def parse(line)
10
+ version_and_platform, rest = line.split(" ", 2)
11
+ version, platform = version_and_platform.split("-", 2)
12
+ dependencies, requirements = rest.split("|", 2).map {|s| s.split(",") } if rest
13
+ dependencies = dependencies ? dependencies.map {|d| parse_dependency(d) } : []
14
+ requirements = requirements ? requirements.map {|d| parse_dependency(d) } : []
15
+ [version, platform, dependencies, requirements]
16
+ end
17
+
18
+ private
19
+
20
+ def parse_dependency(string)
21
+ dependency = string.split(":")
22
+ dependency[-1] = dependency[-1].split("&") if dependency.size > 1
23
+ dependency
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end