bundler 1.17.3 → 2.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (426) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3354 -1258
  3. data/LICENSE.md +18 -19
  4. data/README.md +10 -15
  5. data/bundler.gemspec +15 -33
  6. data/exe/bundle +8 -10
  7. data/exe/bundler +1 -1
  8. data/lib/bundler/.document +1 -0
  9. data/lib/bundler/build_metadata.rb +5 -13
  10. data/lib/bundler/capistrano.rb +5 -5
  11. data/lib/bundler/checksum.rb +254 -0
  12. data/lib/bundler/ci_detector.rb +75 -0
  13. data/lib/bundler/cli/add.rb +29 -15
  14. data/lib/bundler/cli/binstubs.rb +13 -5
  15. data/lib/bundler/cli/cache.rb +24 -17
  16. data/lib/bundler/cli/check.rb +7 -5
  17. data/lib/bundler/cli/clean.rb +1 -1
  18. data/lib/bundler/cli/common.rb +50 -14
  19. data/lib/bundler/cli/config.rb +171 -86
  20. data/lib/bundler/cli/console.rb +3 -6
  21. data/lib/bundler/cli/doctor.rb +29 -12
  22. data/lib/bundler/cli/exec.rb +9 -25
  23. data/lib/bundler/cli/fund.rb +36 -0
  24. data/lib/bundler/cli/gem.rb +268 -53
  25. data/lib/bundler/cli/info.rb +51 -18
  26. data/lib/bundler/cli/init.rb +7 -3
  27. data/lib/bundler/cli/inject.rb +2 -2
  28. data/lib/bundler/cli/install.rb +55 -73
  29. data/lib/bundler/cli/issue.rb +9 -8
  30. data/lib/bundler/cli/list.rb +19 -11
  31. data/lib/bundler/cli/lock.rb +56 -26
  32. data/lib/bundler/cli/open.rb +10 -7
  33. data/lib/bundler/cli/outdated.rb +159 -128
  34. data/lib/bundler/cli/platform.rb +8 -6
  35. data/lib/bundler/cli/plugin.rb +23 -12
  36. data/lib/bundler/cli/pristine.rb +39 -26
  37. data/lib/bundler/cli/remove.rb +1 -2
  38. data/lib/bundler/cli/show.rb +7 -7
  39. data/lib/bundler/cli/update.rb +51 -19
  40. data/lib/bundler/cli/viz.rb +1 -1
  41. data/lib/bundler/cli.rb +399 -390
  42. data/lib/bundler/compact_index_client/cache.rb +55 -77
  43. data/lib/bundler/compact_index_client/cache_file.rb +148 -0
  44. data/lib/bundler/compact_index_client/gem_parser.rb +32 -0
  45. data/lib/bundler/compact_index_client/parser.rb +84 -0
  46. data/lib/bundler/compact_index_client/updater.rb +72 -84
  47. data/lib/bundler/compact_index_client.rb +61 -73
  48. data/lib/bundler/constants.rb +9 -2
  49. data/lib/bundler/current_ruby.rb +20 -21
  50. data/lib/bundler/definition.rb +663 -505
  51. data/lib/bundler/dependency.rb +38 -71
  52. data/lib/bundler/deployment.rb +1 -1
  53. data/lib/bundler/digest.rb +71 -0
  54. data/lib/bundler/dsl.rb +171 -152
  55. data/lib/bundler/endpoint_specification.rb +43 -17
  56. data/lib/bundler/env.rb +11 -18
  57. data/lib/bundler/environment_preserver.rb +17 -8
  58. data/lib/bundler/errors.rb +115 -14
  59. data/lib/bundler/feature_flag.rb +15 -39
  60. data/lib/bundler/fetcher/base.rb +12 -12
  61. data/lib/bundler/fetcher/compact_index.rb +41 -47
  62. data/lib/bundler/fetcher/dependency.rb +4 -8
  63. data/lib/bundler/fetcher/downloader.rb +27 -20
  64. data/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
  65. data/lib/bundler/fetcher/index.rb +6 -33
  66. data/lib/bundler/fetcher.rb +109 -90
  67. data/lib/bundler/force_platform.rb +16 -0
  68. data/lib/bundler/friendly_errors.rb +50 -55
  69. data/lib/bundler/gem_helper.rb +81 -46
  70. data/lib/bundler/gem_helpers.rb +78 -29
  71. data/lib/bundler/gem_tasks.rb +1 -1
  72. data/lib/bundler/gem_version_promoter.rb +68 -109
  73. data/lib/bundler/graph.rb +11 -11
  74. data/lib/bundler/index.rb +74 -82
  75. data/lib/bundler/injector.rb +58 -26
  76. data/lib/bundler/inline.rb +59 -35
  77. data/lib/bundler/installer/gem_installer.rb +29 -29
  78. data/lib/bundler/installer/parallel_installer.rb +38 -68
  79. data/lib/bundler/installer/standalone.rb +76 -16
  80. data/lib/bundler/installer.rb +60 -135
  81. data/lib/bundler/lazy_specification.rb +161 -63
  82. data/lib/bundler/lockfile_generator.rb +14 -5
  83. data/lib/bundler/lockfile_parser.rb +150 -109
  84. data/lib/bundler/man/bundle-add.1 +76 -0
  85. data/lib/bundler/man/bundle-add.1.ronn +87 -0
  86. data/{man → lib/bundler/man}/bundle-binstubs.1 +15 -22
  87. data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +8 -7
  88. data/lib/bundler/man/bundle-cache.1 +68 -0
  89. data/lib/bundler/man/bundle-cache.1.ronn +108 -0
  90. data/{man → lib/bundler/man}/bundle-check.1 +7 -14
  91. data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +7 -2
  92. data/{man → lib/bundler/man}/bundle-clean.1 +4 -11
  93. data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
  94. data/{man → lib/bundler/man}/bundle-config.1 +80 -260
  95. data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +104 -98
  96. data/lib/bundler/man/bundle-console.1 +33 -0
  97. data/lib/bundler/man/bundle-console.1.ronn +39 -0
  98. data/{man → lib/bundler/man}/bundle-doctor.1 +5 -19
  99. data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +1 -1
  100. data/lib/bundler/man/bundle-env.1 +9 -0
  101. data/lib/bundler/man/bundle-env.1.ronn +10 -0
  102. data/{man → lib/bundler/man}/bundle-exec.1 +20 -78
  103. data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +12 -10
  104. data/lib/bundler/man/bundle-fund.1 +22 -0
  105. data/lib/bundler/man/bundle-fund.1.ronn +25 -0
  106. data/lib/bundler/man/bundle-gem.1 +87 -0
  107. data/lib/bundler/man/bundle-gem.1.ronn +149 -0
  108. data/lib/bundler/man/bundle-help.1 +9 -0
  109. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  110. data/lib/bundler/man/bundle-info.1 +17 -0
  111. data/lib/bundler/man/bundle-info.1.ronn +21 -0
  112. data/{man → lib/bundler/man}/bundle-init.1 +8 -13
  113. data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +5 -2
  114. data/lib/bundler/man/bundle-inject.1 +31 -0
  115. data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +12 -2
  116. data/{man → lib/bundler/man}/bundle-install.1 +65 -155
  117. data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +66 -57
  118. data/lib/bundler/man/bundle-issue.1 +45 -0
  119. data/lib/bundler/man/bundle-issue.1.ronn +37 -0
  120. data/lib/bundler/man/bundle-licenses.1 +9 -0
  121. data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  122. data/{man → lib/bundler/man}/bundle-list.1 +9 -24
  123. data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +10 -7
  124. data/{man → lib/bundler/man}/bundle-lock.1 +25 -34
  125. data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +25 -4
  126. data/lib/bundler/man/bundle-open.1 +32 -0
  127. data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +10 -1
  128. data/{man → lib/bundler/man}/bundle-outdated.1 +23 -75
  129. data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +21 -22
  130. data/lib/bundler/man/bundle-platform.1 +49 -0
  131. data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
  132. data/lib/bundler/man/bundle-plugin.1 +58 -0
  133. data/lib/bundler/man/bundle-plugin.1.ronn +63 -0
  134. data/{man → lib/bundler/man}/bundle-pristine.1 +5 -16
  135. data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +1 -1
  136. data/{man → lib/bundler/man}/bundle-remove.1 +4 -14
  137. data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +1 -1
  138. data/{man → lib/bundler/man}/bundle-show.1 +7 -11
  139. data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +4 -0
  140. data/{man → lib/bundler/man}/bundle-update.1 +35 -148
  141. data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +21 -12
  142. data/lib/bundler/man/bundle-version.1 +22 -0
  143. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  144. data/{man → lib/bundler/man}/bundle-viz.1 +9 -18
  145. data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +9 -3
  146. data/{man → lib/bundler/man}/bundle.1 +19 -53
  147. data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +14 -9
  148. data/{man → lib/bundler/man}/gemfile.5 +139 -356
  149. data/{man → lib/bundler/man}/gemfile.5.ronn +134 -97
  150. data/{man → lib/bundler/man}/index.txt +9 -1
  151. data/lib/bundler/match_metadata.rb +17 -0
  152. data/lib/bundler/match_platform.rb +2 -3
  153. data/lib/bundler/match_remote_metadata.rb +29 -0
  154. data/lib/bundler/materialization.rb +59 -0
  155. data/lib/bundler/mirror.rb +10 -12
  156. data/lib/bundler/plugin/api/source.rb +34 -18
  157. data/lib/bundler/plugin/api.rb +1 -1
  158. data/lib/bundler/plugin/dsl.rb +1 -1
  159. data/lib/bundler/plugin/events.rb +24 -0
  160. data/lib/bundler/plugin/index.rb +44 -9
  161. data/lib/bundler/plugin/installer/git.rb +0 -4
  162. data/lib/bundler/plugin/installer/path.rb +18 -0
  163. data/lib/bundler/plugin/installer/rubygems.rb +1 -9
  164. data/lib/bundler/plugin/installer.rb +63 -27
  165. data/lib/bundler/plugin/source_list.rb +5 -1
  166. data/lib/bundler/plugin.rb +131 -45
  167. data/lib/bundler/process_lock.rb +10 -14
  168. data/lib/bundler/remote_specification.rb +22 -10
  169. data/lib/bundler/resolver/base.rb +118 -0
  170. data/lib/bundler/resolver/candidate.rb +82 -0
  171. data/lib/bundler/resolver/incompatibility.rb +15 -0
  172. data/lib/bundler/resolver/package.rb +90 -0
  173. data/lib/bundler/resolver/root.rb +25 -0
  174. data/lib/bundler/resolver/spec_group.rb +60 -68
  175. data/lib/bundler/resolver.rb +454 -303
  176. data/lib/bundler/retry.rb +6 -6
  177. data/lib/bundler/ruby_dsl.rb +51 -7
  178. data/lib/bundler/ruby_version.rb +23 -38
  179. data/lib/bundler/rubygems_ext.rb +357 -98
  180. data/lib/bundler/rubygems_gem_installer.rb +131 -65
  181. data/lib/bundler/rubygems_integration.rb +149 -591
  182. data/lib/bundler/runtime.rb +51 -51
  183. data/lib/bundler/safe_marshal.rb +31 -0
  184. data/lib/bundler/self_manager.rb +206 -0
  185. data/lib/bundler/settings.rb +271 -135
  186. data/lib/bundler/setup.rb +23 -12
  187. data/lib/bundler/shared_helpers.rb +127 -117
  188. data/lib/bundler/similarity_detector.rb +3 -3
  189. data/lib/bundler/source/git/git_proxy.rb +326 -127
  190. data/lib/bundler/source/git.rb +207 -88
  191. data/lib/bundler/source/metadata.rb +19 -18
  192. data/lib/bundler/source/path/installer.rb +11 -32
  193. data/lib/bundler/source/path.rb +39 -38
  194. data/lib/bundler/source/rubygems/remote.rb +3 -4
  195. data/lib/bundler/source/rubygems.rb +223 -255
  196. data/lib/bundler/source/rubygems_aggregate.rb +68 -0
  197. data/lib/bundler/source.rb +33 -11
  198. data/lib/bundler/source_list.rb +131 -66
  199. data/lib/bundler/source_map.rb +71 -0
  200. data/lib/bundler/spec_set.rb +239 -94
  201. data/lib/bundler/stub_specification.rb +77 -39
  202. data/lib/bundler/templates/Executable +3 -5
  203. data/lib/bundler/templates/Executable.bundler +23 -19
  204. data/lib/bundler/templates/Executable.standalone +4 -4
  205. data/lib/bundler/templates/Gemfile +0 -2
  206. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  207. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +104 -46
  208. data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  209. data/lib/bundler/templates/newgem/Gemfile.tt +19 -2
  210. data/lib/bundler/templates/newgem/README.md.tt +18 -16
  211. data/lib/bundler/templates/newgem/Rakefile.tt +44 -6
  212. data/lib/bundler/templates/newgem/bin/console.tt +1 -4
  213. data/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
  214. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  215. data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
  216. data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  217. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
  218. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  219. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
  220. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  221. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
  222. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  223. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  224. data/lib/bundler/templates/newgem/newgem.gemspec.tt +37 -40
  225. data/lib/bundler/templates/newgem/rubocop.yml.tt +8 -0
  226. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  227. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  228. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  229. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  230. data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
  231. data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
  232. data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  233. data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  234. data/lib/bundler/ui/rg_proxy.rb +2 -2
  235. data/lib/bundler/ui/shell.rb +64 -23
  236. data/lib/bundler/ui/silent.rb +33 -6
  237. data/lib/bundler/ui.rb +3 -3
  238. data/lib/bundler/uri_credentials_filter.rb +11 -5
  239. data/lib/bundler/uri_normalizer.rb +23 -0
  240. data/lib/bundler/vendor/.document +1 -0
  241. data/lib/bundler/vendor/connection_pool/.document +1 -0
  242. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  243. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
  244. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
  245. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
  246. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +175 -0
  247. data/lib/bundler/vendor/fileutils/.document +1 -0
  248. data/lib/bundler/vendor/fileutils/COPYING +56 -0
  249. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1490 -432
  250. data/lib/bundler/vendor/net-http-persistent/.document +1 -0
  251. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  252. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +41 -0
  253. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +65 -0
  254. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
  255. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +362 -484
  256. data/lib/bundler/vendor/pub_grub/.document +1 -0
  257. data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  258. data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  259. data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  260. data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  261. data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
  262. data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  263. data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  264. data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  265. data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  266. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +61 -0
  267. data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  268. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  269. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
  270. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
  271. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
  272. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  273. data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  274. data/lib/bundler/vendor/securerandom/.document +1 -0
  275. data/lib/bundler/vendor/securerandom/COPYING +56 -0
  276. data/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
  277. data/lib/bundler/vendor/thor/.document +1 -0
  278. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  279. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +4 -3
  280. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
  281. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +8 -18
  282. data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +1 -1
  283. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +27 -20
  284. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +34 -13
  285. data/lib/bundler/vendor/thor/lib/thor/actions.rb +47 -28
  286. data/lib/bundler/vendor/thor/lib/thor/base.rb +200 -54
  287. data/lib/bundler/vendor/thor/lib/thor/command.rb +34 -18
  288. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +10 -0
  289. data/lib/bundler/vendor/thor/lib/thor/error.rb +74 -0
  290. data/lib/bundler/vendor/thor/lib/thor/group.rb +15 -4
  291. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +2 -1
  292. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
  293. data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
  294. data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
  295. data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  296. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +17 -1
  297. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +35 -15
  298. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +45 -13
  299. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +86 -13
  300. data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
  301. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +3 -2
  302. data/lib/bundler/vendor/thor/lib/thor/runner.rb +51 -40
  303. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +99 -148
  304. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +6 -43
  305. data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
  306. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -49
  307. data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +118 -0
  308. data/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
  309. data/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
  310. data/lib/bundler/vendor/thor/lib/thor/shell.rb +6 -6
  311. data/lib/bundler/vendor/thor/lib/thor/util.rb +26 -9
  312. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  313. data/lib/bundler/vendor/thor/lib/thor.rb +182 -17
  314. data/lib/bundler/vendor/tsort/.document +1 -0
  315. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  316. data/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
  317. data/lib/bundler/vendor/uri/.document +1 -0
  318. data/lib/bundler/vendor/uri/COPYING +56 -0
  319. data/lib/bundler/vendor/uri/lib/uri/common.rb +876 -0
  320. data/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
  321. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  322. data/lib/bundler/vendor/uri/lib/uri/generic.rb +1578 -0
  323. data/lib/bundler/vendor/uri/lib/uri/http.rb +125 -0
  324. data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  325. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  326. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +22 -0
  327. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
  328. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  329. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +206 -0
  330. data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  331. data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  332. data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  333. data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  334. data/lib/bundler/vendored_fileutils.rb +1 -6
  335. data/lib/bundler/vendored_net_http.rb +23 -0
  336. data/lib/bundler/vendored_persistent.rb +1 -42
  337. data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
  338. data/lib/bundler/vendored_securerandom.rb +12 -0
  339. data/lib/bundler/vendored_thor.rb +2 -2
  340. data/lib/bundler/vendored_timeout.rb +12 -0
  341. data/lib/bundler/vendored_tsort.rb +4 -0
  342. data/lib/bundler/vendored_uri.rb +21 -0
  343. data/lib/bundler/version.rb +5 -20
  344. data/lib/bundler/vlad.rb +3 -3
  345. data/lib/bundler/worker.rb +26 -15
  346. data/lib/bundler/yaml_serializer.rb +21 -13
  347. data/lib/bundler.rb +364 -230
  348. metadata +186 -218
  349. data/exe/bundle_ruby +0 -60
  350. data/lib/bundler/cli/package.rb +0 -49
  351. data/lib/bundler/compatibility_guard.rb +0 -14
  352. data/lib/bundler/dep_proxy.rb +0 -48
  353. data/lib/bundler/gem_remote_fetcher.rb +0 -43
  354. data/lib/bundler/gemdeps.rb +0 -29
  355. data/lib/bundler/psyched_yaml.rb +0 -37
  356. data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
  357. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
  358. data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  359. data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  360. data/lib/bundler/templates/gems.rb +0 -8
  361. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -3
  362. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
  363. data/lib/bundler/templates/newgem/travis.yml.tt +0 -7
  364. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  365. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  366. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
  367. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  368. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  369. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  370. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  371. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  372. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  373. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  374. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  375. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -136
  376. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
  377. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
  378. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  379. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
  380. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  381. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
  382. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  383. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  384. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
  385. data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
  386. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
  387. data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
  388. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
  389. data/lib/bundler/version_ranges.rb +0 -76
  390. data/man/bundle-add.1 +0 -58
  391. data/man/bundle-add.1.txt +0 -52
  392. data/man/bundle-add.ronn +0 -40
  393. data/man/bundle-binstubs.1.txt +0 -48
  394. data/man/bundle-check.1.txt +0 -33
  395. data/man/bundle-clean.1.txt +0 -26
  396. data/man/bundle-config.1.txt +0 -529
  397. data/man/bundle-doctor.1.txt +0 -44
  398. data/man/bundle-exec.1.txt +0 -178
  399. data/man/bundle-gem.1 +0 -80
  400. data/man/bundle-gem.1.txt +0 -91
  401. data/man/bundle-gem.ronn +0 -78
  402. data/man/bundle-info.1 +0 -20
  403. data/man/bundle-info.1.txt +0 -21
  404. data/man/bundle-info.ronn +0 -17
  405. data/man/bundle-init.1.txt +0 -34
  406. data/man/bundle-inject.1 +0 -33
  407. data/man/bundle-inject.1.txt +0 -32
  408. data/man/bundle-install.1.txt +0 -396
  409. data/man/bundle-list.1.txt +0 -43
  410. data/man/bundle-lock.1.txt +0 -93
  411. data/man/bundle-open.1 +0 -32
  412. data/man/bundle-open.1.txt +0 -29
  413. data/man/bundle-outdated.1.txt +0 -131
  414. data/man/bundle-package.1 +0 -55
  415. data/man/bundle-package.1.txt +0 -79
  416. data/man/bundle-package.ronn +0 -72
  417. data/man/bundle-platform.1 +0 -61
  418. data/man/bundle-platform.1.txt +0 -57
  419. data/man/bundle-pristine.1.txt +0 -44
  420. data/man/bundle-remove.1.txt +0 -34
  421. data/man/bundle-show.1.txt +0 -27
  422. data/man/bundle-update.1.txt +0 -391
  423. data/man/bundle-viz.1.txt +0 -39
  424. data/man/bundle.1.txt +0 -116
  425. data/man/gemfile.5.txt +0 -653
  426. /data/lib/bundler/{ssl_certs → man}/.document +0 -0
data/lib/bundler/cli.rb CHANGED
@@ -1,24 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler"
4
- require "bundler/vendored_thor"
3
+ require_relative "vendored_thor"
5
4
 
6
5
  module Bundler
7
6
  class CLI < Thor
8
- require "bundler/cli/common"
7
+ require_relative "cli/common"
8
+ require_relative "cli/install"
9
9
 
10
10
  package_name "Bundler"
11
11
 
12
12
  AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean].freeze
13
- PARSEABLE_COMMANDS = %w[
14
- check config help exec platform show version
15
- ].freeze
13
+ PARSEABLE_COMMANDS = %w[check config help exec platform show version].freeze
14
+ EXTENSIONS = ["c", "rust"].freeze
15
+
16
+ COMMAND_ALIASES = {
17
+ "check" => "c",
18
+ "install" => "i",
19
+ "plugin" => "",
20
+ "list" => "ls",
21
+ "exec" => ["e", "ex", "exe"],
22
+ "cache" => ["package", "pack"],
23
+ "version" => ["-v", "--version"],
24
+ }.freeze
16
25
 
17
26
  def self.start(*)
27
+ check_deprecated_ext_option(ARGV) if ARGV.include?("--ext")
28
+
18
29
  super
19
- rescue Exception => e
20
- Bundler.ui = UI::Shell.new
21
- raise e
22
30
  ensure
23
31
  Bundler::SharedHelpers.print_major_deprecations!
24
32
  end
@@ -30,19 +38,39 @@ module Bundler
30
38
  end
31
39
  end
32
40
 
41
+ def self.all_aliases
42
+ @all_aliases ||= begin
43
+ command_aliases = {}
44
+
45
+ COMMAND_ALIASES.each do |name, aliases|
46
+ Array(aliases).each do |one_alias|
47
+ command_aliases[one_alias] = name
48
+ end
49
+ end
50
+
51
+ command_aliases
52
+ end
53
+ end
54
+
55
+ def self.aliases_for(command_name)
56
+ COMMAND_ALIASES.select {|k, _| k == command_name }.invert
57
+ end
58
+
33
59
  def initialize(*args)
34
60
  super
35
61
 
36
62
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
37
63
  if custom_gemfile && !custom_gemfile.empty?
38
64
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
39
- Bundler.reset_paths!
65
+ Bundler.reset_settings_and_root!
40
66
  end
41
67
 
68
+ Bundler.auto_switch
69
+
42
70
  Bundler.settings.set_command_option_if_given :retry, options[:retry]
43
71
 
44
72
  current_cmd = args.last[:current_command].name
45
- auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
73
+ Bundler.auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
46
74
  rescue UnknownArgumentError => e
47
75
  raise InvalidOption, e.message
48
76
  ensure
@@ -51,32 +79,17 @@ module Bundler
51
79
  Bundler.ui = UI::Shell.new(options)
52
80
  Bundler.ui.level = "debug" if options["verbose"]
53
81
  unprinted_warnings.each {|w| Bundler.ui.warn(w) }
54
-
55
- if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
56
- Bundler.ui.warn(
57
- "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \
58
- "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \
59
- "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true
60
- )
61
- end
62
82
  end
63
83
 
64
- def self.deprecated_option(*args, &blk)
65
- return if Bundler.feature_flag.forget_cli_options?
66
- method_option(*args, &blk)
67
- end
68
-
69
- check_unknown_options!(:except => [:config, :exec])
84
+ check_unknown_options!(except: [:config, :exec])
70
85
  stop_on_unknown_option! :exec
71
86
 
72
- desc "cli_help", "Prints a summary of bundler commands", :hide => true
87
+ desc "cli_help", "Prints a summary of bundler commands", hide: true
73
88
  def cli_help
74
89
  version
75
90
  Bundler.ui.info "\n"
76
91
 
77
- primary_commands = ["install", "update",
78
- Bundler.feature_flag.cache_command_is_package? ? "cache" : "package",
79
- "exec", "config", "help"]
92
+ primary_commands = ["install", "update", "cache", "exec", "config", "help"]
80
93
 
81
94
  list = self.class.printable_commands(true)
82
95
  by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] }
@@ -87,37 +100,40 @@ module Bundler
87
100
  shell.say "Bundler commands:\n\n"
88
101
 
89
102
  shell.say " Primary commands:\n"
90
- shell.print_table(primary_commands, :indent => 4, :truncate => true)
103
+ shell.print_table(primary_commands, indent: 4, truncate: true)
91
104
  shell.say
92
105
  shell.say " Utilities:\n"
93
- shell.print_table(utilities, :indent => 4, :truncate => true)
106
+ shell.print_table(utilities, indent: 4, truncate: true)
94
107
  shell.say
95
108
  self.class.send(:class_options_help, shell)
96
109
  end
97
110
  default_task(Bundler.feature_flag.default_cli_command)
98
111
 
99
- class_option "no-color", :type => :boolean, :desc => "Disable colorization in output"
100
- class_option "retry", :type => :numeric, :aliases => "-r", :banner => "NUM",
101
- :desc => "Specify the number of times you wish to attempt network commands"
102
- class_option "verbose", :type => :boolean, :desc => "Enable verbose output mode", :aliases => "-V"
112
+ class_option "no-color", type: :boolean, desc: "Disable colorization in output"
113
+ class_option "retry", type: :numeric, aliases: "-r", banner: "NUM",
114
+ desc: "Specify the number of times you wish to attempt network commands"
115
+ class_option "verbose", type: :boolean, desc: "Enable verbose output mode", aliases: "-V"
103
116
 
104
117
  def help(cli = nil)
118
+ cli = self.class.all_aliases[cli] if self.class.all_aliases[cli]
119
+
105
120
  case cli
106
121
  when "gemfile" then command = "gemfile"
107
122
  when nil then command = "bundle"
108
123
  else command = "bundle-#{cli}"
109
124
  end
110
125
 
111
- man_path = File.expand_path("../../../man", __FILE__)
112
- man_pages = Hash[Dir.glob(File.join(man_path, "*")).grep(/.*\.\d*\Z/).collect do |f|
126
+ man_path = File.expand_path("man", __dir__)
127
+ man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
113
128
  [File.basename(f, ".*"), f]
114
129
  end]
115
130
 
116
131
  if man_pages.include?(command)
117
- if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
118
- Kernel.exec "man #{man_pages[command]}"
132
+ man_page = man_pages[command]
133
+ if Bundler.which("man") && !man_path.match?(%r{^file:/.+!/META-INF/jruby.home/.+})
134
+ Kernel.exec("man", man_page)
119
135
  else
120
- puts File.read("#{man_path}/#{File.basename(man_pages[command])}.txt")
136
+ puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
121
137
  end
122
138
  elsif command_path = Bundler.which("bundler-#{cli}")
123
139
  Kernel.exec(command_path, "--help")
@@ -142,9 +158,10 @@ module Bundler
142
158
  Gemfile to a gem with a gemspec, the --gemspec option will automatically add each
143
159
  dependency listed in the gemspec file to the newly created Gemfile.
144
160
  D
145
- deprecated_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
161
+ method_option "gemspec", type: :string, banner: "Use the specified .gemspec to create the Gemfile"
162
+ method_option "gemfile", type: :string, banner: "Use the specified name for the gemfile instead of 'Gemfile'"
146
163
  def init
147
- require "bundler/cli/init"
164
+ require_relative "cli/init"
148
165
  Init.new(options.dup).run
149
166
  end
150
167
 
@@ -154,26 +171,31 @@ module Bundler
154
171
  all gems are found, Bundler prints a success message and exits with a status of 0.
155
172
  If not, the first missing gem is listed and Bundler exits status 1.
156
173
  D
157
- method_option "dry-run", :type => :boolean, :default => false, :banner =>
158
- "Lock the Gemfile"
159
- method_option "gemfile", :type => :string, :banner =>
160
- "Use the specified gemfile instead of Gemfile"
161
- method_option "path", :type => :string, :banner =>
162
- "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
163
- map "c" => "check"
174
+ method_option "dry-run", type: :boolean, default: false, banner: "Lock the Gemfile"
175
+ method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
176
+ method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
164
177
  def check
165
- require "bundler/cli/check"
178
+ remembered_flag_deprecation("path")
179
+
180
+ require_relative "cli/check"
166
181
  Check.new(options).run
167
182
  end
168
183
 
184
+ map aliases_for("check")
185
+
169
186
  desc "remove [GEM [GEM ...]]", "Removes gems from the Gemfile"
170
187
  long_desc <<-D
171
188
  Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If the gem is not found, Bundler prints a error message and if gem could not be removed due to any reason Bundler will display a warning.
172
189
  D
173
- method_option "install", :type => :boolean, :banner =>
174
- "Runs 'bundle install' after removing the gems from the Gemfile"
190
+ method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile"
175
191
  def remove(*gems)
176
- require "bundler/cli/remove"
192
+ if ARGV.include?("--install")
193
+ message = "The `--install` flag has been deprecated. `bundle install` is triggered by default."
194
+ removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default."
195
+ SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
196
+ end
197
+
198
+ require_relative "cli/remove"
177
199
  Remove.new(gems, options).run
178
200
  end
179
201
 
@@ -188,96 +210,75 @@ module Bundler
188
210
 
189
211
  If the bundle has already been installed, bundler will tell you so and then exit.
190
212
  D
191
- deprecated_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
192
- "Generate bin stubs for bundled gems to ./bin"
193
- deprecated_option "clean", :type => :boolean, :banner =>
194
- "Run bundle clean automatically after install"
195
- deprecated_option "deployment", :type => :boolean, :banner =>
196
- "Install using defaults tuned for deployment environments"
197
- deprecated_option "frozen", :type => :boolean, :banner =>
198
- "Do not allow the Gemfile.lock to be updated after this install"
199
- method_option "full-index", :type => :boolean, :banner =>
200
- "Fall back to using the single-file index of all gems"
201
- method_option "gemfile", :type => :string, :banner =>
202
- "Use the specified gemfile instead of Gemfile"
203
- method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
204
- "Specify the number of jobs to run in parallel"
205
- method_option "local", :type => :boolean, :banner =>
206
- "Do not attempt to fetch gems remotely and use the gem cache instead"
207
- deprecated_option "no-cache", :type => :boolean, :banner =>
208
- "Don't update the existing gem cache."
209
- method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
210
- "Force downloading every gem."
211
- deprecated_option "no-prune", :type => :boolean, :banner =>
212
- "Don't remove stale gems from the cache."
213
- deprecated_option "path", :type => :string, :banner =>
214
- "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
215
- method_option "quiet", :type => :boolean, :banner =>
216
- "Only output warnings and errors."
217
- deprecated_option "shebang", :type => :string, :banner =>
218
- "Specify a different shebang executable name than the default (usually 'ruby')"
219
- method_option "standalone", :type => :array, :lazy_default => [], :banner =>
220
- "Make a bundle that can work without the Bundler runtime"
221
- deprecated_option "system", :type => :boolean, :banner =>
222
- "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
223
- method_option "trust-policy", :alias => "P", :type => :string, :banner =>
224
- "Gem trust policy (like gem install -P). Must be one of " +
225
- Bundler.rubygems.security_policy_keys.join("|")
226
- deprecated_option "without", :type => :array, :banner =>
227
- "Exclude gems that are part of the specified named group."
228
- deprecated_option "with", :type => :array, :banner =>
229
- "Include gems that are part of the specified named group."
230
- map "i" => "install"
213
+ method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin"
214
+ method_option "clean", type: :boolean, banner: "Run bundle clean automatically after install"
215
+ method_option "deployment", type: :boolean, banner: "Install using defaults tuned for deployment environments"
216
+ method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this install"
217
+ method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems"
218
+ method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
219
+ method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
220
+ method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
221
+ method_option "prefer-local", type: :boolean, banner: "Only attempt to fetch gems remotely if not present locally, even if newer versions are available remotely"
222
+ method_option "no-cache", type: :boolean, banner: "Don't update the existing gem cache."
223
+ method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
224
+ method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
225
+ method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
226
+ method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
227
+ method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
228
+ method_option "standalone", type: :array, lazy_default: [], banner: "Make a bundle that can work without the Bundler runtime"
229
+ method_option "system", type: :boolean, banner: "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
230
+ method_option "trust-policy", alias: "P", type: :string, banner: "Gem trust policy (like gem install -P). Must be one of #{Bundler.rubygems.security_policy_keys.join("|")}"
231
+ method_option "target-rbconfig", type: :string, banner: "Path to rbconfig.rb for the deployment target platform"
232
+ method_option "without", type: :array, banner: "Exclude gems that are part of the specified named group."
233
+ method_option "with", type: :array, banner: "Include gems that are part of the specified named group."
231
234
  def install
232
235
  SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
233
- require "bundler/cli/install"
234
- Bundler.settings.temporary(:no_install => false) do
236
+
237
+ %w[clean deployment frozen no-prune path shebang without with].each do |option|
238
+ remembered_flag_deprecation(option)
239
+ end
240
+
241
+ print_remembered_flag_deprecation("--system", "path.system", "true") if ARGV.include?("--system")
242
+
243
+ remembered_negative_flag_deprecation("no-deployment")
244
+
245
+ require_relative "cli/install"
246
+ Bundler.settings.temporary(no_install: false) do
235
247
  Install.new(options.dup).run
236
248
  end
237
249
  end
238
250
 
251
+ map aliases_for("install")
252
+
239
253
  desc "update [OPTIONS]", "Update the current environment"
240
254
  long_desc <<-D
241
255
  Update will install the newest versions of the gems listed in the Gemfile. Use
242
256
  update when you have changed the Gemfile, or if you want to get the newest
243
257
  possible versions of the gems in the bundle.
244
258
  D
245
- method_option "full-index", :type => :boolean, :banner =>
246
- "Fall back to using the single-file index of all gems"
247
- method_option "gemfile", :type => :string, :banner =>
248
- "Use the specified gemfile instead of Gemfile"
249
- method_option "group", :aliases => "-g", :type => :array, :banner =>
250
- "Update a specific group"
251
- method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
252
- "Specify the number of jobs to run in parallel"
253
- method_option "local", :type => :boolean, :banner =>
254
- "Do not attempt to fetch gems remotely and use the gem cache instead"
255
- method_option "quiet", :type => :boolean, :banner =>
256
- "Only output warnings and errors."
257
- method_option "source", :type => :array, :banner =>
258
- "Update a specific source (and all gems associated with it)"
259
- method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
260
- "Force downloading every gem."
261
- method_option "ruby", :type => :boolean, :banner =>
262
- "Update ruby specified in Gemfile.lock"
263
- method_option "bundler", :type => :string, :lazy_default => "> 0.a", :banner =>
264
- "Update the locked version of bundler"
265
- method_option "patch", :type => :boolean, :banner =>
266
- "Prefer updating only to next patch version"
267
- method_option "minor", :type => :boolean, :banner =>
268
- "Prefer updating only to next minor version"
269
- method_option "major", :type => :boolean, :banner =>
270
- "Prefer updating to next major version (default)"
271
- method_option "strict", :type => :boolean, :banner =>
272
- "Do not allow any gem to be updated past latest --patch | --minor | --major"
273
- method_option "conservative", :type => :boolean, :banner =>
274
- "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
275
- method_option "all", :type => :boolean, :banner =>
276
- "Update everything."
259
+ method_option "full-index", type: :boolean, banner: "Fall back to using the single-file index of all gems"
260
+ method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
261
+ method_option "group", aliases: "-g", type: :array, banner: "Update a specific group"
262
+ method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
263
+ method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
264
+ method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
265
+ method_option "source", type: :array, banner: "Update a specific source (and all gems associated with it)"
266
+ method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
267
+ method_option "ruby", type: :boolean, banner: "Update ruby specified in Gemfile.lock"
268
+ method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
269
+ method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
270
+ method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
271
+ method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
272
+ method_option "pre", type: :boolean, banner: "Always choose the highest allowed version when updating gems, regardless of prerelease status"
273
+ method_option "strict", type: :boolean, banner: "Do not allow any gem to be updated past latest --patch | --minor | --major"
274
+ method_option "conservative", type: :boolean, banner: "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
275
+ method_option "all", type: :boolean, banner: "Update everything."
277
276
  def update(*gems)
278
277
  SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
279
- require "bundler/cli/update"
280
- Update.new(options, gems).run
278
+ require_relative "cli/update"
279
+ Bundler.settings.temporary(no_install: false) do
280
+ Update.new(options, gems).run
281
+ end
281
282
  end
282
283
 
283
284
  desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
@@ -285,51 +286,35 @@ module Bundler
285
286
  Show lists the names and versions of all gems that are required by your Gemfile.
286
287
  Calling show with [GEM] will list the exact location of that gem on your machine.
287
288
  D
288
- method_option "paths", :type => :boolean,
289
- :banner => "List the paths of all gems that are required by your Gemfile."
290
- method_option "outdated", :type => :boolean,
291
- :banner => "Show verbose output including whether gems are outdated."
289
+ method_option "paths", type: :boolean, banner: "List the paths of all gems that are required by your Gemfile."
290
+ method_option "outdated", type: :boolean, banner: "Show verbose output including whether gems are outdated."
292
291
  def show(gem_name = nil)
293
- if ARGV[0] == "show"
294
- rest = ARGV[1..-1]
295
-
296
- new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
297
-
298
- new_arguments = rest.map do |arg|
299
- next arg if arg != "--paths"
300
- next "--path" if new_command == "info"
301
- end
302
-
303
- old_argv = ARGV.join(" ")
304
- new_argv = [new_command, *new_arguments.compact].join(" ")
305
-
306
- Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
292
+ if ARGV.include?("--outdated")
293
+ message = "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement"
294
+ removed_message = "the `--outdated` flag to `bundle show` was undocumented and has been removed without replacement"
295
+ SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
307
296
  end
308
- require "bundler/cli/show"
297
+ require_relative "cli/show"
309
298
  Show.new(options, gem_name).run
310
299
  end
311
- # TODO: 2.0 remove `bundle show`
312
-
313
- if Bundler.feature_flag.list_command?
314
- desc "list", "List all gems in the bundle"
315
- method_option "name-only", :type => :boolean, :banner => "print only the gem names"
316
- method_option "only-group", :type => :string, :banner => "print gems from a particular group"
317
- method_option "without-group", :type => :string, :banner => "print all gems expect from a group"
318
- method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
319
- def list
320
- require "bundler/cli/list"
321
- List.new(options).run
322
- end
323
300
 
324
- map %w[ls] => "list"
325
- else
326
- map %w[list] => "show"
301
+ desc "list", "List all gems in the bundle"
302
+ method_option "name-only", type: :boolean, banner: "print only the gem names"
303
+ method_option "only-group", type: :array, default: [], banner: "print gems from a given set of groups"
304
+ method_option "without-group", type: :array, default: [], banner: "print all gems except from a given set of groups"
305
+ method_option "paths", type: :boolean, banner: "print the path to each gem in the bundle"
306
+ def list
307
+ require_relative "cli/list"
308
+ List.new(options).run
327
309
  end
328
310
 
311
+ map aliases_for("list")
312
+
329
313
  desc "info GEM [OPTIONS]", "Show information for the given gem"
330
- method_option "path", :type => :boolean, :banner => "Print full path to gem"
314
+ method_option "path", type: :boolean, banner: "Print full path to gem"
315
+ method_option "version", type: :boolean, banner: "Print gem version"
331
316
  def info(gem_name)
332
- require "bundler/cli/info"
317
+ require_relative "cli/info"
333
318
  Info.new(options, gem_name).run
334
319
  end
335
320
 
@@ -339,18 +324,14 @@ module Bundler
339
324
  or the --binstubs directory if one has been set. Calling binstubs with [GEM [GEM]]
340
325
  will create binstubs for all given gems.
341
326
  D
342
- method_option "force", :type => :boolean, :default => false, :banner =>
343
- "Overwrite existing binstubs if they exist"
344
- method_option "path", :type => :string, :lazy_default => "bin", :banner =>
345
- "Binstub destination directory (default bin)"
346
- method_option "shebang", :type => :string, :banner =>
347
- "Specify a different shebang executable name than the default (usually 'ruby')"
348
- method_option "standalone", :type => :boolean, :banner =>
349
- "Make binstubs that can work without the Bundler runtime"
350
- method_option "all", :type => :boolean, :banner =>
351
- "Install binstubs for all gems"
327
+ method_option "force", type: :boolean, default: false, banner: "Overwrite existing binstubs if they exist"
328
+ method_option "path", type: :string, lazy_default: "bin", banner: "Binstub destination directory (default bin)"
329
+ method_option "shebang", type: :string, banner: "Specify a different shebang executable name than the default (usually 'ruby')"
330
+ method_option "standalone", type: :boolean, banner: "Make binstubs that can work without the Bundler runtime"
331
+ method_option "all", type: :boolean, banner: "Install binstubs for all gems"
332
+ method_option "all-platforms", type: :boolean, default: false, banner: "Install binstubs for all platforms"
352
333
  def binstubs(*gems)
353
- require "bundler/cli/binstubs"
334
+ require_relative "cli/binstubs"
354
335
  Binstubs.new(options, gems).run
355
336
  end
356
337
 
@@ -358,15 +339,22 @@ module Bundler
358
339
  long_desc <<-D
359
340
  Adds the specified gem to Gemfile (if valid) and run 'bundle install' in one step.
360
341
  D
361
- method_option "version", :aliases => "-v", :type => :string
362
- method_option "group", :aliases => "-g", :type => :string
363
- method_option "source", :aliases => "-s", :type => :string
364
- method_option "skip-install", :type => :boolean, :banner =>
365
- "Adds gem to the Gemfile but does not install it"
366
- method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem"
367
- method_option "strict", :type => :boolean, :banner => "Adds strict declaration of version to gem"
342
+ method_option "version", aliases: "-v", type: :string
343
+ method_option "group", aliases: "-g", type: :string
344
+ method_option "source", aliases: "-s", type: :string
345
+ method_option "require", aliases: "-r", type: :string, banner: "Adds require path to gem. Provide false, or a path as a string."
346
+ method_option "path", type: :string
347
+ method_option "git", type: :string
348
+ method_option "github", type: :string
349
+ method_option "branch", type: :string
350
+ method_option "ref", type: :string
351
+ method_option "glob", type: :string, banner: "The location of a dependency's .gemspec, expanded within Ruby (single quotes recommended)"
352
+ method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
353
+ method_option "skip-install", type: :boolean, banner: "Adds gem to the Gemfile but does not install it"
354
+ method_option "optimistic", type: :boolean, banner: "Adds optimistic declaration of version to gem"
355
+ method_option "strict", type: :boolean, banner: "Adds strict declaration of version to gem"
368
356
  def add(*gems)
369
- require "bundler/cli/add"
357
+ require_relative "cli/add"
370
358
  Add.new(options.dup, gems).run
371
359
  end
372
360
 
@@ -378,91 +366,94 @@ module Bundler
378
366
  are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
379
367
 
380
368
  For more information on patch level options (--major, --minor, --patch,
381
- --update-strict) see documentation on the same options on the update command.
369
+ --strict) see documentation on the same options on the update command.
382
370
  D
383
- method_option "group", :type => :string, :banner => "List gems from a specific group"
384
- method_option "groups", :type => :boolean, :banner => "List gems organized by groups"
385
- method_option "local", :type => :boolean, :banner =>
386
- "Do not attempt to fetch gems remotely and use the gem cache instead"
387
- method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
388
- method_option "source", :type => :array, :banner => "Check against a specific source"
389
- method_option "strict", :type => :boolean, :banner =>
390
- "Only list newer versions allowed by your Gemfile requirements"
391
- method_option "update-strict", :type => :boolean, :banner =>
392
- "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
393
- method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version"
394
- method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)"
395
- method_option "patch", :type => :boolean, :banner => "Prefer updating only to next patch version"
396
- method_option "filter-major", :type => :boolean, :banner => "Only list major newer versions"
397
- method_option "filter-minor", :type => :boolean, :banner => "Only list minor newer versions"
398
- method_option "filter-patch", :type => :boolean, :banner => "Only list patch newer versions"
399
- method_option "parseable", :aliases => "--porcelain", :type => :boolean, :banner =>
400
- "Use minimal formatting for more parseable output"
401
- method_option "only-explicit", :type => :boolean, :banner =>
402
- "Only list gems specified in your Gemfile, not their dependencies"
371
+ method_option "group", type: :string, banner: "List gems from a specific group"
372
+ method_option "groups", type: :boolean, banner: "List gems organized by groups"
373
+ method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
374
+ method_option "pre", type: :boolean, banner: "Check for newer pre-release gems"
375
+ method_option "source", type: :array, banner: "Check against a specific source"
376
+ method_option "filter-strict", type: :boolean, aliases: "--strict", banner: "Only list newer versions allowed by your Gemfile requirements"
377
+ method_option "update-strict", type: :boolean, banner: "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
378
+ method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
379
+ method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
380
+ method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
381
+ method_option "filter-major", type: :boolean, banner: "Only list major newer versions"
382
+ method_option "filter-minor", type: :boolean, banner: "Only list minor newer versions"
383
+ method_option "filter-patch", type: :boolean, banner: "Only list patch newer versions"
384
+ method_option "parseable", aliases: "--porcelain", type: :boolean, banner: "Use minimal formatting for more parseable output"
385
+ method_option "only-explicit", type: :boolean, banner: "Only list gems specified in your Gemfile, not their dependencies"
403
386
  def outdated(*gems)
404
- require "bundler/cli/outdated"
387
+ require_relative "cli/outdated"
405
388
  Outdated.new(options, gems).run
406
389
  end
407
390
 
408
- if Bundler.feature_flag.cache_command_is_package?
409
- map %w[cache] => :package
410
- else
411
- desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true
412
- unless Bundler.feature_flag.cache_command_is_package?
413
- method_option "all", :type => :boolean,
414
- :banner => "Include all sources (including path and git)."
415
- end
416
- method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
417
- method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
418
- def cache
419
- require "bundler/cli/cache"
420
- Cache.new(options).run
421
- end
391
+ desc "fund [OPTIONS]", "Lists information about gems seeking funding assistance"
392
+ method_option "group", aliases: "-g", type: :array, banner: "Fetch funding information for a specific group"
393
+ def fund
394
+ require_relative "cli/fund"
395
+ Fund.new(options).run
422
396
  end
423
397
 
424
- desc "#{Bundler.feature_flag.cache_command_is_package? ? :cache : :package} [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
425
- unless Bundler.feature_flag.cache_command_is_package?
426
- method_option "all", :type => :boolean,
427
- :banner => "Include all sources (including path and git)."
428
- end
429
- method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
430
- method_option "cache-path", :type => :string, :banner =>
431
- "Specify a different cache path than the default (vendor/cache)."
432
- method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
433
- method_option "no-install", :type => :boolean, :banner => "Don't install the gems, only the package."
434
- method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
435
- method_option "path", :type => :string, :banner =>
436
- "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
437
- method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
438
- method_option "frozen", :type => :boolean, :banner =>
439
- "Do not allow the Gemfile.lock to be updated after this package operation's install"
398
+ desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
399
+ method_option "all", type: :boolean, default: Bundler.feature_flag.cache_all?, banner: "Include all sources (including path and git)."
400
+ method_option "all-platforms", type: :boolean, banner: "Include gems for all platforms present in the lockfile, not only the current one"
401
+ method_option "cache-path", type: :string, banner: "Specify a different cache path than the default (vendor/cache)."
402
+ method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
403
+ method_option "no-install", type: :boolean, banner: "Don't install the gems, only update the cache."
404
+ method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
405
+ method_option "path", type: :string, banner: "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
406
+ method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
407
+ method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install"
440
408
  long_desc <<-D
441
- The package command will copy the .gem files for every gem in the bundle into the
409
+ The cache command will copy the .gem files for every gem in the bundle into the
442
410
  directory ./vendor/cache. If you then check that directory into your source
443
411
  control repository, others who check out your source will be able to install the
444
412
  bundle without having to download any additional gems.
445
413
  D
446
- def package
447
- require "bundler/cli/package"
448
- Package.new(options).run
414
+ def cache
415
+ print_remembered_flag_deprecation("--all", "cache_all", "true") if ARGV.include?("--all")
416
+
417
+ if ARGV.include?("--path")
418
+ message =
419
+ "The `--path` flag is deprecated because its semantics are unclear. " \
420
+ "Use `bundle config cache_path` to configure the path of your cache of gems, " \
421
+ "and `bundle config path` to configure the path where your gems are installed, " \
422
+ "and stop using this flag"
423
+ removed_message =
424
+ "The `--path` flag has been removed because its semantics were unclear. " \
425
+ "Use `bundle config cache_path` to configure the path of your cache of gems, " \
426
+ "and `bundle config path` to configure the path where your gems are installed."
427
+ SharedHelpers.major_deprecation 2, message, removed_message: removed_message
428
+ end
429
+
430
+ require_relative "cli/cache"
431
+ Cache.new(options).run
449
432
  end
450
- map %w[pack] => :package
433
+
434
+ map aliases_for("cache")
451
435
 
452
436
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
453
- method_option :keep_file_descriptors, :type => :boolean, :default => false
454
- method_option :gemfile, :type => :string, :required => false
437
+ method_option :keep_file_descriptors, type: :boolean, default: true, banner: "Passes all file descriptors to the new processes. Default is true, and setting it to false is deprecated"
438
+ method_option :gemfile, type: :string, required: false, banner: "Use the specified gemfile instead of Gemfile"
455
439
  long_desc <<-D
456
440
  Exec runs a command, providing it access to the gems in the bundle. While using
457
441
  bundle exec you can require and call the bundled gems as if they were installed
458
442
  into the system wide RubyGems repository.
459
443
  D
460
- map "e" => "exec"
461
444
  def exec(*args)
462
- require "bundler/cli/exec"
445
+ if ARGV.include?("--no-keep-file-descriptors")
446
+ message = "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"
447
+ removed_message = "The `--no-keep-file-descriptors` has been removed. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to"
448
+ SharedHelpers.major_deprecation(2, message, removed_message: removed_message)
449
+ end
450
+
451
+ require_relative "cli/exec"
463
452
  Exec.new(options, args).run
464
453
  end
465
454
 
455
+ map aliases_for("exec")
456
+
466
457
  desc "config NAME [VALUE]", "Retrieve or set a configuration value"
467
458
  long_desc <<-D
468
459
  Retrieves or sets a configuration value. If only one parameter is provided, retrieve the value. If two parameters are provided, replace the
@@ -471,31 +462,27 @@ module Bundler
471
462
  By default, setting a configuration value sets it for all projects
472
463
  on the machine.
473
464
 
474
- If a global setting is superceded by local configuration, this command
475
- will show the current value, as well as any superceded values and
465
+ If a global setting is superseded by local configuration, this command
466
+ will show the current value, as well as any superseded values and
476
467
  where they were specified.
477
468
  D
478
- method_option "parseable", :type => :boolean, :banner => "Use minimal formatting for more parseable output"
479
- def config(*args)
480
- require "bundler/cli/config"
481
- Config.new(options, args, self).run
482
- end
469
+ require_relative "cli/config"
470
+ subcommand "config", Config
483
471
 
484
472
  desc "open GEM", "Opens the source directory of the given bundled gem"
473
+ method_option "path", type: :string, lazy_default: "", banner: "Open relative path of the gem source."
485
474
  def open(name)
486
- require "bundler/cli/open"
475
+ require_relative "cli/open"
487
476
  Open.new(options, name).run
488
477
  end
489
478
 
490
- if Bundler.feature_flag.console_command?
491
- desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
492
- def console(group = nil)
493
- require "bundler/cli/console"
494
- Console.new(options, group).run
495
- end
479
+ desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
480
+ def console(group = nil)
481
+ require_relative "cli/console"
482
+ Console.new(options, group).run
496
483
  end
497
484
 
498
- desc "version", "Prints the bundler's version information"
485
+ desc "version", "Prints Bundler version information"
499
486
  def version
500
487
  cli_help = current_command.name == "cli_help"
501
488
  if cli_help || ARGV.include?("version")
@@ -508,7 +495,8 @@ module Bundler
508
495
  Bundler.ui.info "Bundler version #{Bundler::VERSION}#{build_info}"
509
496
  end
510
497
  end
511
- map %w[-v --version] => :version
498
+
499
+ map aliases_for("version")
512
500
 
513
501
  desc "licenses", "Prints the license of all gems in the bundle"
514
502
  def licenses
@@ -524,122 +512,95 @@ module Bundler
524
512
  end
525
513
  end
526
514
 
527
- if Bundler.feature_flag.viz_command?
528
- desc "viz [OPTIONS]", "Generates a visual dependency graph", :hide => true
515
+ unless Bundler.feature_flag.bundler_3_mode?
516
+ desc "viz [OPTIONS]", "Generates a visual dependency graph", hide: true
529
517
  long_desc <<-D
530
518
  Viz generates a PNG file of the current Gemfile as a dependency graph.
531
519
  Viz requires the ruby-graphviz gem (and its dependencies).
532
520
  The associated gems must also be installed via 'bundle install'.
533
521
  D
534
- method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :desc => "The name to use for the generated file. see format option"
535
- method_option :format, :type => :string, :default => "png", :aliases => "-F", :desc => "This is output format option. Supported format is png, jpg, svg, dot ..."
536
- method_option :requirements, :type => :boolean, :default => false, :aliases => "-R", :desc => "Set to show the version of each required dependency."
537
- method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
538
- method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
522
+ method_option :file, type: :string, default: "gem_graph", aliases: "-f", desc: "The name to use for the generated file. see format option"
523
+ method_option :format, type: :string, default: "png", aliases: "-F", desc: "This is output format option. Supported format is png, jpg, svg, dot ..."
524
+ method_option :requirements, type: :boolean, default: false, aliases: "-R", desc: "Set to show the version of each required dependency."
525
+ method_option :version, type: :boolean, default: false, aliases: "-v", desc: "Set to show each gem version."
526
+ method_option :without, type: :array, default: [], aliases: "-W", banner: "GROUP[ GROUP...]", desc: "Exclude gems that are part of the specified named group."
539
527
  def viz
540
- SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
541
- require "bundler/cli/viz"
528
+ SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
529
+ require_relative "cli/viz"
542
530
  Viz.new(options.dup).run
543
531
  end
544
532
  end
545
533
 
546
- old_gem = instance_method(:gem)
547
-
548
534
  desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
549
- method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library."
550
- method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`."
551
- method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
552
- :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
553
- :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
554
- method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code"
555
- method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config gem.mit true`."
556
- method_option :test, :type => :string, :lazy_default => "rspec", :aliases => "-t", :banner => "rspec",
557
- :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config gem.test rspec`."
558
- def gem(name)
559
- end
535
+ method_option :exe, type: :boolean, default: false, aliases: ["--bin", "-b"], desc: "Generate a binary executable for your library."
536
+ method_option :coc, type: :boolean, desc: "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
537
+ method_option :edit, type: :string, aliases: "-e", required: false, banner: "EDITOR", lazy_default: [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, desc: "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
538
+ method_option :ext, type: :string, desc: "Generate the boilerplate for C extension code.", enum: EXTENSIONS
539
+ method_option :git, type: :boolean, default: true, desc: "Initialize a git repo inside your library."
540
+ method_option :mit, type: :boolean, desc: "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
541
+ 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`."
542
+ method_option :changelog, type: :boolean, desc: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
543
+ method_option :test, type: :string, lazy_default: Bundler.settings["gem.test"] || "", aliases: "-t", banner: "Use the specified test framework for your library", enum: %w[rspec minitest test-unit], 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)`."
544
+ method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "", enum: %w[github gitlab circle], desc: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
545
+ method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "", enum: %w[rubocop standard], desc: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
546
+ 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>`."
560
547
 
561
- commands["gem"].tap do |gem_command|
562
- def gem_command.run(instance, args = [])
563
- arity = 1 # name
564
-
565
- require "bundler/cli/gem"
566
- cmd_args = args + [instance]
567
- cmd_args.unshift(instance.options)
568
-
569
- cmd = begin
570
- Gem.new(*cmd_args)
571
- rescue ArgumentError => e
572
- instance.class.handle_argument_error(self, e, args, arity)
573
- end
548
+ def gem(name)
549
+ require_relative "cli/gem"
550
+ cmd_args = args + [self]
551
+ cmd_args.unshift(options)
574
552
 
575
- cmd.run
576
- end
553
+ Gem.new(*cmd_args).run
577
554
  end
578
555
 
579
- undef_method(:gem)
580
- define_method(:gem, old_gem)
581
- private :gem
582
-
583
556
  def self.source_root
584
- File.expand_path(File.join(File.dirname(__FILE__), "templates"))
557
+ File.expand_path("templates", __dir__)
585
558
  end
586
559
 
587
- desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true
588
- method_option "dry-run", :type => :boolean, :default => false, :banner =>
589
- "Only print out changes, do not clean gems"
590
- method_option "force", :type => :boolean, :default => false, :banner =>
591
- "Forces clean even if --path is not set"
560
+ desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", hide: true
561
+ method_option "dry-run", type: :boolean, default: false, banner: "Only print out changes, do not clean gems"
562
+ method_option "force", type: :boolean, default: false, banner: "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."
592
563
  def clean
593
- require "bundler/cli/clean"
564
+ require_relative "cli/clean"
594
565
  Clean.new(options.dup).run
595
566
  end
596
567
 
597
568
  desc "platform [OPTIONS]", "Displays platform compatibility information"
598
- method_option "ruby", :type => :boolean, :default => false, :banner =>
599
- "only display ruby related platform information"
569
+ method_option "ruby", type: :boolean, default: false, banner: "only display ruby related platform information"
600
570
  def platform
601
- require "bundler/cli/platform"
571
+ require_relative "cli/platform"
602
572
  Platform.new(options).run
603
573
  end
604
574
 
605
- desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", :hide => true
606
- method_option "source", :type => :string, :banner =>
607
- "Install gem from the given source"
608
- method_option "group", :type => :string, :banner =>
609
- "Install gem into a bundler group"
575
+ desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", hide: true
576
+ method_option "source", type: :string, banner: "Install gem from the given source"
577
+ method_option "group", type: :string, banner: "Install gem into a bundler group"
610
578
  def inject(name, version)
611
579
  SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
612
- require "bundler/cli/inject"
580
+ require_relative "cli/inject"
613
581
  Inject.new(options.dup, name, version).run
614
582
  end
615
583
 
616
584
  desc "lock", "Creates a lockfile without installing"
617
- method_option "update", :type => :array, :lazy_default => true, :banner =>
618
- "ignore the existing lockfile, update all gems by default, or update list of given gems"
619
- method_option "local", :type => :boolean, :default => false, :banner =>
620
- "do not attempt to fetch remote gemspecs and use the local gem cache only"
621
- method_option "print", :type => :boolean, :default => false, :banner =>
622
- "print the lockfile to STDOUT instead of writing to the file system"
623
- method_option "lockfile", :type => :string, :default => nil, :banner =>
624
- "the path the lockfile should be written to"
625
- method_option "full-index", :type => :boolean, :default => false, :banner =>
626
- "Fall back to using the single-file index of all gems"
627
- method_option "add-platform", :type => :array, :default => [], :banner =>
628
- "Add a new platform to the lockfile"
629
- method_option "remove-platform", :type => :array, :default => [], :banner =>
630
- "Remove a platform from the lockfile"
631
- method_option "patch", :type => :boolean, :banner =>
632
- "If updating, prefer updating only to next patch version"
633
- method_option "minor", :type => :boolean, :banner =>
634
- "If updating, prefer updating only to next minor version"
635
- method_option "major", :type => :boolean, :banner =>
636
- "If updating, prefer updating to next major version (default)"
637
- method_option "strict", :type => :boolean, :banner =>
638
- "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
639
- method_option "conservative", :type => :boolean, :banner =>
640
- "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
585
+ method_option "update", type: :array, lazy_default: true, banner: "ignore the existing lockfile, update all gems by default, or update list of given gems"
586
+ method_option "local", type: :boolean, default: false, banner: "do not attempt to fetch remote gemspecs and use the local gem cache only"
587
+ method_option "print", type: :boolean, default: false, banner: "print the lockfile to STDOUT instead of writing to the file system"
588
+ method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
589
+ method_option "lockfile", type: :string, default: nil, banner: "the path the lockfile should be written to"
590
+ method_option "full-index", type: :boolean, default: false, banner: "Fall back to using the single-file index of all gems"
591
+ method_option "add-checksums", type: :boolean, default: false, banner: "Adds checksums to the lockfile"
592
+ method_option "add-platform", type: :array, default: [], banner: "Add a new platform to the lockfile"
593
+ method_option "remove-platform", type: :array, default: [], banner: "Remove a platform from the lockfile"
594
+ method_option "normalize-platforms", type: :boolean, default: false, banner: "Normalize lockfile platforms"
595
+ method_option "patch", type: :boolean, banner: "If updating, prefer updating only to next patch version"
596
+ method_option "minor", type: :boolean, banner: "If updating, prefer updating only to next minor version"
597
+ method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)"
598
+ method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status"
599
+ method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
600
+ method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
601
+ method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
641
602
  def lock
642
- require "bundler/cli/lock"
603
+ require_relative "cli/lock"
643
604
  Lock.new(options).run
644
605
  end
645
606
 
@@ -654,18 +615,16 @@ module Bundler
654
615
  missing dependencies are detected, Bundler prints them and exits status 1.
655
616
  Otherwise, Bundler prints a success message and exits with a status of 0.
656
617
  D
657
- method_option "gemfile", :type => :string, :banner =>
658
- "Use the specified gemfile instead of Gemfile"
659
- method_option "quiet", :type => :boolean, :banner =>
660
- "Only output warnings and errors."
618
+ method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
619
+ method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
661
620
  def doctor
662
- require "bundler/cli/doctor"
621
+ require_relative "cli/doctor"
663
622
  Doctor.new(options).run
664
623
  end
665
624
 
666
625
  desc "issue", "Learn how to report an issue in Bundler"
667
626
  def issue
668
- require "bundler/cli/issue"
627
+ require_relative "cli/issue"
669
628
  Issue.new.run
670
629
  end
671
630
 
@@ -676,12 +635,14 @@ module Bundler
676
635
  checkout --force`.
677
636
  D
678
637
  def pristine(*gems)
679
- require "bundler/cli/pristine"
680
- Pristine.new(gems).run
638
+ require_relative "cli/pristine"
639
+ Bundler.settings.temporary(no_install: false) do
640
+ Pristine.new(gems).run
641
+ end
681
642
  end
682
643
 
683
644
  if Bundler.feature_flag.plugins?
684
- require "bundler/cli/plugin"
645
+ require_relative "cli/plugin"
685
646
  desc "plugin", "Manage the bundler plugins"
686
647
  subcommand "plugin", Plugin
687
648
  end
@@ -689,12 +650,16 @@ module Bundler
689
650
  # Reformat the arguments passed to bundle that include a --help flag
690
651
  # into the corresponding `bundle help #{command}` call
691
652
  def self.reformatted_help_args(args)
692
- bundler_commands = all_commands.keys
653
+ bundler_commands = (COMMAND_ALIASES.keys + COMMAND_ALIASES.values).flatten
654
+
693
655
  help_flags = %w[--help -h]
694
- exec_commands = %w[e ex exe exec]
656
+ exec_commands = ["exec"] + COMMAND_ALIASES["exec"]
657
+
695
658
  help_used = args.index {|a| help_flags.include? a }
696
659
  exec_used = args.index {|a| exec_commands.include? a }
660
+
697
661
  command = args.find {|a| bundler_commands.include? a }
662
+
698
663
  if exec_used && help_used
699
664
  if exec_used + help_used == 1
700
665
  %w[help exec]
@@ -710,28 +675,42 @@ module Bundler
710
675
  end
711
676
  end
712
677
 
713
- private
714
-
715
- # Automatically invoke `bundle install` and resume if
716
- # Bundler.settings[:auto_install] exists. This is set through config cmd
717
- # `bundle config auto_install 1`.
718
- #
719
- # Note that this method `nil`s out the global Definition object, so it
720
- # should be called first, before you instantiate anything like an
721
- # `Installer` that'll keep a reference to the old one instead.
722
- def auto_install
723
- return unless Bundler.settings[:auto_install]
724
-
725
- begin
726
- Bundler.definition.specs
727
- rescue GemNotFound
728
- Bundler.ui.info "Automatically installing missing gems."
729
- Bundler.reset!
730
- invoke :install, []
731
- Bundler.reset!
678
+ def self.check_deprecated_ext_option(arguments)
679
+ # when deprecated version of `--ext` is called
680
+ # print out deprecation warning and pretend `--ext=c` was provided
681
+ if deprecated_ext_value?(arguments)
682
+ message = "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."
683
+ removed_message = "Extensions can now be generated using C or Rust, so `--ext` with no arguments has been removed. Please select a language, e.g. `--ext=rust` to generate a Rust extension."
684
+ SharedHelpers.major_deprecation 2, message, removed_message: removed_message
685
+ arguments[arguments.index("--ext")] = "--ext=c"
732
686
  end
733
687
  end
734
688
 
689
+ def self.deprecated_ext_value?(arguments)
690
+ index = arguments.index("--ext")
691
+ next_argument = arguments[index + 1]
692
+
693
+ # it is ok when --ext is followed with valid extension value
694
+ # for example `bundle gem hello --ext c`
695
+ return false if EXTENSIONS.include?(next_argument)
696
+
697
+ # deprecated call when --ext is called with no value in last position
698
+ # for example `bundle gem hello_gem --ext`
699
+ return true if next_argument.nil?
700
+
701
+ # deprecated call when --ext is followed by other parameter
702
+ # for example `bundle gem --ext --no-ci hello_gem`
703
+ return true if next_argument.start_with?("-")
704
+
705
+ # deprecated call when --ext is followed by gem name
706
+ # for example `bundle gem --ext hello_gem`
707
+ return true if next_argument
708
+
709
+ false
710
+ end
711
+
712
+ private
713
+
735
714
  def current_command
736
715
  _, _, config = @_initializer
737
716
  config[:current_command]
@@ -761,30 +740,60 @@ module Bundler
761
740
 
762
741
  return unless SharedHelpers.md5_available?
763
742
 
764
- latest = Fetcher::CompactIndex.
765
- new(nil, Source::Rubygems::Remote.new(URI("https://rubygems.org")), nil).
766
- send(:compact_index_client).
767
- instance_variable_get(:@cache).
768
- dependencies("bundler").
769
- map {|d| Gem::Version.new(d.first) }.
770
- max
743
+ require_relative "vendored_uri"
744
+ remote = Source::Rubygems::Remote.new(Gem::URI("https://rubygems.org"))
745
+ cache_path = Bundler.user_cache.join("compact_index", remote.cache_slug)
746
+ latest = Bundler::CompactIndexClient.new(cache_path).latest_version("bundler")
771
747
  return unless latest
772
748
 
773
749
  current = Gem::Version.new(VERSION)
774
750
  return if current >= latest
775
- latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max
776
-
777
- installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
778
- if latest_installed && latest_installed > current
779
- suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
780
- suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
781
- else
782
- suggestion = installation
783
- end
784
751
 
785
- Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
752
+ Bundler.ui.warn \
753
+ "The latest bundler is #{latest}, but you are currently running #{current}.\n" \
754
+ "To update to the most recent version, run `bundle update --bundler`"
786
755
  rescue RuntimeError
787
756
  nil
788
757
  end
758
+
759
+ def remembered_negative_flag_deprecation(name)
760
+ positive_name = name.gsub(/\Ano-/, "")
761
+ option = current_command.options[positive_name]
762
+ flag_name = "--no-" + option.switch_name.gsub(/\A--/, "")
763
+
764
+ flag_deprecation(positive_name, flag_name, option)
765
+ end
766
+
767
+ def remembered_flag_deprecation(name)
768
+ option = current_command.options[name]
769
+ flag_name = option.switch_name
770
+
771
+ flag_deprecation(name, flag_name, option)
772
+ end
773
+
774
+ def flag_deprecation(name, flag_name, option)
775
+ name_index = ARGV.find {|arg| flag_name == arg.split("=")[0] }
776
+ return unless name_index
777
+
778
+ value = options[name]
779
+ value = value.join(" ").to_s if option.type == :array
780
+ value = "'#{value}'" unless option.type == :boolean
781
+
782
+ print_remembered_flag_deprecation(flag_name, name.tr("-", "_"), value)
783
+ end
784
+
785
+ def print_remembered_flag_deprecation(flag_name, option_name, option_value)
786
+ message =
787
+ "The `#{flag_name}` flag is deprecated because it relies on being " \
788
+ "remembered across bundler invocations, which bundler will no longer " \
789
+ "do in future versions. Instead please use `bundle config set #{option_name} " \
790
+ "#{option_value}`, and stop using this flag"
791
+ removed_message =
792
+ "The `#{flag_name}` flag has been removed because it relied on being " \
793
+ "remembered across bundler invocations, which bundler will no longer " \
794
+ "do. Instead please use `bundle config set #{option_name} " \
795
+ "#{option_value}`, and stop using this flag"
796
+ Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
797
+ end
789
798
  end
790
799
  end