bundler-plus 4.0.15

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