bundler 1.11.1 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

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