bundler 1.9.0 → 1.17.3

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