bundler 1.17.2 → 2.2.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (322) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2095 -1251
  3. data/LICENSE.md +18 -19
  4. data/README.md +10 -11
  5. data/bundler.gemspec +10 -28
  6. data/exe/bundle +22 -3
  7. data/lib/bundler/build_metadata.rb +4 -12
  8. data/lib/bundler/capistrano.rb +4 -4
  9. data/lib/bundler/cli/add.rb +28 -16
  10. data/lib/bundler/cli/binstubs.rb +6 -2
  11. data/lib/bundler/cli/cache.rb +24 -17
  12. data/lib/bundler/cli/check.rb +4 -2
  13. data/lib/bundler/cli/clean.rb +1 -1
  14. data/lib/bundler/cli/common.rb +39 -13
  15. data/lib/bundler/cli/config.rb +161 -86
  16. data/lib/bundler/cli/console.rb +1 -1
  17. data/lib/bundler/cli/doctor.rb +20 -9
  18. data/lib/bundler/cli/exec.rb +8 -25
  19. data/lib/bundler/cli/fund.rb +36 -0
  20. data/lib/bundler/cli/gem.rb +213 -32
  21. data/lib/bundler/cli/info.rb +42 -7
  22. data/lib/bundler/cli/init.rb +2 -2
  23. data/lib/bundler/cli/inject.rb +1 -1
  24. data/lib/bundler/cli/install.rb +34 -44
  25. data/lib/bundler/cli/issue.rb +8 -7
  26. data/lib/bundler/cli/list.rb +19 -11
  27. data/lib/bundler/cli/lock.rb +5 -1
  28. data/lib/bundler/cli/open.rb +11 -8
  29. data/lib/bundler/cli/outdated.rb +142 -118
  30. data/lib/bundler/cli/plugin.rb +19 -2
  31. data/lib/bundler/cli/pristine.rb +6 -1
  32. data/lib/bundler/cli/remove.rb +1 -2
  33. data/lib/bundler/cli/show.rb +2 -2
  34. data/lib/bundler/cli/update.rb +43 -16
  35. data/lib/bundler/cli.rb +211 -150
  36. data/lib/bundler/compact_index_client/cache.rb +6 -14
  37. data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  38. data/lib/bundler/compact_index_client/updater.rb +15 -28
  39. data/lib/bundler/compact_index_client.rb +28 -12
  40. data/lib/bundler/current_ruby.rb +14 -11
  41. data/lib/bundler/definition.rb +207 -368
  42. data/lib/bundler/dep_proxy.rb +16 -9
  43. data/lib/bundler/dependency.rb +19 -14
  44. data/lib/bundler/deployment.rb +1 -1
  45. data/lib/bundler/digest.rb +71 -0
  46. data/lib/bundler/dsl.rb +81 -81
  47. data/lib/bundler/endpoint_specification.rb +1 -1
  48. data/lib/bundler/env.rb +9 -14
  49. data/lib/bundler/environment_preserver.rb +29 -3
  50. data/lib/bundler/errors.rb +20 -3
  51. data/lib/bundler/feature_flag.rb +14 -33
  52. data/lib/bundler/fetcher/base.rb +1 -1
  53. data/lib/bundler/fetcher/compact_index.rb +28 -14
  54. data/lib/bundler/fetcher/dependency.rb +1 -1
  55. data/lib/bundler/fetcher/downloader.rb +14 -8
  56. data/lib/bundler/fetcher/index.rb +8 -8
  57. data/lib/bundler/fetcher.rb +22 -17
  58. data/lib/bundler/friendly_errors.rb +29 -48
  59. data/lib/bundler/gem_helper.rb +79 -43
  60. data/lib/bundler/gem_helpers.rb +38 -29
  61. data/lib/bundler/gem_tasks.rb +1 -1
  62. data/lib/bundler/gem_version_promoter.rb +5 -5
  63. data/lib/bundler/graph.rb +3 -3
  64. data/lib/bundler/index.rb +9 -9
  65. data/lib/bundler/injector.rb +33 -13
  66. data/lib/bundler/inline.rb +41 -30
  67. data/lib/bundler/installer/gem_installer.rb +9 -18
  68. data/lib/bundler/installer/parallel_installer.rb +50 -33
  69. data/lib/bundler/installer/standalone.rb +30 -11
  70. data/lib/bundler/installer.rb +39 -66
  71. data/lib/bundler/lazy_specification.rb +63 -28
  72. data/lib/bundler/lockfile_generator.rb +1 -1
  73. data/lib/bundler/lockfile_parser.rb +19 -52
  74. data/lib/bundler/{ssl_certs → man}/.document +0 -0
  75. data/{man → lib/bundler/man}/bundle-add.1 +10 -2
  76. data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
  77. data/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
  78. data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
  79. data/lib/bundler/man/bundle-cache.1 +55 -0
  80. data/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
  81. data/{man → lib/bundler/man}/bundle-check.1 +1 -1
  82. data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  83. data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
  84. data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
  85. data/{man → lib/bundler/man}/bundle-config.1 +59 -60
  86. data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +77 -78
  87. data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  88. data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  89. data/{man → lib/bundler/man}/bundle-exec.1 +2 -2
  90. data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
  91. data/{man → lib/bundler/man}/bundle-gem.1 +38 -3
  92. data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
  93. data/{man → lib/bundler/man}/bundle-info.1 +1 -1
  94. data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  95. data/{man → lib/bundler/man}/bundle-init.1 +2 -2
  96. data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
  97. data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
  98. data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
  99. data/{man → lib/bundler/man}/bundle-install.1 +37 -7
  100. data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
  101. data/{man → lib/bundler/man}/bundle-list.1 +7 -7
  102. data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  103. data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  104. data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  105. data/{man → lib/bundler/man}/bundle-open.1 +1 -1
  106. data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
  107. data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
  108. data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
  109. data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
  110. data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
  111. data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  112. data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  113. data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  114. data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  115. data/{man → lib/bundler/man}/bundle-show.1 +1 -1
  116. data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
  117. data/{man → lib/bundler/man}/bundle-update.1 +7 -7
  118. data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +6 -6
  119. data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
  120. data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
  121. data/{man → lib/bundler/man}/bundle.1 +7 -3
  122. data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +5 -2
  123. data/{man → lib/bundler/man}/gemfile.5 +44 -21
  124. data/{man → lib/bundler/man}/gemfile.5.ronn +24 -20
  125. data/{man → lib/bundler/man}/index.txt +1 -1
  126. data/lib/bundler/match_platform.rb +1 -1
  127. data/lib/bundler/mirror.rb +5 -5
  128. data/lib/bundler/plugin/api/source.rb +27 -7
  129. data/lib/bundler/plugin/api.rb +1 -1
  130. data/lib/bundler/plugin/dsl.rb +1 -1
  131. data/lib/bundler/plugin/index.rb +27 -4
  132. data/lib/bundler/plugin/installer/rubygems.rb +1 -1
  133. data/lib/bundler/plugin/installer.rb +35 -22
  134. data/lib/bundler/plugin/source_list.rb +5 -1
  135. data/lib/bundler/plugin.rb +100 -42
  136. data/lib/bundler/psyched_yaml.rb +0 -15
  137. data/lib/bundler/remote_specification.rb +5 -4
  138. data/lib/bundler/resolver/spec_group.rb +57 -53
  139. data/lib/bundler/resolver.rb +127 -113
  140. data/lib/bundler/retry.rb +4 -4
  141. data/lib/bundler/ruby_version.rb +5 -20
  142. data/lib/bundler/rubygems_ext.rb +103 -79
  143. data/lib/bundler/rubygems_gem_installer.rb +69 -8
  144. data/lib/bundler/rubygems_integration.rb +181 -446
  145. data/lib/bundler/runtime.rb +24 -34
  146. data/lib/bundler/settings.rb +159 -110
  147. data/lib/bundler/setup.rb +11 -12
  148. data/lib/bundler/shared_helpers.rb +56 -90
  149. data/lib/bundler/similarity_detector.rb +3 -3
  150. data/lib/bundler/source/git/git_proxy.rb +106 -105
  151. data/lib/bundler/source/git.rb +66 -39
  152. data/lib/bundler/source/metadata.rb +9 -9
  153. data/lib/bundler/source/path/installer.rb +10 -10
  154. data/lib/bundler/source/path.rb +23 -12
  155. data/lib/bundler/source/rubygems/remote.rb +3 -4
  156. data/lib/bundler/source/rubygems.rb +136 -120
  157. data/lib/bundler/source/rubygems_aggregate.rb +68 -0
  158. data/lib/bundler/source.rb +27 -6
  159. data/lib/bundler/source_list.rb +101 -66
  160. data/lib/bundler/source_map.rb +58 -0
  161. data/lib/bundler/spec_set.rb +49 -53
  162. data/lib/bundler/stub_specification.rb +40 -34
  163. data/lib/bundler/templates/Executable.bundler +24 -15
  164. data/lib/bundler/templates/Gemfile +1 -1
  165. data/lib/bundler/templates/gems.rb +1 -1
  166. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  167. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  168. data/lib/bundler/templates/newgem/Gemfile.tt +19 -2
  169. data/lib/bundler/templates/newgem/README.md.tt +7 -5
  170. data/lib/bundler/templates/newgem/Rakefile.tt +23 -5
  171. data/lib/bundler/templates/newgem/bin/console.tt +1 -0
  172. data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
  173. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
  174. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +27 -0
  175. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  176. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  177. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  178. data/lib/bundler/templates/newgem/newgem.gemspec.tt +29 -40
  179. data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  180. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  181. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  182. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  183. data/lib/bundler/templates/newgem/standard.yml.tt +2 -0
  184. data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
  185. data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
  186. data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  187. data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  188. data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
  189. data/lib/bundler/ui/rg_proxy.rb +1 -1
  190. data/lib/bundler/ui/shell.rb +7 -11
  191. data/lib/bundler/ui.rb +3 -3
  192. data/lib/bundler/uri_credentials_filter.rb +10 -4
  193. data/lib/bundler/vendor/.document +1 -0
  194. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  195. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
  196. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
  197. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  198. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +126 -0
  199. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  200. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
  201. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  202. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  203. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  204. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  205. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  206. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  207. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
  208. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  209. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
  210. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
  211. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +38 -6
  212. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
  213. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  214. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
  215. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
  216. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
  217. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
  218. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  219. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
  220. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
  221. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
  222. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
  223. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  224. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
  225. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
  226. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
  227. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +20 -9
  228. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
  229. data/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
  230. data/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
  231. data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
  232. data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
  233. data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
  234. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
  235. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
  236. data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
  237. data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
  238. data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
  239. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
  240. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
  241. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +21 -5
  242. data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
  243. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
  244. data/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
  245. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +65 -8
  246. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
  247. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
  248. data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
  249. data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
  250. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  251. data/lib/bundler/vendor/thor/lib/thor.rb +16 -9
  252. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
  253. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  254. data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
  255. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  256. data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
  257. data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
  258. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
  259. data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
  260. data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
  261. data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
  262. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
  263. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
  264. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
  265. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  266. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
  267. data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
  268. data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
  269. data/lib/bundler/vendored_fileutils.rb +1 -6
  270. data/lib/bundler/vendored_molinillo.rb +1 -1
  271. data/lib/bundler/vendored_persistent.rb +7 -12
  272. data/lib/bundler/vendored_thor.rb +2 -2
  273. data/lib/bundler/vendored_tmpdir.rb +4 -0
  274. data/lib/bundler/vendored_tsort.rb +4 -0
  275. data/lib/bundler/vendored_uri.rb +4 -0
  276. data/lib/bundler/version.rb +1 -20
  277. data/lib/bundler/version_ranges.rb +51 -5
  278. data/lib/bundler/vlad.rb +2 -2
  279. data/lib/bundler/worker.rb +21 -8
  280. data/lib/bundler/yaml_serializer.rb +3 -4
  281. data/lib/bundler.rb +248 -118
  282. metadata +115 -190
  283. data/exe/bundle_ruby +0 -60
  284. data/lib/bundler/cli/package.rb +0 -49
  285. data/lib/bundler/compatibility_guard.rb +0 -14
  286. data/lib/bundler/gem_remote_fetcher.rb +0 -43
  287. data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
  288. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
  289. data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  290. data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
  291. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
  292. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  293. data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
  294. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
  295. data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
  296. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
  297. data/man/bundle-add.1.txt +0 -52
  298. data/man/bundle-binstubs.1.txt +0 -48
  299. data/man/bundle-check.1.txt +0 -33
  300. data/man/bundle-clean.1.txt +0 -26
  301. data/man/bundle-config.1.txt +0 -529
  302. data/man/bundle-doctor.1.txt +0 -44
  303. data/man/bundle-exec.1.txt +0 -178
  304. data/man/bundle-gem.1.txt +0 -91
  305. data/man/bundle-info.1.txt +0 -21
  306. data/man/bundle-init.1.txt +0 -34
  307. data/man/bundle-inject.1.txt +0 -32
  308. data/man/bundle-install.1.txt +0 -396
  309. data/man/bundle-list.1.txt +0 -43
  310. data/man/bundle-lock.1.txt +0 -93
  311. data/man/bundle-open.1.txt +0 -29
  312. data/man/bundle-outdated.1.txt +0 -131
  313. data/man/bundle-package.1 +0 -55
  314. data/man/bundle-package.1.txt +0 -79
  315. data/man/bundle-platform.1.txt +0 -57
  316. data/man/bundle-pristine.1.txt +0 -44
  317. data/man/bundle-remove.1.txt +0 -34
  318. data/man/bundle-show.1.txt +0 -27
  319. data/man/bundle-update.1.txt +0 -391
  320. data/man/bundle-viz.1.txt +0 -39
  321. data/man/bundle.1.txt +0 -113
  322. data/man/gemfile.5.txt +0 -653
data/lib/bundler/cli.rb CHANGED
@@ -1,24 +1,28 @@
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"
9
8
 
10
9
  package_name "Bundler"
11
10
 
12
11
  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
12
+ PARSEABLE_COMMANDS = %w[check config help exec platform show version].freeze
13
+
14
+ COMMAND_ALIASES = {
15
+ "check" => "c",
16
+ "install" => "i",
17
+ "plugin" => "",
18
+ "list" => "ls",
19
+ "exec" => ["e", "ex", "exe"],
20
+ "cache" => ["package", "pack"],
21
+ "version" => ["-v", "--version"],
22
+ }.freeze
16
23
 
17
24
  def self.start(*)
18
25
  super
19
- rescue Exception => e
20
- Bundler.ui = UI::Shell.new
21
- raise e
22
26
  ensure
23
27
  Bundler::SharedHelpers.print_major_deprecations!
24
28
  end
@@ -30,13 +34,31 @@ module Bundler
30
34
  end
31
35
  end
32
36
 
37
+ def self.all_aliases
38
+ @all_aliases ||= begin
39
+ command_aliases = {}
40
+
41
+ COMMAND_ALIASES.each do |name, aliases|
42
+ Array(aliases).each do |one_alias|
43
+ command_aliases[one_alias] = name
44
+ end
45
+ end
46
+
47
+ command_aliases
48
+ end
49
+ end
50
+
51
+ def self.aliases_for(command_name)
52
+ COMMAND_ALIASES.select {|k, _| k == command_name }.invert
53
+ end
54
+
33
55
  def initialize(*args)
34
56
  super
35
57
 
36
58
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
37
59
  if custom_gemfile && !custom_gemfile.empty?
38
60
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
39
- Bundler.reset_paths!
61
+ Bundler.reset_settings_and_root!
40
62
  end
41
63
 
42
64
  Bundler.settings.set_command_option_if_given :retry, options[:retry]
@@ -51,19 +73,6 @@ module Bundler
51
73
  Bundler.ui = UI::Shell.new(options)
52
74
  Bundler.ui.level = "debug" if options["verbose"]
53
75
  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
- end
63
-
64
- def self.deprecated_option(*args, &blk)
65
- return if Bundler.feature_flag.forget_cli_options?
66
- method_option(*args, &blk)
67
76
  end
68
77
 
69
78
  check_unknown_options!(:except => [:config, :exec])
@@ -74,9 +83,7 @@ module Bundler
74
83
  version
75
84
  Bundler.ui.info "\n"
76
85
 
77
- primary_commands = ["install", "update",
78
- Bundler.feature_flag.cache_command_is_package? ? "cache" : "package",
79
- "exec", "config", "help"]
86
+ primary_commands = ["install", "update", "cache", "exec", "config", "help"]
80
87
 
81
88
  list = self.class.printable_commands(true)
82
89
  by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] }
@@ -108,16 +115,17 @@ module Bundler
108
115
  else command = "bundle-#{cli}"
109
116
  end
110
117
 
111
- man_path = File.expand_path("../../../man", __FILE__)
112
- man_pages = Hash[Dir.glob(File.join(man_path, "*")).grep(/.*\.\d*\Z/).collect do |f|
118
+ man_path = File.expand_path("man", __dir__)
119
+ man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
113
120
  [File.basename(f, ".*"), f]
114
121
  end]
115
122
 
116
123
  if man_pages.include?(command)
124
+ man_page = man_pages[command]
117
125
  if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
118
- Kernel.exec "man #{man_pages[command]}"
126
+ Kernel.exec "man #{man_page}"
119
127
  else
120
- puts File.read("#{man_path}/#{File.basename(man_pages[command])}.txt")
128
+ puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
121
129
  end
122
130
  elsif command_path = Bundler.which("bundler-#{cli}")
123
131
  Kernel.exec(command_path, "--help")
@@ -142,9 +150,9 @@ module Bundler
142
150
  Gemfile to a gem with a gemspec, the --gemspec option will automatically add each
143
151
  dependency listed in the gemspec file to the newly created Gemfile.
144
152
  D
145
- deprecated_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
153
+ method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
146
154
  def init
147
- require "bundler/cli/init"
155
+ require_relative "cli/init"
148
156
  Init.new(options.dup).run
149
157
  end
150
158
 
@@ -160,12 +168,15 @@ module Bundler
160
168
  "Use the specified gemfile instead of Gemfile"
161
169
  method_option "path", :type => :string, :banner =>
162
170
  "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"
164
171
  def check
165
- require "bundler/cli/check"
172
+ remembered_flag_deprecation("path")
173
+
174
+ require_relative "cli/check"
166
175
  Check.new(options).run
167
176
  end
168
177
 
178
+ map aliases_for("check")
179
+
169
180
  desc "remove [GEM [GEM ...]]", "Removes gems from the Gemfile"
170
181
  long_desc <<-D
171
182
  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.
@@ -173,7 +184,8 @@ module Bundler
173
184
  method_option "install", :type => :boolean, :banner =>
174
185
  "Runs 'bundle install' after removing the gems from the Gemfile"
175
186
  def remove(*gems)
176
- require "bundler/cli/remove"
187
+ SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install")
188
+ require_relative "cli/remove"
177
189
  Remove.new(gems, options).run
178
190
  end
179
191
 
@@ -188,13 +200,13 @@ module Bundler
188
200
 
189
201
  If the bundle has already been installed, bundler will tell you so and then exit.
190
202
  D
191
- deprecated_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
203
+ method_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
192
204
  "Generate bin stubs for bundled gems to ./bin"
193
- deprecated_option "clean", :type => :boolean, :banner =>
205
+ method_option "clean", :type => :boolean, :banner =>
194
206
  "Run bundle clean automatically after install"
195
- deprecated_option "deployment", :type => :boolean, :banner =>
207
+ method_option "deployment", :type => :boolean, :banner =>
196
208
  "Install using defaults tuned for deployment environments"
197
- deprecated_option "frozen", :type => :boolean, :banner =>
209
+ method_option "frozen", :type => :boolean, :banner =>
198
210
  "Do not allow the Gemfile.lock to be updated after this install"
199
211
  method_option "full-index", :type => :boolean, :banner =>
200
212
  "Fall back to using the single-file index of all gems"
@@ -204,38 +216,46 @@ module Bundler
204
216
  "Specify the number of jobs to run in parallel"
205
217
  method_option "local", :type => :boolean, :banner =>
206
218
  "Do not attempt to fetch gems remotely and use the gem cache instead"
207
- deprecated_option "no-cache", :type => :boolean, :banner =>
219
+ method_option "no-cache", :type => :boolean, :banner =>
208
220
  "Don't update the existing gem cache."
209
221
  method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
210
222
  "Force downloading every gem."
211
- deprecated_option "no-prune", :type => :boolean, :banner =>
223
+ method_option "no-prune", :type => :boolean, :banner =>
212
224
  "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"
225
+ method_option "path", :type => :string, :banner =>
226
+ "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?}"
215
227
  method_option "quiet", :type => :boolean, :banner =>
216
228
  "Only output warnings and errors."
217
- deprecated_option "shebang", :type => :string, :banner =>
229
+ method_option "shebang", :type => :string, :banner =>
218
230
  "Specify a different shebang executable name than the default (usually 'ruby')"
219
231
  method_option "standalone", :type => :array, :lazy_default => [], :banner =>
220
232
  "Make a bundle that can work without the Bundler runtime"
221
- deprecated_option "system", :type => :boolean, :banner =>
233
+ method_option "system", :type => :boolean, :banner =>
222
234
  "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
223
235
  method_option "trust-policy", :alias => "P", :type => :string, :banner =>
224
236
  "Gem trust policy (like gem install -P). Must be one of " +
225
237
  Bundler.rubygems.security_policy_keys.join("|")
226
- deprecated_option "without", :type => :array, :banner =>
238
+ method_option "without", :type => :array, :banner =>
227
239
  "Exclude gems that are part of the specified named group."
228
- deprecated_option "with", :type => :array, :banner =>
240
+ method_option "with", :type => :array, :banner =>
229
241
  "Include gems that are part of the specified named group."
230
- map "i" => "install"
231
242
  def install
232
243
  SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
233
- require "bundler/cli/install"
244
+
245
+ %w[clean deployment frozen no-prune path shebang system without with].each do |option|
246
+ remembered_flag_deprecation(option)
247
+ end
248
+
249
+ remembered_negative_flag_deprecation("no-deployment")
250
+
251
+ require_relative "cli/install"
234
252
  Bundler.settings.temporary(:no_install => false) do
235
253
  Install.new(options.dup).run
236
254
  end
237
255
  end
238
256
 
257
+ map aliases_for("install")
258
+
239
259
  desc "update [OPTIONS]", "Update the current environment"
240
260
  long_desc <<-D
241
261
  Update will install the newest versions of the gems listed in the Gemfile. Use
@@ -276,8 +296,10 @@ module Bundler
276
296
  "Update everything."
277
297
  def update(*gems)
278
298
  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
299
+ require_relative "cli/update"
300
+ Bundler.settings.temporary(:no_install => false) do
301
+ Update.new(options, gems).run
302
+ end
281
303
  end
282
304
 
283
305
  desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
@@ -290,46 +312,28 @@ module Bundler
290
312
  method_option "outdated", :type => :boolean,
291
313
  :banner => "Show verbose output including whether gems are outdated."
292
314
  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}`")
307
- end
308
- require "bundler/cli/show"
315
+ SharedHelpers.major_deprecation(2, "the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement") if ARGV.include?("--outdated")
316
+ require_relative "cli/show"
309
317
  Show.new(options, gem_name).run
310
318
  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
319
 
324
- map %w[ls] => "list"
325
- else
326
- map %w[list] => "show"
320
+ desc "list", "List all gems in the bundle"
321
+ method_option "name-only", :type => :boolean, :banner => "print only the gem names"
322
+ method_option "only-group", :type => :array, :default => [], :banner => "print gems from a given set of groups"
323
+ method_option "without-group", :type => :array, :default => [], :banner => "print all gems except from a given set of groups"
324
+ method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
325
+ def list
326
+ require_relative "cli/list"
327
+ List.new(options).run
327
328
  end
328
329
 
330
+ map aliases_for("list")
331
+
329
332
  desc "info GEM [OPTIONS]", "Show information for the given gem"
330
333
  method_option "path", :type => :boolean, :banner => "Print full path to gem"
334
+ method_option "version", :type => :boolean, :banner => "Print gem version"
331
335
  def info(gem_name)
332
- require "bundler/cli/info"
336
+ require_relative "cli/info"
333
337
  Info.new(options, gem_name).run
334
338
  end
335
339
 
@@ -349,8 +353,10 @@ module Bundler
349
353
  "Make binstubs that can work without the Bundler runtime"
350
354
  method_option "all", :type => :boolean, :banner =>
351
355
  "Install binstubs for all gems"
356
+ method_option "all-platforms", :type => :boolean, :default => false, :banner =>
357
+ "Install binstubs for all platforms"
352
358
  def binstubs(*gems)
353
- require "bundler/cli/binstubs"
359
+ require_relative "cli/binstubs"
354
360
  Binstubs.new(options, gems).run
355
361
  end
356
362
 
@@ -361,12 +367,14 @@ module Bundler
361
367
  method_option "version", :aliases => "-v", :type => :string
362
368
  method_option "group", :aliases => "-g", :type => :string
363
369
  method_option "source", :aliases => "-s", :type => :string
370
+ method_option "git", :type => :string
371
+ method_option "branch", :type => :string
364
372
  method_option "skip-install", :type => :boolean, :banner =>
365
373
  "Adds gem to the Gemfile but does not install it"
366
374
  method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem"
367
375
  method_option "strict", :type => :boolean, :banner => "Adds strict declaration of version to gem"
368
376
  def add(*gems)
369
- require "bundler/cli/add"
377
+ require_relative "cli/add"
370
378
  Add.new(options.dup, gems).run
371
379
  end
372
380
 
@@ -386,9 +394,10 @@ module Bundler
386
394
  "Do not attempt to fetch gems remotely and use the gem cache instead"
387
395
  method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
388
396
  method_option "source", :type => :array, :banner => "Check against a specific source"
389
- method_option "strict", :type => :boolean, :banner =>
397
+ strict_is_update = Bundler.feature_flag.forget_cli_options?
398
+ method_option "filter-strict", :type => :boolean, :aliases => strict_is_update ? [] : %w[--strict], :banner =>
390
399
  "Only list newer versions allowed by your Gemfile requirements"
391
- method_option "update-strict", :type => :boolean, :banner =>
400
+ method_option "update-strict", :type => :boolean, :aliases => strict_is_update ? %w[--strict] : [], :banner =>
392
401
  "Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
393
402
  method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version"
394
403
  method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)"
@@ -401,68 +410,77 @@ module Bundler
401
410
  method_option "only-explicit", :type => :boolean, :banner =>
402
411
  "Only list gems specified in your Gemfile, not their dependencies"
403
412
  def outdated(*gems)
404
- require "bundler/cli/outdated"
413
+ require_relative "cli/outdated"
405
414
  Outdated.new(options, gems).run
406
415
  end
407
416
 
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
417
+ desc "fund [OPTIONS]", "Lists information about gems seeking funding assistance"
418
+ method_option "group", :aliases => "-g", :type => :array, :banner =>
419
+ "Fetch funding information for a specific group"
420
+ def fund
421
+ require_relative "cli/fund"
422
+ Fund.new(options).run
422
423
  end
423
424
 
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
425
+ desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
426
+ method_option "all", :type => :boolean,
427
+ :default => Bundler.feature_flag.cache_all?,
428
+ :banner => "Include all sources (including path and git)."
429
429
  method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
430
430
  method_option "cache-path", :type => :string, :banner =>
431
431
  "Specify a different cache path than the default (vendor/cache)."
432
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."
433
+ method_option "no-install", :type => :boolean, :banner => "Don't install the gems, only update the cache."
434
434
  method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
435
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"
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" unless Bundler.feature_flag.forget_cli_options?}"
437
437
  method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
438
438
  method_option "frozen", :type => :boolean, :banner =>
439
- "Do not allow the Gemfile.lock to be updated after this package operation's install"
439
+ "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install"
440
440
  long_desc <<-D
441
- The package command will copy the .gem files for every gem in the bundle into the
441
+ The cache command will copy the .gem files for every gem in the bundle into the
442
442
  directory ./vendor/cache. If you then check that directory into your source
443
443
  control repository, others who check out your source will be able to install the
444
444
  bundle without having to download any additional gems.
445
445
  D
446
- def package
447
- require "bundler/cli/package"
448
- Package.new(options).run
446
+ def cache
447
+ SharedHelpers.major_deprecation 2,
448
+ "The `--all` flag is deprecated because it relies on being " \
449
+ "remembered across bundler invocations, which bundler will no longer " \
450
+ "do in future versions. Instead please use `bundle config set cache_all true`, " \
451
+ "and stop using this flag" if ARGV.include?("--all")
452
+
453
+ SharedHelpers.major_deprecation 2,
454
+ "The `--path` flag is deprecated because its semantics are unclear. " \
455
+ "Use `bundle config cache_path` to configure the path of your cache of gems, " \
456
+ "and `bundle config path` to configure the path where your gems are installed, " \
457
+ "and stop using this flag" if ARGV.include?("--path")
458
+
459
+ require_relative "cli/cache"
460
+ Cache.new(options).run
449
461
  end
450
- map %w[pack] => :package
462
+
463
+ map aliases_for("cache")
451
464
 
452
465
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
453
- method_option :keep_file_descriptors, :type => :boolean, :default => false
466
+ method_option :keep_file_descriptors, :type => :boolean, :default => true
454
467
  method_option :gemfile, :type => :string, :required => false
455
468
  long_desc <<-D
456
469
  Exec runs a command, providing it access to the gems in the bundle. While using
457
470
  bundle exec you can require and call the bundled gems as if they were installed
458
471
  into the system wide RubyGems repository.
459
472
  D
460
- map "e" => "exec"
461
473
  def exec(*args)
462
- require "bundler/cli/exec"
474
+ if ARGV.include?("--no-keep-file-descriptors")
475
+ 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")
476
+ end
477
+
478
+ require_relative "cli/exec"
463
479
  Exec.new(options, args).run
464
480
  end
465
481
 
482
+ map aliases_for("exec")
483
+
466
484
  desc "config NAME [VALUE]", "Retrieve or set a configuration value"
467
485
  long_desc <<-D
468
486
  Retrieves or sets a configuration value. If only one parameter is provided, retrieve the value. If two parameters are provided, replace the
@@ -471,26 +489,23 @@ module Bundler
471
489
  By default, setting a configuration value sets it for all projects
472
490
  on the machine.
473
491
 
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
492
+ If a global setting is superseded by local configuration, this command
493
+ will show the current value, as well as any superseded values and
476
494
  where they were specified.
477
495
  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
496
+ require_relative "cli/config"
497
+ subcommand "config", Config
483
498
 
484
499
  desc "open GEM", "Opens the source directory of the given bundled gem"
485
500
  def open(name)
486
- require "bundler/cli/open"
501
+ require_relative "cli/open"
487
502
  Open.new(options, name).run
488
503
  end
489
504
 
490
- if Bundler.feature_flag.console_command?
505
+ unless Bundler.feature_flag.bundler_3_mode?
491
506
  desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
492
507
  def console(group = nil)
493
- require "bundler/cli/console"
508
+ require_relative "cli/console"
494
509
  Console.new(options, group).run
495
510
  end
496
511
  end
@@ -508,7 +523,8 @@ module Bundler
508
523
  Bundler.ui.info "Bundler version #{Bundler::VERSION}#{build_info}"
509
524
  end
510
525
  end
511
- map %w[-v --version] => :version
526
+
527
+ map aliases_for("version")
512
528
 
513
529
  desc "licenses", "Prints the license of all gems in the bundle"
514
530
  def licenses
@@ -524,7 +540,7 @@ module Bundler
524
540
  end
525
541
  end
526
542
 
527
- if Bundler.feature_flag.viz_command?
543
+ unless Bundler.feature_flag.bundler_3_mode?
528
544
  desc "viz [OPTIONS]", "Generates a visual dependency graph", :hide => true
529
545
  long_desc <<-D
530
546
  Viz generates a PNG file of the current Gemfile as a dependency graph.
@@ -537,8 +553,8 @@ module Bundler
537
553
  method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
538
554
  method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
539
555
  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"
556
+ SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
557
+ require_relative "cli/viz"
542
558
  Viz.new(options.dup).run
543
559
  end
544
560
  end
@@ -547,14 +563,23 @@ module Bundler
547
563
 
548
564
  desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
549
565
  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`."
566
+ method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`."
551
567
  method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
552
568
  :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
553
569
  :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
554
570
  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`."
571
+ method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
572
+ method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`."
573
+ 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`."
574
+ method_option :changelog, :type => :boolean, :desc => "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
575
+ method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library",
576
+ :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)`."
577
+ method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
578
+ :desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|travis|gitlab|circle)`"
579
+ method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "",
580
+ :desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
581
+ 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>`."
582
+
558
583
  def gem(name)
559
584
  end
560
585
 
@@ -562,7 +587,7 @@ module Bundler
562
587
  def gem_command.run(instance, args = [])
563
588
  arity = 1 # name
564
589
 
565
- require "bundler/cli/gem"
590
+ require_relative "cli/gem"
566
591
  cmd_args = args + [instance]
567
592
  cmd_args.unshift(instance.options)
568
593
 
@@ -590,7 +615,7 @@ module Bundler
590
615
  method_option "force", :type => :boolean, :default => false, :banner =>
591
616
  "Forces clean even if --path is not set"
592
617
  def clean
593
- require "bundler/cli/clean"
618
+ require_relative "cli/clean"
594
619
  Clean.new(options.dup).run
595
620
  end
596
621
 
@@ -598,7 +623,7 @@ module Bundler
598
623
  method_option "ruby", :type => :boolean, :default => false, :banner =>
599
624
  "only display ruby related platform information"
600
625
  def platform
601
- require "bundler/cli/platform"
626
+ require_relative "cli/platform"
602
627
  Platform.new(options).run
603
628
  end
604
629
 
@@ -609,7 +634,7 @@ module Bundler
609
634
  "Install gem into a bundler group"
610
635
  def inject(name, version)
611
636
  SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
612
- require "bundler/cli/inject"
637
+ require_relative "cli/inject"
613
638
  Inject.new(options.dup, name, version).run
614
639
  end
615
640
 
@@ -620,6 +645,8 @@ module Bundler
620
645
  "do not attempt to fetch remote gemspecs and use the local gem cache only"
621
646
  method_option "print", :type => :boolean, :default => false, :banner =>
622
647
  "print the lockfile to STDOUT instead of writing to the file system"
648
+ method_option "gemfile", :type => :string, :banner =>
649
+ "Use the specified gemfile instead of Gemfile"
623
650
  method_option "lockfile", :type => :string, :default => nil, :banner =>
624
651
  "the path the lockfile should be written to"
625
652
  method_option "full-index", :type => :boolean, :default => false, :banner =>
@@ -639,7 +666,7 @@ module Bundler
639
666
  method_option "conservative", :type => :boolean, :banner =>
640
667
  "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
641
668
  def lock
642
- require "bundler/cli/lock"
669
+ require_relative "cli/lock"
643
670
  Lock.new(options).run
644
671
  end
645
672
 
@@ -659,13 +686,13 @@ module Bundler
659
686
  method_option "quiet", :type => :boolean, :banner =>
660
687
  "Only output warnings and errors."
661
688
  def doctor
662
- require "bundler/cli/doctor"
689
+ require_relative "cli/doctor"
663
690
  Doctor.new(options).run
664
691
  end
665
692
 
666
693
  desc "issue", "Learn how to report an issue in Bundler"
667
694
  def issue
668
- require "bundler/cli/issue"
695
+ require_relative "cli/issue"
669
696
  Issue.new.run
670
697
  end
671
698
 
@@ -676,12 +703,12 @@ module Bundler
676
703
  checkout --force`.
677
704
  D
678
705
  def pristine(*gems)
679
- require "bundler/cli/pristine"
706
+ require_relative "cli/pristine"
680
707
  Pristine.new(gems).run
681
708
  end
682
709
 
683
710
  if Bundler.feature_flag.plugins?
684
- require "bundler/cli/plugin"
711
+ require_relative "cli/plugin"
685
712
  desc "plugin", "Manage the bundler plugins"
686
713
  subcommand "plugin", Plugin
687
714
  end
@@ -689,12 +716,17 @@ module Bundler
689
716
  # Reformat the arguments passed to bundle that include a --help flag
690
717
  # into the corresponding `bundle help #{command}` call
691
718
  def self.reformatted_help_args(args)
692
- bundler_commands = all_commands.keys
719
+ bundler_commands = (COMMAND_ALIASES.keys + COMMAND_ALIASES.values).flatten
720
+
693
721
  help_flags = %w[--help -h]
694
- exec_commands = %w[e ex exe exec]
722
+ exec_commands = ["exec"] + COMMAND_ALIASES["exec"]
723
+
695
724
  help_used = args.index {|a| help_flags.include? a }
696
725
  exec_used = args.index {|a| exec_commands.include? a }
726
+
697
727
  command = args.find {|a| bundler_commands.include? a }
728
+ command = all_aliases[command] if all_aliases[command]
729
+
698
730
  if exec_used && help_used
699
731
  if exec_used + help_used == 1
700
732
  %w[help exec]
@@ -710,11 +742,11 @@ module Bundler
710
742
  end
711
743
  end
712
744
 
713
- private
745
+ private
714
746
 
715
747
  # Automatically invoke `bundle install` and resume if
716
748
  # Bundler.settings[:auto_install] exists. This is set through config cmd
717
- # `bundle config auto_install 1`.
749
+ # `bundle config set --global auto_install 1`.
718
750
  #
719
751
  # Note that this method `nil`s out the global Definition object, so it
720
752
  # should be called first, before you instantiate anything like an
@@ -762,7 +794,7 @@ module Bundler
762
794
  return unless SharedHelpers.md5_available?
763
795
 
764
796
  latest = Fetcher::CompactIndex.
765
- new(nil, Source::Rubygems::Remote.new(URI("https://rubygems.org")), nil).
797
+ new(nil, Source::Rubygems::Remote.new(Bundler::URI("https://rubygems.org")), nil).
766
798
  send(:compact_index_client).
767
799
  instance_variable_get(:@cache).
768
800
  dependencies("bundler").
@@ -786,5 +818,34 @@ module Bundler
786
818
  rescue RuntimeError
787
819
  nil
788
820
  end
821
+
822
+ def remembered_negative_flag_deprecation(name)
823
+ positive_name = name.gsub(/\Ano-/, "")
824
+ option = current_command.options[positive_name]
825
+ flag_name = "--no-" + option.switch_name.gsub(/\A--/, "")
826
+
827
+ flag_deprecation(positive_name, flag_name, option)
828
+ end
829
+
830
+ def remembered_flag_deprecation(name)
831
+ option = current_command.options[name]
832
+ flag_name = option.switch_name
833
+
834
+ flag_deprecation(name, flag_name, option)
835
+ end
836
+
837
+ def flag_deprecation(name, flag_name, option)
838
+ name_index = ARGV.find {|arg| flag_name == arg.split("=")[0] }
839
+ return unless name_index
840
+
841
+ value = options[name]
842
+ value = value.join(" ").to_s if option.type == :array
843
+
844
+ Bundler::SharedHelpers.major_deprecation 2,
845
+ "The `#{flag_name}` flag is deprecated because it relies on being " \
846
+ "remembered across bundler invocations, which bundler will no longer " \
847
+ "do in future versions. Instead please use `bundle config set --local #{name.tr("-", "_")} " \
848
+ "'#{value}'`, and stop using this flag"
849
+ end
789
850
  end
790
851
  end