bundler 1.15.4 → 1.16.0.pre.1

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 (251) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +43 -0
  3. data/README.md +12 -7
  4. data/exe/bundle +1 -1
  5. data/exe/bundle_ruby +4 -3
  6. data/lib/bundler.rb +47 -37
  7. data/lib/bundler/build_metadata.rb +38 -0
  8. data/lib/bundler/capistrano.rb +5 -0
  9. data/lib/bundler/cli.rb +155 -67
  10. data/lib/bundler/cli/add.rb +0 -1
  11. data/lib/bundler/cli/binstubs.rb +9 -7
  12. data/lib/bundler/cli/cache.rb +5 -4
  13. data/lib/bundler/cli/check.rb +3 -5
  14. data/lib/bundler/cli/clean.rb +5 -6
  15. data/lib/bundler/cli/common.rb +11 -2
  16. data/lib/bundler/cli/config.rb +2 -1
  17. data/lib/bundler/cli/console.rb +2 -1
  18. data/lib/bundler/cli/doctor.rb +1 -0
  19. data/lib/bundler/cli/exec.rb +2 -1
  20. data/lib/bundler/cli/gem.rb +3 -2
  21. data/lib/bundler/cli/info.rb +0 -1
  22. data/lib/bundler/cli/init.rb +17 -6
  23. data/lib/bundler/cli/inject.rb +1 -0
  24. data/lib/bundler/cli/install.rb +61 -61
  25. data/lib/bundler/cli/issue.rb +1 -1
  26. data/lib/bundler/cli/list.rb +22 -0
  27. data/lib/bundler/cli/lock.rb +0 -1
  28. data/lib/bundler/cli/open.rb +2 -2
  29. data/lib/bundler/cli/outdated.rb +13 -8
  30. data/lib/bundler/cli/package.rb +9 -6
  31. data/lib/bundler/cli/platform.rb +1 -0
  32. data/lib/bundler/cli/plugin.rb +1 -0
  33. data/lib/bundler/cli/pristine.rb +9 -2
  34. data/lib/bundler/cli/show.rb +0 -1
  35. data/lib/bundler/cli/update.rb +31 -5
  36. data/lib/bundler/cli/viz.rb +1 -0
  37. data/lib/bundler/compact_index_client.rb +1 -0
  38. data/lib/bundler/compact_index_client/cache.rb +1 -0
  39. data/lib/bundler/compact_index_client/updater.rb +3 -2
  40. data/lib/bundler/compatibility_guard.rb +14 -0
  41. data/lib/bundler/constants.rb +1 -0
  42. data/lib/bundler/current_ruby.rb +5 -4
  43. data/lib/bundler/definition.rb +140 -95
  44. data/lib/bundler/dep_proxy.rb +2 -0
  45. data/lib/bundler/dependency.rb +6 -7
  46. data/lib/bundler/deployment.rb +1 -1
  47. data/lib/bundler/deprecate.rb +1 -0
  48. data/lib/bundler/dsl.rb +97 -62
  49. data/lib/bundler/endpoint_specification.rb +9 -0
  50. data/lib/bundler/env.rb +63 -27
  51. data/lib/bundler/environment_preserver.rb +26 -6
  52. data/lib/bundler/errors.rb +1 -0
  53. data/lib/bundler/feature_flag.rb +39 -4
  54. data/lib/bundler/fetcher.rb +15 -8
  55. data/lib/bundler/fetcher/base.rb +1 -0
  56. data/lib/bundler/fetcher/compact_index.rb +2 -11
  57. data/lib/bundler/fetcher/dependency.rb +1 -0
  58. data/lib/bundler/fetcher/downloader.rb +1 -0
  59. data/lib/bundler/fetcher/index.rb +1 -0
  60. data/lib/bundler/friendly_errors.rb +2 -1
  61. data/lib/bundler/gem_helper.rb +14 -9
  62. data/lib/bundler/gem_helpers.rb +1 -0
  63. data/lib/bundler/gem_remote_fetcher.rb +1 -0
  64. data/lib/bundler/gem_tasks.rb +1 -0
  65. data/lib/bundler/gem_version_promoter.rb +1 -0
  66. data/lib/bundler/gemdeps.rb +1 -0
  67. data/lib/bundler/graph.rb +1 -0
  68. data/lib/bundler/index.rb +15 -8
  69. data/lib/bundler/injector.rb +25 -22
  70. data/lib/bundler/inline.rb +5 -7
  71. data/lib/bundler/installer.rb +93 -45
  72. data/lib/bundler/installer/gem_installer.rb +2 -0
  73. data/lib/bundler/installer/parallel_installer.rb +73 -42
  74. data/lib/bundler/installer/standalone.rb +1 -0
  75. data/lib/bundler/lazy_specification.rb +2 -1
  76. data/lib/bundler/lockfile_generator.rb +95 -0
  77. data/lib/bundler/lockfile_parser.rb +10 -4
  78. data/lib/bundler/match_platform.rb +1 -0
  79. data/lib/bundler/mirror.rb +6 -3
  80. data/lib/bundler/plugin.rb +1 -0
  81. data/lib/bundler/plugin/api/source.rb +8 -0
  82. data/lib/bundler/plugin/installer.rb +7 -6
  83. data/lib/bundler/plugin/source_list.rb +7 -8
  84. data/lib/bundler/process_lock.rb +24 -0
  85. data/lib/bundler/psyched_yaml.rb +1 -0
  86. data/lib/bundler/remote_specification.rb +1 -0
  87. data/lib/bundler/resolver.rb +138 -191
  88. data/lib/bundler/resolver/spec_group.rb +111 -0
  89. data/lib/bundler/retry.rb +1 -0
  90. data/lib/bundler/ruby_dsl.rb +1 -0
  91. data/lib/bundler/ruby_version.rb +1 -0
  92. data/lib/bundler/rubygems_ext.rb +5 -4
  93. data/lib/bundler/rubygems_gem_installer.rb +23 -0
  94. data/lib/bundler/rubygems_integration.rb +56 -27
  95. data/lib/bundler/runtime.rb +3 -5
  96. data/lib/bundler/settings.rb +177 -76
  97. data/lib/bundler/settings/validator.rb +79 -0
  98. data/lib/bundler/setup.rb +1 -0
  99. data/lib/bundler/shared_helpers.rb +86 -26
  100. data/lib/bundler/similarity_detector.rb +1 -0
  101. data/lib/bundler/source.rb +32 -0
  102. data/lib/bundler/source/gemspec.rb +1 -0
  103. data/lib/bundler/source/git.rb +21 -16
  104. data/lib/bundler/source/git/git_proxy.rb +14 -10
  105. data/lib/bundler/source/metadata.rb +63 -0
  106. data/lib/bundler/source/path.rb +8 -8
  107. data/lib/bundler/source/path/installer.rb +2 -0
  108. data/lib/bundler/source/rubygems.rb +131 -84
  109. data/lib/bundler/source/rubygems/remote.rb +3 -0
  110. data/lib/bundler/source_list.rb +75 -15
  111. data/lib/bundler/spec_set.rb +2 -1
  112. data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
  113. data/lib/bundler/stub_specification.rb +1 -0
  114. data/lib/bundler/templates/Executable +4 -0
  115. data/lib/bundler/templates/Executable.bundler +105 -0
  116. data/lib/bundler/templates/Gemfile +1 -0
  117. data/lib/bundler/templates/gems.rb +8 -0
  118. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  119. data/lib/bundler/templates/newgem/gitignore.tt +0 -1
  120. data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
  121. data/lib/bundler/templates/newgem/rspec.tt +1 -0
  122. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
  123. data/lib/bundler/ui.rb +1 -0
  124. data/lib/bundler/ui/rg_proxy.rb +1 -0
  125. data/lib/bundler/ui/shell.rb +15 -4
  126. data/lib/bundler/ui/silent.rb +1 -0
  127. data/lib/bundler/uri_credentials_filter.rb +1 -0
  128. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
  129. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
  130. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  131. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  132. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
  133. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -2
  134. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  135. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -0
  136. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
  137. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
  138. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
  139. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
  140. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
  141. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
  142. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +3 -2
  143. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -6
  144. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  145. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  146. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
  147. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +487 -148
  148. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
  149. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
  150. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
  151. data/lib/bundler/vendored_fileutils.rb +9 -0
  152. data/lib/bundler/vendored_molinillo.rb +1 -0
  153. data/lib/bundler/vendored_persistent.rb +34 -0
  154. data/lib/bundler/vendored_thor.rb +1 -0
  155. data/lib/bundler/version.rb +6 -2
  156. data/lib/bundler/version_ranges.rb +1 -0
  157. data/lib/bundler/vlad.rb +5 -0
  158. data/lib/bundler/worker.rb +1 -0
  159. data/lib/bundler/yaml_serializer.rb +3 -3
  160. data/man/bundle-add.1 +43 -0
  161. data/man/bundle-add.1.txt +40 -0
  162. data/man/bundle-binstubs.1 +40 -0
  163. data/man/bundle-binstubs.1.txt +48 -0
  164. data/man/bundle-binstubs.ronn +14 -0
  165. data/man/bundle-check.1 +31 -0
  166. data/man/bundle-check.1.txt +32 -0
  167. data/man/bundle-clean.1 +24 -0
  168. data/man/bundle-clean.1.txt +26 -0
  169. data/man/bundle-config.1 +455 -0
  170. data/man/bundle-config.1.txt +491 -0
  171. data/man/bundle-config.ronn +133 -79
  172. data/man/bundle-exec.1 +165 -0
  173. data/man/bundle-exec.1.txt +178 -0
  174. data/man/bundle-exec.ronn +7 -0
  175. data/man/bundle-gem.1 +80 -0
  176. data/man/bundle-gem.1.txt +91 -0
  177. data/man/bundle-gem.ronn +2 -1
  178. data/man/bundle-info.1 +20 -0
  179. data/man/bundle-info.1.txt +21 -0
  180. data/man/bundle-init.1 +20 -0
  181. data/man/bundle-init.1.txt +24 -0
  182. data/man/bundle-inject.1 +33 -0
  183. data/man/bundle-inject.1.txt +32 -0
  184. data/man/bundle-install.1 +305 -0
  185. data/man/bundle-install.1.txt +385 -0
  186. data/man/bundle-install.ronn +32 -32
  187. data/man/bundle-list.1 +20 -0
  188. data/man/bundle-list.1.txt +21 -0
  189. data/man/bundle-list.ronn +15 -0
  190. data/man/bundle-lock.1 +84 -0
  191. data/man/bundle-lock.1.txt +93 -0
  192. data/man/bundle-open.1 +32 -0
  193. data/man/bundle-open.1.txt +29 -0
  194. data/man/bundle-outdated.1 +151 -0
  195. data/man/bundle-outdated.1.txt +127 -0
  196. data/man/bundle-outdated.ronn +1 -1
  197. data/man/bundle-package.1 +55 -0
  198. data/man/bundle-package.1.txt +79 -0
  199. data/man/bundle-package.ronn +5 -0
  200. data/man/bundle-platform.1 +61 -0
  201. data/man/bundle-platform.1.txt +57 -0
  202. data/man/bundle-pristine.1 +34 -0
  203. data/man/bundle-pristine.1.txt +44 -0
  204. data/man/bundle-pristine.ronn +24 -3
  205. data/man/bundle-show.1 +23 -0
  206. data/man/bundle-show.1.txt +25 -0
  207. data/man/bundle-update.1 +390 -0
  208. data/man/bundle-update.1.txt +386 -0
  209. data/man/bundle-update.ronn +2 -2
  210. data/man/bundle-viz.1 +39 -0
  211. data/man/bundle-viz.1.txt +38 -0
  212. data/man/bundle-viz.ronn +5 -5
  213. data/man/bundle.1 +132 -0
  214. data/man/bundle.1.txt +113 -0
  215. data/man/bundle.ronn +5 -2
  216. data/man/gemfile.5 +679 -0
  217. data/man/gemfile.5.ronn +31 -0
  218. data/man/gemfile.5.txt +636 -0
  219. data/man/index.txt +23 -0
  220. metadata +21 -36
  221. data/.codeclimate.yml +0 -25
  222. data/.gitignore +0 -18
  223. data/.rspec +0 -3
  224. data/.rubocop.yml +0 -131
  225. data/.rubocop_todo.yml +0 -418
  226. data/.travis.yml +0 -122
  227. data/CODE_OF_CONDUCT.md +0 -42
  228. data/CONTRIBUTING.md +0 -17
  229. data/Rakefile +0 -338
  230. data/bin/rake +0 -19
  231. data/bin/rspec +0 -15
  232. data/bin/rubocop +0 -17
  233. data/bin/with_rubygems +0 -39
  234. data/bundler.gemspec +0 -48
  235. data/doc/README.md +0 -30
  236. data/doc/TROUBLESHOOTING.md +0 -64
  237. data/doc/contributing/BUG_TRIAGE.md +0 -36
  238. data/doc/contributing/COMMUNITY.md +0 -13
  239. data/doc/contributing/GETTING_HELP.md +0 -11
  240. data/doc/contributing/HOW_YOU_CAN_HELP.md +0 -27
  241. data/doc/contributing/ISSUES.md +0 -51
  242. data/doc/contributing/README.md +0 -38
  243. data/doc/development/NEW_FEATURES.md +0 -10
  244. data/doc/development/PULL_REQUESTS.md +0 -40
  245. data/doc/development/README.md +0 -19
  246. data/doc/development/RELEASING.md +0 -9
  247. data/doc/development/SETUP.md +0 -27
  248. data/doc/documentation/README.md +0 -29
  249. data/doc/documentation/VISION.md +0 -26
  250. data/doc/documentation/WRITING.md +0 -54
  251. data/task/release.rake +0 -116
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4017f3a02c248780eb86afcd89c12249064f3dbc
4
- data.tar.gz: 96679694c04c77c28b3c01d6e017fb6273eb857a
2
+ SHA256:
3
+ metadata.gz: 461ac41667e722cb445f3b68673de5b3a4c944496662d08d4f1b7c009533adbf
4
+ data.tar.gz: 9b0d4a479e0a0672c568995a08a58c15b6461cbc24f5faff4fa6d78c63c2b5ca
5
5
  SHA512:
6
- metadata.gz: 70122e1565c9ee2d2998872fb0f9a30e65749a2f07ef9661f340e68db0244c53a0d62384061afdc05f259b9fccc40a7cf4a70623251fe60bb09384d536863357
7
- data.tar.gz: 1aeca0caca38ecfb8acd47c1cfe0f18e19e1521b68f77b797e3df57f6a6ab54f3e16d550f2cb3bf75124f060e92c1371f9128509b9e9123de7d6167e5c13596c
6
+ metadata.gz: 9f807456d92092ba14ccfe3b233d367936b6eebf8eadf7eec9484f1d369cd4cae38769015bafcd6d362d70b3a4cab7e405c019bc5814f9b9817acb9a69a1f3bb
7
+ data.tar.gz: fc4cd931a53cfa305391ec6180dde28d372a8568b1d30a228f21e6c96d850f4c146669d0cbf7f568ef65913fd83e39ba660c2a5390fcfbfa39ab0aa03b7276a3
@@ -1,3 +1,46 @@
1
+ ## 1.16.0.pre.1 (2017-09-04)
2
+
3
+ Features:
4
+
5
+ - allow using non-branch symbolic refs in a git source (#4845, @segiddins)
6
+ - allow absolute paths in the `cache path` setting (#5627, @mal)
7
+ - gems created via `bundle gem` with rspec have `--require spec_helper` in their `.rspec` file (@koic)
8
+ - `bundle env` includes `Gem.ruby` and the `bundle` binstub shebang when they don't match (#5616, @segiddins)
9
+ - allow passing gem names to `bundle pristine` (@segiddins)
10
+ - `bundle version` and `bundle env` include the commit and build date for the bundler gem (#5049, @segiddins)
11
+ - add the `--shebang` option to `bundle binstubs` (#4070, @segiddins, @Zorbash)
12
+ - gemfiles are `eval`ed one fewer time when running `bundle install` (#4952, #3096, #4417, @segiddins)
13
+ - the `fileutils` gem is now vendored so different versions of the gem can be activated (@segiddins)
14
+ - speed up no-op installations (#5842, @segiddins)
15
+ - default to keeping the lockfile in the default gem template (@deivid-rodriguez)
16
+ - add a special bundler binstub that ensures the correct version of bundler is activated (#5876, @segiddins)
17
+ - speed up dependency resolution and ensure that all resolvable gemfiles can be installed (@segiddins, @greysteil)
18
+ - add a `bundle list` command that prints the gems in use (#4754, @colby-swandale)
19
+ - allow adding credentials to a gem source during deployment when `allow_deployment_source_credential_changes` is set (@adrian-gomez)
20
+ - making an outdated (and insecure) TLS connection to rubygems.org will print a warning (@segiddins)
21
+
22
+ Bugfixes:
23
+
24
+ - allow configuring a mirror fallback timeout without a trailing slash (#4830, @segiddins)
25
+ - fix handling of mirrors for file: urls that contain upper-case characters (@segiddins)
26
+ - list the correct gem host for `rake release` when `allowed_push_host` has been set (@mdeering)
27
+ - ensure `Bundler.original_env` preserves all env keys that bundler sets (#5700, @segiddins)
28
+ - ensure `bundle pristine` removes files added to a git gem (@segiddins)
29
+ - load plugin files from path gems before gem installation (#5429, @segiddins)
30
+ - ensure gems containing manpages are properly set up (#5730, @segiddins)
31
+ - avoid fetching remote specs when all effected gems are in groups that are not being installed (@segiddins)
32
+ - allow `BUNDLE_GEMFILE` to be a relative path (#5712, @gxespino)
33
+ - show a more helpful error message when a gem fails to install due to a corrupted lockfile (#5846, @segiddins)
34
+ - add a process lock to allow multiple concurrent `bundle install`s (#5851, @stefansedich)
35
+ - ensure that specifications always return an array for `#extensions` (@greysteil)
36
+ - print a helpful error message when using a gem in the Gemfile with an empty name (@colby-swandale)
37
+ - ensure that all gemfiles are included in `bundle env` (@segiddins)
38
+ - use ssl client cert and ca cert settings from gem configuration as fallbacks (@stan3)
39
+ - avoid global namespace pollution when loading gems (#5958, @shyouhei)
40
+ - avoid running a complete re-resolve on `bundle update --bundler` (@segiddins)
41
+ - allow `bundle binstubs --standalone` to work without `path` being set (@colby-swandale)
42
+ - fix support for bundle paths that include jars or wars on jruby (#5975, @torcido)
43
+
1
44
  ## 1.15.4 (2017-08-19)
2
45
 
3
46
  Bugfixes:
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![Build Status](https://img.shields.io/travis/bundler/bundler/master.svg?style=flat)](https://travis-ci.org/bundler/bundler)
3
3
  [![Code Climate](https://img.shields.io/codeclimate/github/bundler/bundler.svg?style=flat)](https://codeclimate.com/github/bundler/bundler)
4
4
  [![Inline docs ](http://inch-ci.org/github/bundler/bundler.svg?style=flat)](http://inch-ci.org/github/bundler/bundler)
5
+ [![Slack ](http://bundler-slackin.herokuapp.com/badge.svg)](http://bundler-slackin.herokuapp.com)
5
6
 
6
7
  # Bundler: a gem to bundle gems
7
8
 
@@ -11,13 +12,15 @@ It does this by managing the gems that the application depends on. Given a list
11
12
 
12
13
  ### Installation and usage
13
14
 
14
- To install:
15
+ To install (or update to the latest version):
15
16
 
16
17
  ```
17
18
  gem install bundler
18
19
  ```
19
20
 
20
- Bundler is most commonly used to manage your application's dependencies. To use it for this:
21
+ To install a prerelease version (if one is available), run `gem install bundler --pre`. To uninstall Bundler, run `gem uninstall bundler`.
22
+
23
+ Bundler is most commonly used to manage your application's dependencies. For example, these commands will allow you to use Bundler to manage the `rspec` gem for your application:
21
24
 
22
25
  ```
23
26
  bundle init
@@ -34,11 +37,6 @@ For help with common problems, see [TROUBLESHOOTING](doc/TROUBLESHOOTING.md).
34
37
 
35
38
  Still stuck? Try [filing an issue](doc/contributing/ISSUES.md).
36
39
 
37
- ### Supporting
38
-
39
- <a href="https://rubytogether.org/"><img src="https://rubytogether.org/images/rubies.svg" width=200></a><br/>
40
- Bundler is maintained by <a href="https://rubytogether.org/">Ruby Together</a>, a grassroots initiative committed to supporting the critical Ruby infrastructure you rely on. Contribute today <a href="https://rubytogether.org/developers">as an individual</a> or even better, <a href="https://rubytogether.org/companies">as a company</a>, and ensure that Bundler, RubyGems, and other shared tooling is around for years to come.
41
-
42
40
  ### Other questions
43
41
 
44
42
  To see what has changed in recent versions of Bundler, see the [CHANGELOG](CHANGELOG.md).
@@ -49,6 +47,13 @@ To get in touch with the Bundler core team and other Bundler users, please see [
49
47
 
50
48
  If you'd like to contribute to Bundler, that's awesome, and we <3 you. There's a guide to contributing to Bundler (both code and general help) over in [our documentation section](doc/README.md).
51
49
 
50
+ While some Bundler contributors are compensated by Ruby Together, the project maintainers make decisions independent of Ruby Together. As a project, we welcome contributions regardless of the author’s affiliation with Ruby Together.
51
+
52
+ ### Supporting
53
+
54
+ <a href="https://rubytogether.org/"><img src="https://rubytogether.org/images/rubies.svg" width="150"></a><br>
55
+ <a href="https://rubytogether.org/">Ruby Together</a> pays some Bundler maintainers for their ongoing work. As a grassroots initiative committed to supporting the critical Ruby infrastructure you rely on, Ruby Together is funded entirely by the Ruby community. Contribute today <a href="https://rubytogether.org/developers">as an individual</a> or (better yet) <a href="https://rubytogether.org/companies">as a company</a> to ensure that Bundler, RubyGems, and other shared tooling is around for years to come.
56
+
52
57
  ### Code of Conduct
53
58
 
54
59
  Everyone interacting in the Bundler project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [Bundler code of conduct](https://github.com/bundler/bundler/blob/master/CODE_OF_CONDUCT.md).
data/exe/bundle CHANGED
@@ -23,7 +23,7 @@ Bundler.with_friendly_errors do
23
23
  require "bundler/cli"
24
24
 
25
25
  # Allow any command to use --help flag to show help for that command
26
- help_flags = %w(--help -h)
26
+ help_flags = %w[--help -h]
27
27
  help_flag_used = ARGV.any? {|a| help_flags.include? a }
28
28
  args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV
29
29
 
@@ -1,12 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ require "bundler/shared_helpers"
5
+
6
+ Bundler::SharedHelpers.major_deprecation(2, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`")
7
+
4
8
  Signal.trap("INT") { exit 1 }
5
9
 
6
10
  require "bundler/errors"
7
11
  require "bundler/ruby_version"
8
12
  require "bundler/ruby_dsl"
9
- require "bundler/shared_helpers"
10
13
 
11
14
  module Bundler
12
15
  class Dsl
@@ -42,8 +45,6 @@ module Bundler
42
45
  end
43
46
  end
44
47
 
45
- Bundler::SharedHelpers.major_deprecation("the bundle_ruby executable has been removed in favor of `bundle platform --ruby`")
46
-
47
48
  dsl = Bundler::Dsl.new
48
49
  begin
49
50
  dsl.eval_gemfile(Bundler::SharedHelpers.default_gemfile)
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
- require "fileutils"
2
+
3
+ require "bundler/compatibility_guard"
4
+
5
+ require "bundler/vendored_fileutils"
3
6
  require "pathname"
4
7
  require "rbconfig"
5
8
  require "thread"
6
- require "tmpdir"
7
9
 
8
10
  require "bundler/errors"
9
11
  require "bundler/environment_preserver"
@@ -13,9 +15,10 @@ require "bundler/rubygems_integration"
13
15
  require "bundler/version"
14
16
  require "bundler/constants"
15
17
  require "bundler/current_ruby"
18
+ require "bundler/build_metadata"
16
19
 
17
20
  module Bundler
18
- environment_preserver = EnvironmentPreserver.new(ENV, %w(PATH GEM_PATH))
21
+ environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
19
22
  ORIGINAL_ENV = environment_preserver.restore
20
23
  ENV.replace(environment_preserver.backup)
21
24
  SUDO_MUTEX = Mutex.new
@@ -40,6 +43,7 @@ module Bundler
40
43
  autoload :LazySpecification, "bundler/lazy_specification"
41
44
  autoload :LockfileParser, "bundler/lockfile_parser"
42
45
  autoload :MatchPlatform, "bundler/match_platform"
46
+ autoload :ProcessLock, "bundler/process_lock"
43
47
  autoload :RemoteSpecification, "bundler/remote_specification"
44
48
  autoload :Resolver, "bundler/resolver"
45
49
  autoload :Retry, "bundler/retry"
@@ -58,8 +62,6 @@ module Bundler
58
62
  autoload :VersionRanges, "bundler/version_ranges"
59
63
 
60
64
  class << self
61
- attr_writer :bundle_path
62
-
63
65
  def configure
64
66
  @configured ||= configure_gem_home_and_path
65
67
  end
@@ -75,7 +77,11 @@ module Bundler
75
77
 
76
78
  # Returns absolute path of where gems are installed on the filesystem.
77
79
  def bundle_path
78
- @bundle_path ||= Pathname.new(settings.path).expand_path(root)
80
+ @bundle_path ||= Pathname.new(configured_bundle_path.path).expand_path(root)
81
+ end
82
+
83
+ def configured_bundle_path
84
+ @configured_bundle_path ||= settings.path.tap(&:validate!)
79
85
  end
80
86
 
81
87
  # Returns absolute location of where binstubs are installed to.
@@ -113,7 +119,7 @@ module Bundler
113
119
  end
114
120
 
115
121
  def environment
116
- SharedHelpers.major_deprecation "Bundler.environment has been removed in favor of Bundler.load"
122
+ SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
117
123
  load
118
124
  end
119
125
 
@@ -130,6 +136,12 @@ module Bundler
130
136
  end
131
137
  end
132
138
 
139
+ def frozen?
140
+ frozen = settings[:deployment]
141
+ frozen ||= settings[:frozen] unless feature_flag.deployment_means_frozen?
142
+ frozen
143
+ end
144
+
133
145
  def locked_gems
134
146
  @locked_gems ||=
135
147
  if defined?(@definition) && @definition
@@ -168,6 +180,7 @@ module Bundler
168
180
 
169
181
  def tmp_home_path(login, warning)
170
182
  login ||= "unknown"
183
+ Kernel.send(:require, "tmpdir")
171
184
  path = Pathname.new(Dir.tmpdir).join("bundler", "home")
172
185
  SharedHelpers.filesystem_access(path) do |tmp_home_path|
173
186
  unless tmp_home_path.exist?
@@ -196,17 +209,13 @@ module Bundler
196
209
  bundle_path.join("specifications")
197
210
  end
198
211
 
199
- def cache
200
- bundle_path.join("cache/bundler")
201
- end
202
-
203
212
  def user_cache
204
213
  user_bundle_path.join("cache")
205
214
  end
206
215
 
207
216
  def root
208
217
  @root ||= begin
209
- default_gemfile.dirname.expand_path
218
+ SharedHelpers.root
210
219
  rescue GemfileNotFound
211
220
  bundle_dir = default_bundle_dir
212
221
  raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir
@@ -215,8 +224,8 @@ module Bundler
215
224
  end
216
225
 
217
226
  def app_config_path
218
- if ENV["BUNDLE_APP_CONFIG"]
219
- Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root)
227
+ if app_config = ENV["BUNDLE_APP_CONFIG"]
228
+ Pathname.new(app_config).expand_path(root)
220
229
  else
221
230
  root.join(".bundle")
222
231
  end
@@ -224,10 +233,11 @@ module Bundler
224
233
 
225
234
  def app_cache(custom_path = nil)
226
235
  path = custom_path || root
227
- path.join(settings.app_cache_path)
236
+ Pathname.new(path).join(settings.app_cache_path)
228
237
  end
229
238
 
230
239
  def tmp(name = Process.pid.to_s)
240
+ Kernel.send(:require, "tmpdir")
231
241
  Pathname.new(Dir.mktmpdir(["bundler", name]))
232
242
  end
233
243
 
@@ -257,7 +267,7 @@ EOF
257
267
  # @deprecated Use `original_env` instead
258
268
  # @return [Hash] Environment with all bundler-related variables removed
259
269
  def clean_env
260
- Bundler::SharedHelpers.major_deprecation("`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
270
+ Bundler::SharedHelpers.major_deprecation(2, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
261
271
  env = original_env
262
272
 
263
273
  if env.key?("BUNDLER_ORIG_MANPATH")
@@ -313,21 +323,25 @@ EOF
313
323
  end
314
324
 
315
325
  def system_bindir
316
- # Gem.bindir doesn't always return the location that Rubygems will install
317
- # system binaries. If you put '-n foo' in your .gemrc, Rubygems will
318
- # install binstubs there instead. Unfortunately, Rubygems doesn't expose
326
+ # Gem.bindir doesn't always return the location that RubyGems will install
327
+ # system binaries. If you put '-n foo' in your .gemrc, RubyGems will
328
+ # install binstubs there instead. Unfortunately, RubyGems doesn't expose
319
329
  # that directory at all, so rather than parse .gemrc ourselves, we allow
320
330
  # the directory to be set as well, via `bundle config bindir foo`.
321
331
  Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
322
332
  end
323
333
 
334
+ def use_system_gems?
335
+ configured_bundle_path.use_system_gems?
336
+ end
337
+
324
338
  def requires_sudo?
325
339
  return @requires_sudo if defined?(@requires_sudo_ran)
326
340
 
327
341
  sudo_present = which "sudo" if settings.allow_sudo?
328
342
 
329
343
  if sudo_present
330
- # the bundle path and subdirectories need to be writable for Rubygems
344
+ # the bundle path and subdirectories need to be writable for RubyGems
331
345
  # to be able to unpack and install gems without exploding
332
346
  path = bundle_path
333
347
  path = path.parent until path.exist?
@@ -449,14 +463,17 @@ EOF
449
463
  end
450
464
 
451
465
  def reset_paths!
452
- @root = nil
453
- @settings = nil
466
+ @bin_path = nil
467
+ @bundler_major_version = nil
468
+ @bundle_path = nil
469
+ @configured = nil
470
+ @configured_bundle_path = nil
454
471
  @definition = nil
455
- @setup = nil
456
472
  @load = nil
457
473
  @locked_gems = nil
458
- @bundle_path = nil
459
- @bin_path = nil
474
+ @root = nil
475
+ @settings = nil
476
+ @setup = nil
460
477
  @user_home = nil
461
478
  end
462
479
 
@@ -478,7 +495,7 @@ EOF
478
495
  end
479
496
 
480
497
  def eval_gemspec(path, contents)
481
- eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
498
+ eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
482
499
  rescue ScriptError, StandardError => e
483
500
  msg = "There was an error while loading `#{path.basename}`: #{e.message}"
484
501
 
@@ -495,14 +512,14 @@ EOF
495
512
  bundle_path
496
513
  end
497
514
 
498
- def configure_gem_path(env = ENV, settings = self.settings)
515
+ def configure_gem_path(env = ENV)
499
516
  blank_home = env["GEM_HOME"].nil? || env["GEM_HOME"].empty?
500
- if settings[:disable_shared_gems]
517
+ if !use_system_gems?
501
518
  # this needs to be empty string to cause
502
519
  # PathSupport.split_gem_path to only load up the
503
520
  # Bundler --path setting as the GEM_PATH.
504
521
  env["GEM_PATH"] = ""
505
- elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s
522
+ elsif blank_home
506
523
  possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
507
524
  paths = possibles.flatten.compact.uniq.reject(&:empty?)
508
525
  env["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
@@ -510,14 +527,7 @@ EOF
510
527
  end
511
528
 
512
529
  def configure_gem_home
513
- # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
514
- begin
515
- FileUtils.mkdir_p bundle_path.to_s
516
- rescue
517
- nil
518
- end
519
-
520
- ENV["GEM_HOME"] = File.expand_path(bundle_path, root)
530
+ Bundler::SharedHelpers.set_env "GEM_HOME", File.expand_path(bundle_path, root)
521
531
  Bundler.rubygems.clear_paths
522
532
  end
523
533
 
@@ -0,0 +1,38 @@
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 = "2017-09-05".freeze
8
+ @git_commit_sha = "5ffc8b010".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
+ @git_commit_sha ||= Dir.chdir(File.expand_path("..", __FILE__)) do
29
+ `git rev-parse --short HEAD`.strip.freeze
30
+ end
31
+ end
32
+
33
+ # Whether this is an official release build of Bundler.
34
+ def self.release?
35
+ @release
36
+ end
37
+ end
38
+ end
@@ -1,4 +1,9 @@
1
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
+
2
7
  # Capistrano task for Bundler.
3
8
  #
4
9
  # Add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and
@@ -1,13 +1,18 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "bundler"
3
4
  require "bundler/vendored_thor"
4
5
 
5
6
  module Bundler
6
7
  class CLI < Thor
7
- AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean).freeze
8
- PARSEABLE_COMMANDS = %w(
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[
9
14
  check config help exec platform show version
10
- ).freeze
15
+ ].freeze
11
16
 
12
17
  def self.start(*)
13
18
  super
@@ -30,11 +35,11 @@ module Bundler
30
35
 
31
36
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
32
37
  if custom_gemfile && !custom_gemfile.empty?
33
- ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile)
38
+ Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", File.expand_path(custom_gemfile)
34
39
  Bundler.reset_paths!
35
40
  end
36
41
 
37
- Bundler.settings[:retry] = options[:retry] if options[:retry]
42
+ Bundler.settings.set_command_option_if_given :retry, options[:retry]
38
43
 
39
44
  current_cmd = args.last[:current_command].name
40
45
  auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
@@ -42,7 +47,6 @@ module Bundler
42
47
  raise InvalidOption, e.message
43
48
  ensure
44
49
  self.options ||= {}
45
- Bundler.settings.cli_flags_given = !options.empty?
46
50
  unprinted_warnings = Bundler.ui.unprinted_warnings
47
51
  Bundler.ui = UI::Shell.new(options)
48
52
  Bundler.ui.level = "debug" if options["verbose"]
@@ -57,10 +61,41 @@ module Bundler
57
61
  end
58
62
  end
59
63
 
64
+ def self.deprecated_option(*args, &blk)
65
+ return if Bundler.feature_flag.forget_cli_options?
66
+ method_option(*args, &blk)
67
+ end
68
+
60
69
  check_unknown_options!(:except => [:config, :exec])
61
70
  stop_on_unknown_option! :exec
62
71
 
63
- 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
+
64
99
  class_option "no-color", :type => :boolean, :desc => "Disable colorization in output"
65
100
  class_option "retry", :type => :numeric, :aliases => "-r", :banner => "NUM",
66
101
  :desc => "Specify the number of times you wish to attempt network commands"
@@ -107,7 +142,7 @@ module Bundler
107
142
  Gemfile to a gem with a gemspec, the --gemspec option will automatically add each
108
143
  dependency listed in the gemspec file to the newly created Gemfile.
109
144
  D
110
- 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"
111
146
  def init
112
147
  require "bundler/cli/init"
113
148
  Init.new(options.dup).run
@@ -124,7 +159,7 @@ module Bundler
124
159
  method_option "gemfile", :type => :string, :banner =>
125
160
  "Use the specified gemfile instead of Gemfile"
126
161
  method_option "path", :type => :string, :banner =>
127
- "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?}"
128
163
  map "c" => "check"
129
164
  def check
130
165
  require "bundler/cli/check"
@@ -142,13 +177,13 @@ module Bundler
142
177
 
143
178
  If the bundle has already been installed, bundler will tell you so and then exit.
144
179
  D
145
- method_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
180
+ deprecated_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
146
181
  "Generate bin stubs for bundled gems to ./bin"
147
- method_option "clean", :type => :boolean, :banner =>
182
+ deprecated_option "clean", :type => :boolean, :banner =>
148
183
  "Run bundle clean automatically after install"
149
- method_option "deployment", :type => :boolean, :banner =>
184
+ deprecated_option "deployment", :type => :boolean, :banner =>
150
185
  "Install using defaults tuned for deployment environments"
151
- method_option "frozen", :type => :boolean, :banner =>
186
+ deprecated_option "frozen", :type => :boolean, :banner =>
152
187
  "Do not allow the Gemfile.lock to be updated after this install"
153
188
  method_option "full-index", :type => :boolean, :banner =>
154
189
  "Fall back to using the single-file index of all gems"
@@ -158,28 +193,29 @@ module Bundler
158
193
  "Specify the number of jobs to run in parallel"
159
194
  method_option "local", :type => :boolean, :banner =>
160
195
  "Do not attempt to fetch gems remotely and use the gem cache instead"
161
- method_option "no-cache", :type => :boolean, :banner =>
196
+ deprecated_option "no-cache", :type => :boolean, :banner =>
162
197
  "Don't update the existing gem cache."
163
- method_option "force", :type => :boolean, :banner =>
198
+ method_option "redownload", :type => :boolean, :aliases =>
199
+ [Bundler.feature_flag.forget_cli_options? ? nil : "--force"].compact, :banner =>
164
200
  "Force downloading every gem."
165
- method_option "no-prune", :type => :boolean, :banner =>
201
+ deprecated_option "no-prune", :type => :boolean, :banner =>
166
202
  "Don't remove stale gems from the cache."
167
- method_option "path", :type => :string, :banner =>
203
+ deprecated_option "path", :type => :string, :banner =>
168
204
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
169
205
  method_option "quiet", :type => :boolean, :banner =>
170
206
  "Only output warnings and errors."
171
- method_option "shebang", :type => :string, :banner =>
207
+ deprecated_option "shebang", :type => :string, :banner =>
172
208
  "Specify a different shebang executable name than the default (usually 'ruby')"
173
209
  method_option "standalone", :type => :array, :lazy_default => [], :banner =>
174
210
  "Make a bundle that can work without the Bundler runtime"
175
- method_option "system", :type => :boolean, :banner =>
211
+ deprecated_option "system", :type => :boolean, :banner =>
176
212
  "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
177
213
  method_option "trust-policy", :alias => "P", :type => :string, :banner =>
178
214
  "Gem trust policy (like gem install -P). Must be one of " +
179
215
  Bundler.rubygems.security_policy_keys.join("|")
180
- method_option "without", :type => :array, :banner =>
216
+ deprecated_option "without", :type => :array, :banner =>
181
217
  "Exclude gems that are part of the specified named group."
182
- method_option "with", :type => :array, :banner =>
218
+ deprecated_option "with", :type => :array, :banner =>
183
219
  "Include gems that are part of the specified named group."
184
220
  map "i" => "install"
185
221
  def install
@@ -189,7 +225,7 @@ module Bundler
189
225
  end
190
226
  end
191
227
 
192
- desc "update [OPTIONS]", "update the current environment"
228
+ desc "update [OPTIONS]", "Update the current environment"
193
229
  long_desc <<-D
194
230
  Update will install the newest versions of the gems listed in the Gemfile. Use
195
231
  update when you have changed the Gemfile, or if you want to get the newest
@@ -223,6 +259,8 @@ module Bundler
223
259
  "Do not allow any gem to be updated past latest --patch | --minor | --major"
224
260
  method_option "conservative", :type => :boolean, :banner =>
225
261
  "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
262
+ method_option "all", :type => :boolean, :banner =>
263
+ "Update everything."
226
264
  def update(*gems)
227
265
  require "bundler/cli/update"
228
266
  Update.new(options, gems).run
@@ -238,12 +276,24 @@ module Bundler
238
276
  method_option "outdated", :type => :boolean,
239
277
  :banner => "Show verbose output including whether gems are outdated."
240
278
  def show(gem_name = nil)
241
- Bundler::SharedHelpers.major_deprecation("use `bundle show` instead of `bundle list`") if ARGV[0] == "list"
279
+ Bundler::SharedHelpers.major_deprecation(2, "use `bundle list` instead of `bundle show`") if ARGV[0] == "show"
242
280
  require "bundler/cli/show"
243
281
  Show.new(options, gem_name).run
244
282
  end
245
- # TODO: 2.0 remove `bundle list`
246
- map %w(list) => "show"
283
+ # TODO: 2.0 remove `bundle show`
284
+
285
+ if Bundler.feature_flag.list_command?
286
+ desc "list", "List all gems in the bundle"
287
+ method_option "name-only", :type => :boolean, :banner => "print only the gem names"
288
+ def list
289
+ require "bundler/cli/list"
290
+ List.new(options).run
291
+ end
292
+
293
+ map %w[ls] => "list"
294
+ else
295
+ map %w[list] => "show"
296
+ end
247
297
 
248
298
  desc "info GEM [OPTIONS]", "Show information for the given gem"
249
299
  method_option "path", :type => :boolean, :banner => "Print full path to gem"
@@ -262,6 +312,8 @@ module Bundler
262
312
  "Overwrite existing binstubs if they exist"
263
313
  method_option "path", :type => :string, :lazy_default => "bin", :banner =>
264
314
  "Binstub destination directory (default bin)"
315
+ method_option "shebang", :type => :string, :banner =>
316
+ "Specify a different shebang executable name than the default (usually 'ruby')"
265
317
  method_option "standalone", :type => :boolean, :banner =>
266
318
  "Make binstubs that can work without the Bundler runtime"
267
319
  def binstubs(*gems)
@@ -282,7 +334,7 @@ module Bundler
282
334
  Add.new(options.dup, gem_name).run
283
335
  end
284
336
 
285
- desc "outdated GEM [OPTIONS]", "list installed gems with newer versions available"
337
+ desc "outdated GEM [OPTIONS]", "List installed gems with newer versions available"
286
338
  long_desc <<-D
287
339
  Outdated lists the names and versions of gems that have a newer version available
288
340
  in the given source. Calling outdated with [GEM [GEM]] will only check for newer
@@ -292,8 +344,8 @@ module Bundler
292
344
  For more information on patch level options (--major, --minor, --patch,
293
345
  --update-strict) see documentation on the same options on the update command.
294
346
  D
295
- method_option "group", :aliases => "--group", :type => :string, :banner => "List gems from a specific group"
296
- method_option "groups", :aliases => "--groups", :type => :boolean, :banner => "List gems organized by groups"
347
+ method_option "group", :type => :string, :banner => "List gems from a specific group"
348
+ method_option "groups", :type => :boolean, :banner => "List gems organized by groups"
297
349
  method_option "local", :type => :boolean, :banner =>
298
350
  "Do not attempt to fetch gems remotely and use the gem cache instead"
299
351
  method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
@@ -315,17 +367,27 @@ module Bundler
315
367
  Outdated.new(options, gems).run
316
368
  end
317
369
 
318
- desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true
319
- method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
320
- method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
321
- method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
322
- def cache
323
- require "bundler/cli/cache"
324
- Cache.new(options).run
370
+ if Bundler.feature_flag.cache_command_is_package?
371
+ map %w[cache] => :package
372
+ else
373
+ desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true
374
+ unless Bundler.feature_flag.cache_command_is_package?
375
+ method_option "all", :type => :boolean,
376
+ :banner => "Include all sources (including path and git)."
377
+ end
378
+ method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
379
+ method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
380
+ def cache
381
+ require "bundler/cli/cache"
382
+ Cache.new(options).run
383
+ end
325
384
  end
326
385
 
327
- desc "package [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
328
- method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
386
+ desc "#{Bundler.feature_flag.cache_command_is_package? ? :cache : :package} [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
387
+ unless Bundler.feature_flag.cache_command_is_package?
388
+ method_option "all", :type => :boolean,
389
+ :banner => "Include all sources (including path and git)."
390
+ end
329
391
  method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one"
330
392
  method_option "cache-path", :type => :string, :banner =>
331
393
  "Specify a different cache path than the default (vendor/cache)."
@@ -347,14 +409,14 @@ module Bundler
347
409
  require "bundler/cli/package"
348
410
  Package.new(options).run
349
411
  end
350
- map %w(pack) => :package
412
+ map %w[pack] => :package
351
413
 
352
414
  desc "exec [OPTIONS]", "Run the command in context of the bundle"
353
415
  method_option :keep_file_descriptors, :type => :boolean, :default => false
354
416
  long_desc <<-D
355
417
  Exec runs a command, providing it access to the gems in the bundle. While using
356
418
  bundle exec you can require and call the bundled gems as if they were installed
357
- into the system wide Rubygems repository.
419
+ into the system wide RubyGems repository.
358
420
  D
359
421
  map "e" => "exec"
360
422
  def exec(*args)
@@ -362,7 +424,7 @@ module Bundler
362
424
  Exec.new(options, args).run
363
425
  end
364
426
 
365
- desc "config NAME [VALUE]", "retrieve or set a configuration value"
427
+ desc "config NAME [VALUE]", "Retrieve or set a configuration value"
366
428
  long_desc <<-D
367
429
  Retrieves or sets a configuration value. If only one parameter is provided, retrieve the value. If two parameters are provided, replace the
368
430
  existing value with the newly provided one.
@@ -386,18 +448,28 @@ module Bundler
386
448
  Open.new(options, name).run
387
449
  end
388
450
 
389
- desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
390
- def console(group = nil)
391
- # TODO: Remove for 2.0
392
- require "bundler/cli/console"
393
- Console.new(options, group).run
451
+ if Bundler.feature_flag.console_command?
452
+ desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
453
+ def console(group = nil)
454
+ require "bundler/cli/console"
455
+ Console.new(options, group).run
456
+ end
394
457
  end
395
458
 
396
459
  desc "version", "Prints the bundler's version information"
397
460
  def version
398
- Bundler.ui.info "Bundler version #{Bundler::VERSION}"
461
+ cli_help = current_command.name == "cli_help"
462
+ if cli_help || ARGV.include?("version")
463
+ build_info = " (#{BuildMetadata.built_at} commit #{BuildMetadata.git_commit_sha})"
464
+ end
465
+
466
+ if !cli_help && Bundler.feature_flag.print_only_version_number?
467
+ Bundler.ui.info "#{Bundler::VERSION}#{build_info}"
468
+ else
469
+ Bundler.ui.info "Bundler version #{Bundler::VERSION}#{build_info}"
470
+ end
399
471
  end
400
- map %w(-v --version) => :version
472
+ map %w[-v --version] => :version
401
473
 
402
474
  desc "licenses", "Prints the license of all gems in the bundle"
403
475
  def licenses
@@ -413,7 +485,7 @@ module Bundler
413
485
  end
414
486
  end
415
487
 
416
- desc "viz [OPTIONS]", "Generates a visual dependency graph"
488
+ desc "viz [OPTIONS]", "Generates a visual dependency graph", :hide => true
417
489
  long_desc <<-D
418
490
  Viz generates a PNG file of the current Gemfile as a dependency graph.
419
491
  Viz requires the ruby-graphviz gem (and its dependencies).
@@ -431,7 +503,7 @@ module Bundler
431
503
 
432
504
  old_gem = instance_method(:gem)
433
505
 
434
- desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem"
506
+ desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
435
507
  method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library."
436
508
  method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`."
437
509
  method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
@@ -470,7 +542,7 @@ module Bundler
470
542
  File.expand_path(File.join(File.dirname(__FILE__), "templates"))
471
543
  end
472
544
 
473
- desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory"
545
+ desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true
474
546
  method_option "dry-run", :type => :boolean, :default => false, :banner =>
475
547
  "Only print out changes, do not clean gems"
476
548
  method_option "force", :type => :boolean, :default => false, :banner =>
@@ -488,13 +560,13 @@ module Bundler
488
560
  Platform.new(options).run
489
561
  end
490
562
 
491
- desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile"
563
+ desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", :hide => true
492
564
  method_option "source", :type => :string, :banner =>
493
565
  "Install gem from the given source"
494
566
  method_option "group", :type => :string, :banner =>
495
567
  "Install gem into a bundler group"
496
568
  def inject(name, version)
497
- SharedHelpers.major_deprecation "The `inject` command has been replaced by the `add` command"
569
+ SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
498
570
  require "bundler/cli/inject"
499
571
  Inject.new(options.dup, name, version).run
500
572
  end
@@ -531,7 +603,7 @@ module Bundler
531
603
 
532
604
  desc "env", "Print information about the environment Bundler is running under"
533
605
  def env
534
- Env.new.write($stdout)
606
+ Env.write($stdout)
535
607
  end
536
608
 
537
609
  desc "doctor [OPTIONS]", "Checks the bundle for common problems"
@@ -555,15 +627,20 @@ module Bundler
555
627
  Issue.new.run
556
628
  end
557
629
 
558
- desc "pristine", "Restores installed gems to pristine condition from files located in the gem cache. Gem installed from a git repository will be issued `git checkout --force`."
559
- def pristine
630
+ desc "pristine [GEMS...]", "Restores installed gems to pristine condition"
631
+ long_desc <<-D
632
+ Restores installed gems to pristine condition from files located in the
633
+ gem cache. Gems installed from a git repository will be issued `git
634
+ checkout --force`.
635
+ D
636
+ def pristine(*gems)
560
637
  require "bundler/cli/pristine"
561
- Pristine.new.run
638
+ Pristine.new(gems).run
562
639
  end
563
640
 
564
641
  if Bundler.feature_flag.plugins?
565
642
  require "bundler/cli/plugin"
566
- desc "plugin SUBCOMMAND ...ARGS", "manage the bundler plugins"
643
+ desc "plugin", "Manage the bundler plugins"
567
644
  subcommand "plugin", Plugin
568
645
  end
569
646
 
@@ -571,14 +648,14 @@ module Bundler
571
648
  # into the corresponding `bundle help #{command}` call
572
649
  def self.reformatted_help_args(args)
573
650
  bundler_commands = all_commands.keys
574
- help_flags = %w(--help -h)
575
- exec_commands = %w(e ex exe exec)
651
+ help_flags = %w[--help -h]
652
+ exec_commands = %w[e ex exe exec]
576
653
  help_used = args.index {|a| help_flags.include? a }
577
654
  exec_used = args.index {|a| exec_commands.include? a }
578
655
  command = args.find {|a| bundler_commands.include? a }
579
656
  if exec_used && help_used
580
657
  if exec_used + help_used == 1
581
- %w(help exec)
658
+ %w[help exec]
582
659
  else
583
660
  args
584
661
  end
@@ -613,16 +690,20 @@ module Bundler
613
690
  end
614
691
  end
615
692
 
693
+ def current_command
694
+ _, _, config = @_initializer
695
+ config[:current_command]
696
+ end
697
+
616
698
  def print_command
617
699
  return unless Bundler.ui.debug?
618
- _, _, config = @_initializer
619
- current_command = config[:current_command]
620
- command_name = current_command.name
700
+ cmd = current_command
701
+ command_name = cmd.name
621
702
  return if PARSEABLE_COMMANDS.include?(command_name)
622
703
  command = ["bundle", command_name] + args
623
704
  options_to_print = options.dup
624
705
  options_to_print.delete_if do |k, v|
625
- next unless o = current_command.options[k]
706
+ next unless o = cmd.options[k]
626
707
  o.default == v
627
708
  end
628
709
  command << Thor::Options.to_switches(options_to_print.sort_by(&:first)).strip
@@ -633,8 +714,6 @@ module Bundler
633
714
  def warn_on_outdated_bundler
634
715
  return if Bundler.settings[:disable_version_check]
635
716
 
636
- _, _, config = @_initializer
637
- current_command = config[:current_command]
638
717
  command_name = current_command.name
639
718
  return if PARSEABLE_COMMANDS.include?(command_name)
640
719
 
@@ -649,8 +728,17 @@ module Bundler
649
728
 
650
729
  current = Gem::Version.new(VERSION)
651
730
  return if current >= latest
731
+ latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max
732
+
733
+ installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
734
+ if latest_installed && latest_installed > current
735
+ suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
736
+ suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
737
+ else
738
+ suggestion = installation
739
+ end
652
740
 
653
- Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\nTo update, run `gem install bundler#{" --pre" if latest.prerelease?}`"
741
+ Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
654
742
  rescue
655
743
  nil
656
744
  end