bundler 1.13.6 → 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 (323) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +554 -9
  3. data/README.md +28 -5
  4. data/bundler.gemspec +40 -11
  5. data/exe/bundle +4 -8
  6. data/exe/bundle_ruby +4 -3
  7. data/lib/bundler.rb +162 -68
  8. data/lib/bundler/build_metadata.rb +53 -0
  9. data/lib/bundler/capistrano.rb +5 -0
  10. data/lib/bundler/cli.rb +360 -118
  11. data/lib/bundler/cli/add.rb +35 -0
  12. data/lib/bundler/cli/binstubs.rb +18 -10
  13. data/lib/bundler/cli/cache.rb +6 -5
  14. data/lib/bundler/cli/check.rb +4 -6
  15. data/lib/bundler/cli/clean.rb +6 -7
  16. data/lib/bundler/cli/common.rb +47 -1
  17. data/lib/bundler/cli/config.rb +26 -7
  18. data/lib/bundler/cli/console.rb +2 -1
  19. data/lib/bundler/cli/doctor.rb +63 -18
  20. data/lib/bundler/cli/exec.rb +12 -5
  21. data/lib/bundler/cli/gem.rb +59 -21
  22. data/lib/bundler/cli/info.rb +50 -0
  23. data/lib/bundler/cli/init.rb +21 -7
  24. data/lib/bundler/cli/inject.rb +13 -4
  25. data/lib/bundler/cli/install.rb +72 -101
  26. data/lib/bundler/cli/issue.rb +40 -0
  27. data/lib/bundler/cli/list.rb +58 -0
  28. data/lib/bundler/cli/lock.rb +9 -6
  29. data/lib/bundler/cli/open.rb +4 -3
  30. data/lib/bundler/cli/outdated.rb +175 -60
  31. data/lib/bundler/cli/package.rb +9 -6
  32. data/lib/bundler/cli/platform.rb +2 -1
  33. data/lib/bundler/cli/plugin.rb +1 -0
  34. data/lib/bundler/cli/pristine.rb +47 -0
  35. data/lib/bundler/cli/remove.rb +18 -0
  36. data/lib/bundler/cli/show.rb +2 -2
  37. data/lib/bundler/cli/update.rb +44 -34
  38. data/lib/bundler/cli/viz.rb +5 -1
  39. data/lib/bundler/compact_index_client.rb +109 -0
  40. data/lib/bundler/compact_index_client/cache.rb +118 -0
  41. data/lib/bundler/compact_index_client/updater.rb +116 -0
  42. data/lib/bundler/compatibility_guard.rb +14 -0
  43. data/lib/bundler/constants.rb +1 -0
  44. data/lib/bundler/current_ruby.rb +17 -8
  45. data/lib/bundler/definition.rb +353 -182
  46. data/lib/bundler/dep_proxy.rb +3 -1
  47. data/lib/bundler/dependency.rb +22 -10
  48. data/lib/bundler/deployment.rb +1 -1
  49. data/lib/bundler/deprecate.rb +15 -3
  50. data/lib/bundler/dsl.rb +122 -64
  51. data/lib/bundler/endpoint_specification.rb +13 -3
  52. data/lib/bundler/env.rb +110 -38
  53. data/lib/bundler/environment_preserver.rb +27 -6
  54. data/lib/bundler/errors.rb +24 -0
  55. data/lib/bundler/feature_flag.rb +74 -0
  56. data/lib/bundler/fetcher.rb +18 -11
  57. data/lib/bundler/fetcher/base.rb +1 -0
  58. data/lib/bundler/fetcher/compact_index.rb +7 -5
  59. data/lib/bundler/fetcher/dependency.rb +3 -2
  60. data/lib/bundler/fetcher/downloader.rb +25 -7
  61. data/lib/bundler/fetcher/index.rb +3 -2
  62. data/lib/bundler/friendly_errors.rb +33 -7
  63. data/lib/bundler/gem_helper.rb +25 -11
  64. data/lib/bundler/gem_helpers.rb +70 -1
  65. data/lib/bundler/gem_remote_fetcher.rb +1 -0
  66. data/lib/bundler/gem_tasks.rb +1 -0
  67. data/lib/bundler/gem_version_promoter.rb +17 -2
  68. data/lib/bundler/gemdeps.rb +29 -0
  69. data/lib/bundler/graph.rb +1 -0
  70. data/lib/bundler/index.rb +28 -15
  71. data/lib/bundler/injector.rb +216 -33
  72. data/lib/bundler/inline.rb +12 -12
  73. data/lib/bundler/installer.rb +139 -53
  74. data/lib/bundler/installer/gem_installer.rb +15 -5
  75. data/lib/bundler/installer/parallel_installer.rb +113 -28
  76. data/lib/bundler/installer/standalone.rb +1 -0
  77. data/lib/bundler/lazy_specification.rb +31 -3
  78. data/lib/bundler/lockfile_generator.rb +95 -0
  79. data/lib/bundler/lockfile_parser.rb +50 -37
  80. data/lib/bundler/match_platform.rb +13 -3
  81. data/lib/bundler/mirror.rb +10 -5
  82. data/lib/bundler/plugin.rb +22 -8
  83. data/lib/bundler/plugin/api.rb +2 -1
  84. data/lib/bundler/plugin/api/source.rb +17 -4
  85. data/lib/bundler/plugin/events.rb +61 -0
  86. data/lib/bundler/plugin/index.rb +9 -2
  87. data/lib/bundler/plugin/installer.rb +7 -6
  88. data/lib/bundler/plugin/source_list.rb +7 -8
  89. data/lib/bundler/process_lock.rb +24 -0
  90. data/lib/bundler/psyched_yaml.rb +10 -0
  91. data/lib/bundler/remote_specification.rb +30 -1
  92. data/lib/bundler/resolver.rb +187 -194
  93. data/lib/bundler/resolver/spec_group.rb +106 -0
  94. data/lib/bundler/retry.rb +5 -1
  95. data/lib/bundler/ruby_dsl.rb +1 -0
  96. data/lib/bundler/ruby_version.rb +12 -2
  97. data/lib/bundler/rubygems_ext.rb +23 -8
  98. data/lib/bundler/rubygems_gem_installer.rb +90 -0
  99. data/lib/bundler/rubygems_integration.rb +193 -70
  100. data/lib/bundler/runtime.rb +39 -22
  101. data/lib/bundler/settings.rb +245 -85
  102. data/lib/bundler/settings/validator.rb +102 -0
  103. data/lib/bundler/setup.rb +4 -7
  104. data/lib/bundler/shared_helpers.rb +183 -40
  105. data/lib/bundler/similarity_detector.rb +1 -0
  106. data/lib/bundler/source.rb +58 -1
  107. data/lib/bundler/source/gemspec.rb +1 -0
  108. data/lib/bundler/source/git.rb +52 -23
  109. data/lib/bundler/source/git/git_proxy.rb +30 -14
  110. data/lib/bundler/source/metadata.rb +62 -0
  111. data/lib/bundler/source/path.rb +42 -16
  112. data/lib/bundler/source/path/installer.rb +4 -2
  113. data/lib/bundler/source/rubygems.rb +171 -82
  114. data/lib/bundler/source/rubygems/remote.rb +12 -2
  115. data/lib/bundler/source_list.rb +75 -15
  116. data/lib/bundler/spec_set.rb +67 -32
  117. data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
  118. data/lib/bundler/stub_specification.rb +86 -2
  119. data/lib/bundler/templates/.document +1 -0
  120. data/lib/bundler/templates/Executable +13 -1
  121. data/lib/bundler/templates/Executable.bundler +105 -0
  122. data/lib/bundler/templates/Executable.standalone +5 -5
  123. data/lib/bundler/templates/Gemfile +3 -0
  124. data/lib/bundler/templates/gems.rb +8 -0
  125. data/lib/bundler/templates/newgem/Gemfile.tt +4 -2
  126. data/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
  127. data/lib/bundler/templates/newgem/README.md.tt +14 -8
  128. data/lib/bundler/templates/newgem/Rakefile.tt +5 -5
  129. data/lib/bundler/templates/newgem/bin/console.tt +1 -1
  130. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
  131. data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
  132. data/lib/bundler/templates/newgem/gitignore.tt +5 -1
  133. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -6
  134. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
  135. data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -12
  136. data/lib/bundler/templates/newgem/rspec.tt +1 -0
  137. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +1 -3
  138. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +13 -1
  139. data/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
  140. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
  141. data/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
  142. data/lib/bundler/ui.rb +1 -0
  143. data/lib/bundler/ui/rg_proxy.rb +1 -0
  144. data/lib/bundler/ui/shell.rb +30 -10
  145. data/lib/bundler/ui/silent.rb +21 -1
  146. data/lib/bundler/uri_credentials_filter.rb +1 -0
  147. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
  148. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
  149. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  150. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  151. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
  152. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +26 -6
  153. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +2 -1
  154. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +12 -4
  155. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +3 -2
  156. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
  157. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +11 -3
  158. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +13 -1
  159. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +3 -2
  160. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -2
  161. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +18 -5
  162. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -7
  163. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  164. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  165. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
  166. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +499 -128
  167. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
  168. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
  169. data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/faster.rb +1 -0
  170. data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +27 -24
  171. data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent/ssl_reuse.rb +2 -1
  172. data/lib/bundler/vendor/thor/lib/thor.rb +46 -21
  173. data/lib/bundler/vendor/thor/lib/thor/actions.rb +24 -22
  174. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +2 -1
  175. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  176. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
  177. data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
  178. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +66 -18
  179. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +17 -15
  180. data/lib/bundler/vendor/thor/lib/thor/base.rb +55 -32
  181. data/lib/bundler/vendor/thor/lib/thor/command.rb +13 -11
  182. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
  183. data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
  184. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
  185. data/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
  186. data/lib/bundler/vendor/thor/lib/thor/group.rb +13 -13
  187. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
  188. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
  189. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
  190. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
  191. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +42 -21
  192. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -10
  193. data/lib/bundler/vendor/thor/lib/thor/runner.rb +31 -29
  194. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  195. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +49 -33
  196. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
  197. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
  198. data/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
  199. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  200. data/lib/bundler/vendored_fileutils.rb +9 -0
  201. data/lib/bundler/vendored_molinillo.rb +1 -0
  202. data/lib/bundler/vendored_persistent.rb +43 -3
  203. data/lib/bundler/vendored_thor.rb +6 -2
  204. data/lib/bundler/version.rb +19 -2
  205. data/lib/bundler/version_ranges.rb +76 -0
  206. data/lib/bundler/vlad.rb +5 -0
  207. data/lib/bundler/worker.rb +30 -6
  208. data/lib/bundler/yaml_serializer.rb +4 -4
  209. data/man/bundle-add.1 +58 -0
  210. data/man/bundle-add.1.txt +52 -0
  211. data/man/bundle-add.ronn +40 -0
  212. data/{lib/bundler/man/bundle-binstubs → man/bundle-binstubs.1} +11 -1
  213. data/man/bundle-binstubs.1.txt +48 -0
  214. data/man/bundle-binstubs.ronn +15 -1
  215. data/man/bundle-check.1 +31 -0
  216. data/man/bundle-check.1.txt +33 -0
  217. data/man/bundle-check.ronn +26 -0
  218. data/man/bundle-clean.1 +24 -0
  219. data/man/bundle-clean.1.txt +26 -0
  220. data/man/bundle-clean.ronn +18 -0
  221. data/man/bundle-config.1 +497 -0
  222. data/man/bundle-config.1.txt +529 -0
  223. data/man/bundle-config.ronn +233 -61
  224. data/man/bundle-doctor.1 +44 -0
  225. data/man/bundle-doctor.1.txt +44 -0
  226. data/man/bundle-doctor.ronn +33 -0
  227. data/{lib/bundler/man/bundle-exec → man/bundle-exec.1} +6 -3
  228. data/man/bundle-exec.1.txt +178 -0
  229. data/man/bundle-exec.ronn +10 -3
  230. data/{lib/bundler/man/bundle-gem → man/bundle-gem.1} +4 -4
  231. data/man/bundle-gem.1.txt +91 -0
  232. data/man/bundle-gem.ronn +3 -2
  233. data/man/bundle-info.1 +20 -0
  234. data/man/bundle-info.1.txt +21 -0
  235. data/man/bundle-info.ronn +17 -0
  236. data/man/bundle-init.1 +25 -0
  237. data/man/bundle-init.1.txt +34 -0
  238. data/man/bundle-init.ronn +29 -0
  239. data/man/bundle-inject.1 +33 -0
  240. data/man/bundle-inject.1.txt +32 -0
  241. data/man/bundle-inject.ronn +22 -0
  242. data/{lib/bundler/man/bundle-install → man/bundle-install.1} +32 -29
  243. data/man/bundle-install.1.txt +396 -0
  244. data/man/bundle-install.ronn +45 -36
  245. data/man/bundle-list.1 +50 -0
  246. data/man/bundle-list.1.txt +43 -0
  247. data/man/bundle-list.ronn +33 -0
  248. data/{lib/bundler/man/bundle-lock → man/bundle-lock.1} +43 -2
  249. data/man/bundle-lock.1.txt +93 -0
  250. data/man/bundle-lock.ronn +47 -0
  251. data/man/bundle-open.1 +32 -0
  252. data/man/bundle-open.1.txt +29 -0
  253. data/man/bundle-open.ronn +19 -0
  254. data/man/bundle-outdated.1 +155 -0
  255. data/man/bundle-outdated.1.txt +131 -0
  256. data/man/bundle-outdated.ronn +111 -0
  257. data/{lib/bundler/man/bundle-package → man/bundle-package.1} +6 -3
  258. data/man/bundle-package.1.txt +79 -0
  259. data/man/bundle-package.ronn +7 -2
  260. data/{lib/bundler/man/bundle-platform → man/bundle-platform.1} +1 -1
  261. data/man/bundle-platform.1.txt +57 -0
  262. data/man/bundle-pristine.1 +34 -0
  263. data/man/bundle-pristine.1.txt +44 -0
  264. data/man/bundle-pristine.ronn +34 -0
  265. data/man/bundle-remove.1 +31 -0
  266. data/man/bundle-remove.1.txt +34 -0
  267. data/man/bundle-remove.ronn +23 -0
  268. data/man/bundle-show.1 +23 -0
  269. data/man/bundle-show.1.txt +27 -0
  270. data/man/bundle-show.ronn +21 -0
  271. data/man/bundle-update.1 +394 -0
  272. data/man/bundle-update.1.txt +391 -0
  273. data/man/bundle-update.ronn +172 -16
  274. data/man/bundle-viz.1 +39 -0
  275. data/man/bundle-viz.1.txt +39 -0
  276. data/man/bundle-viz.ronn +30 -0
  277. data/{lib/bundler/man/bundle → man/bundle.1} +44 -28
  278. data/man/bundle.1.txt +116 -0
  279. data/man/bundle.ronn +39 -27
  280. data/{lib/bundler/man → man}/gemfile.5 +67 -84
  281. data/man/gemfile.5.ronn +77 -55
  282. data/man/gemfile.5.txt +653 -0
  283. data/man/index.txt +25 -8
  284. metadata +118 -58
  285. data/.codeclimate.yml +0 -25
  286. data/.gitignore +0 -16
  287. data/.rspec +0 -3
  288. data/.rubocop.yml +0 -128
  289. data/.rubocop_todo.yml +0 -248
  290. data/.travis.yml +0 -108
  291. data/CODE_OF_CONDUCT.md +0 -42
  292. data/CONTRIBUTING.md +0 -36
  293. data/DEVELOPMENT.md +0 -148
  294. data/ISSUES.md +0 -100
  295. data/Rakefile +0 -333
  296. data/bin/rake +0 -19
  297. data/bin/rspec +0 -15
  298. data/bin/rubocop +0 -17
  299. data/bin/with_rubygems +0 -39
  300. data/lib/bundler/man/bundle-binstubs.txt +0 -33
  301. data/lib/bundler/man/bundle-config +0 -254
  302. data/lib/bundler/man/bundle-config.txt +0 -282
  303. data/lib/bundler/man/bundle-exec.txt +0 -171
  304. data/lib/bundler/man/bundle-gem.txt +0 -90
  305. data/lib/bundler/man/bundle-install.txt +0 -385
  306. data/lib/bundler/man/bundle-lock.txt +0 -52
  307. data/lib/bundler/man/bundle-package.txt +0 -74
  308. data/lib/bundler/man/bundle-platform.txt +0 -57
  309. data/lib/bundler/man/bundle-update +0 -221
  310. data/lib/bundler/man/bundle-update.txt +0 -227
  311. data/lib/bundler/man/bundle.txt +0 -104
  312. data/lib/bundler/man/gemfile.5.txt +0 -636
  313. data/lib/bundler/postit_trampoline.rb +0 -68
  314. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +0 -79
  315. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +0 -112
  316. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +0 -80
  317. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +0 -4
  318. data/lib/bundler/vendor/postit/lib/postit.rb +0 -15
  319. data/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
  320. data/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
  321. data/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
  322. data/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
  323. data/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
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,10 +12,19 @@ It does this by managing the gems that the application depends on. Given a list
11
12
 
12
13
  ### Installation and usage
13
14
 
15
+ To install (or update to the latest version):
16
+
14
17
  ```
15
18
  gem install bundler
19
+ ```
20
+
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:
24
+
25
+ ```
16
26
  bundle init
17
- echo 'gem "rspec"' >> Gemfile
27
+ bundle add rspec
18
28
  bundle install
19
29
  bundle exec rspec
20
30
  ```
@@ -23,18 +33,31 @@ See [bundler.io](http://bundler.io) for the full documentation.
23
33
 
24
34
  ### Troubleshooting
25
35
 
26
- For help with common problems, see [ISSUES](https://github.com/bundler/bundler/blob/master/ISSUES.md).
36
+ For help with common problems, see [TROUBLESHOOTING](doc/TROUBLESHOOTING.md).
37
+
38
+ Still stuck? Try [filing an issue](doc/contributing/ISSUES.md).
27
39
 
28
40
  ### Other questions
29
41
 
30
- To see what has changed in recent versions of Bundler, see the [CHANGELOG](https://github.com/bundler/bundler/blob/master/CHANGELOG.md).
42
+ To see what has changed in recent versions of Bundler, see the [CHANGELOG](CHANGELOG.md).
31
43
 
32
- Feel free to chat with the Bundler core team (and many other users) on IRC in the [#bundler](irc://irc.freenode.net/bundler) channel on Freenode, or via email on the [Bundler mailing list](http://groups.google.com/group/ruby-bundler).
44
+ To get in touch with the Bundler core team and other Bundler users, please see [getting help](doc/contributing/GETTING_HELP.md).
33
45
 
34
46
  ### Contributing
35
47
 
36
- 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 [DEVELOPMENT](https://github.com/bundler/bundler/blob/master/DEVELOPMENT.md).
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).
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.
37
56
 
38
57
  ### Code of Conduct
39
58
 
40
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).
60
+
61
+ ### License
62
+
63
+ [MIT License](https://github.com/bundler/bundler/blob/master/LICENSE.md)
data/bundler.gemspec CHANGED
@@ -1,35 +1,64 @@
1
1
  # coding: utf-8
2
2
  # frozen_string_literal: true
3
- lib = File.expand_path("../lib/", __FILE__)
4
- $:.unshift lib unless $:.include?(lib)
5
- require "bundler/version"
3
+
4
+ begin
5
+ require File.expand_path("../lib/bundler/version", __FILE__)
6
+ rescue LoadError
7
+ # for Ruby core repository
8
+ require File.expand_path("../bundler/version", __FILE__)
9
+ end
10
+
11
+ require "shellwords"
6
12
 
7
13
  Gem::Specification.new do |s|
8
14
  s.name = "bundler"
9
15
  s.version = Bundler::VERSION
10
- s.licenses = ["MIT"]
11
- s.authors = ["André Arko", "Samuel Giddins"]
16
+ s.license = "MIT"
17
+ s.authors = [
18
+ "André Arko", "Samuel Giddins", "Colby Swandale", "Hiroshi Shibata",
19
+ "David Rodríguez", "Grey Baker", "Stephanie Morillo", "Chris Morris", "James Wen", "Tim Moore",
20
+ "André Medeiros", "Jessica Lynn Suttles", "Terence Lee", "Carl Lerche",
21
+ "Yehuda Katz"
22
+ ]
12
23
  s.email = ["team@bundler.io"]
13
24
  s.homepage = "http://bundler.io"
14
25
  s.summary = "The best way to manage your application's dependencies"
15
26
  s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
16
27
 
17
- s.required_ruby_version = ">= 1.8.7"
18
- s.required_rubygems_version = ">= 1.3.6"
28
+ if s.respond_to?(:metadata=)
29
+ s.metadata = {
30
+ "bug_tracker_uri" => "http://github.com/bundler/bundler/issues",
31
+ "changelog_uri" => "https://github.com/bundler/bundler/blob/master/CHANGELOG.md",
32
+ "homepage_uri" => "https://bundler.io/",
33
+ "source_code_uri" => "http://github.com/bundler/bundler/",
34
+ }
35
+ end
36
+
37
+ if s.version >= Gem::Version.new("2.a".dup)
38
+ s.required_ruby_version = ">= 2.3.0"
39
+ s.required_rubygems_version = ">= 2.5.0"
40
+ else
41
+ s.required_ruby_version = ">= 1.8.7"
42
+ s.required_rubygems_version = ">= 1.3.6"
43
+ end
19
44
 
20
45
  s.add_development_dependency "automatiek", "~> 0.1.0"
21
46
  s.add_development_dependency "mustache", "0.99.6"
22
47
  s.add_development_dependency "rake", "~> 10.0"
23
48
  s.add_development_dependency "rdiscount", "~> 2.2"
24
49
  s.add_development_dependency "ronn", "~> 0.7.3"
25
- s.add_development_dependency "rspec", "~> 3.5"
50
+ s.add_development_dependency "rspec", "~> 3.6"
26
51
 
27
- s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
52
+ s.files = `git ls-files -z`.split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }
28
53
  # we don't check in man pages, but we need to ship them because
29
54
  # we use them to generate the long-form help for each command.
30
- s.files += Dir.glob("lib/bundler/man/**/*")
55
+ s.files += Dir.glob("man/**/*")
56
+ # Include the CHANGELOG.md, LICENSE.md, README.md manually
57
+ s.files += %w[CHANGELOG.md LICENSE.md README.md]
58
+ # include the gemspec itself because warbler breaks w/o it
59
+ s.files += %w[bundler.gemspec]
31
60
 
32
61
  s.bindir = "exe"
33
- s.executables = %w(bundle bundler)
62
+ s.executables = %w[bundle bundler]
34
63
  s.require_paths = ["lib"]
35
64
  end
data/exe/bundle CHANGED
@@ -2,13 +2,9 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  # Exit cleanly from an early interrupt
5
- Signal.trap("INT") { exit 1 }
6
-
7
- unless ENV["BUNDLE_DISABLE_POSTIT"]
8
- update = "update".start_with?(ARGV.first || " ") && ARGV.find {|a| a.start_with?("--bundler") }
9
- update &&= update =~ /--bundler(?:=(.+))?/ && $1 || "> 0.a"
10
- ENV["BUNDLER_VERSION"] = update if update
11
- require "bundler/postit_trampoline"
5
+ Signal.trap("INT") do
6
+ Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler)
7
+ exit 1
12
8
  end
13
9
 
14
10
  require "bundler"
@@ -27,7 +23,7 @@ Bundler.with_friendly_errors do
27
23
  require "bundler/cli"
28
24
 
29
25
  # Allow any command to use --help flag to show help for that command
30
- help_flags = %w(--help -h)
26
+ help_flags = %w[--help -h]
31
27
  help_flag_used = ARGV.any? {|a| help_flags.include? a }
32
28
  args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV
33
29
 
data/exe/bundle_ruby CHANGED
@@ -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)
data/lib/bundler.rb CHANGED
@@ -1,20 +1,24 @@
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"
9
+
6
10
  require "bundler/errors"
7
11
  require "bundler/environment_preserver"
8
- require "bundler/gem_remote_fetcher"
9
12
  require "bundler/plugin"
10
13
  require "bundler/rubygems_ext"
11
14
  require "bundler/rubygems_integration"
12
15
  require "bundler/version"
13
16
  require "bundler/constants"
14
17
  require "bundler/current_ruby"
18
+ require "bundler/build_metadata"
15
19
 
16
20
  module Bundler
17
- environment_preserver = EnvironmentPreserver.new(ENV, %w(PATH GEM_PATH))
21
+ environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
18
22
  ORIGINAL_ENV = environment_preserver.restore
19
23
  ENV.replace(environment_preserver.backup)
20
24
  SUDO_MUTEX = Mutex.new
@@ -27,8 +31,10 @@ module Bundler
27
31
  autoload :EndpointSpecification, "bundler/endpoint_specification"
28
32
  autoload :Env, "bundler/env"
29
33
  autoload :Fetcher, "bundler/fetcher"
34
+ autoload :FeatureFlag, "bundler/feature_flag"
30
35
  autoload :GemHelper, "bundler/gem_helper"
31
36
  autoload :GemHelpers, "bundler/gem_helpers"
37
+ autoload :GemRemoteFetcher, "bundler/gem_remote_fetcher"
32
38
  autoload :GemVersionPromoter, "bundler/gem_version_promoter"
33
39
  autoload :Graph, "bundler/graph"
34
40
  autoload :Index, "bundler/index"
@@ -37,8 +43,7 @@ module Bundler
37
43
  autoload :LazySpecification, "bundler/lazy_specification"
38
44
  autoload :LockfileParser, "bundler/lockfile_parser"
39
45
  autoload :MatchPlatform, "bundler/match_platform"
40
- autoload :Mirror, "bundler/mirror"
41
- autoload :Mirrors, "bundler/mirror"
46
+ autoload :ProcessLock, "bundler/process_lock"
42
47
  autoload :RemoteSpecification, "bundler/remote_specification"
43
48
  autoload :Resolver, "bundler/resolver"
44
49
  autoload :Retry, "bundler/retry"
@@ -54,10 +59,9 @@ module Bundler
54
59
  autoload :StubSpecification, "bundler/stub_specification"
55
60
  autoload :UI, "bundler/ui"
56
61
  autoload :URICredentialsFilter, "bundler/uri_credentials_filter"
62
+ autoload :VersionRanges, "bundler/version_ranges"
57
63
 
58
64
  class << self
59
- attr_writer :bundle_path
60
-
61
65
  def configure
62
66
  @configured ||= configure_gem_home_and_path
63
67
  end
@@ -73,7 +77,11 @@ module Bundler
73
77
 
74
78
  # Returns absolute path of where gems are installed on the filesystem.
75
79
  def bundle_path
76
- @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!)
77
85
  end
78
86
 
79
87
  # Returns absolute location of where binstubs are installed to.
@@ -90,7 +98,7 @@ module Bundler
90
98
  # Return if all groups are already loaded
91
99
  return @setup if defined?(@setup) && @setup
92
100
 
93
- definition.validate_ruby!
101
+ definition.validate_runtime!
94
102
 
95
103
  SharedHelpers.print_major_deprecations!
96
104
 
@@ -111,7 +119,7 @@ module Bundler
111
119
  end
112
120
 
113
121
  def environment
114
- 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"
115
123
  load
116
124
  end
117
125
 
@@ -128,11 +136,17 @@ module Bundler
128
136
  end
129
137
  end
130
138
 
139
+ def frozen_bundle?
140
+ frozen = settings[:deployment]
141
+ frozen ||= settings[:frozen] unless feature_flag.deployment_means_frozen?
142
+ frozen
143
+ end
144
+
131
145
  def locked_gems
132
146
  @locked_gems ||=
133
147
  if defined?(@definition) && @definition
134
148
  definition.locked_gems
135
- elsif Bundler.default_lockfile.exist?
149
+ elsif Bundler.default_lockfile.file?
136
150
  lock = Bundler.read_file(Bundler.default_lockfile)
137
151
  LockfileParser.new(lock)
138
152
  end
@@ -142,8 +156,65 @@ module Bundler
142
156
  "#{Bundler.rubygems.ruby_engine}/#{Bundler.rubygems.config_map[:ruby_version]}"
143
157
  end
144
158
 
145
- def user_bundle_path
146
- Pathname.new(Bundler.rubygems.user_home).join(".bundle")
159
+ def user_home
160
+ @user_home ||= begin
161
+ home = Bundler.rubygems.user_home
162
+ bundle_home = home ? File.join(home, ".bundle") : nil
163
+
164
+ warning = if home.nil?
165
+ "Your home directory is not set."
166
+ elsif !File.directory?(home)
167
+ "`#{home}` is not a directory."
168
+ elsif !File.writable?(home) && (!File.directory?(bundle_home) || !File.writable?(bundle_home))
169
+ "`#{home}` is not writable."
170
+ end
171
+
172
+ if warning
173
+ Kernel.send(:require, "etc")
174
+ user_home = tmp_home_path(Etc.getlogin, warning)
175
+ Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
176
+ user_home
177
+ else
178
+ Pathname.new(home)
179
+ end
180
+ end
181
+ end
182
+
183
+ def tmp_home_path(login, warning)
184
+ login ||= "unknown"
185
+ Kernel.send(:require, "tmpdir")
186
+ path = Pathname.new(Dir.tmpdir).join("bundler", "home")
187
+ SharedHelpers.filesystem_access(path) do |tmp_home_path|
188
+ unless tmp_home_path.exist?
189
+ tmp_home_path.mkpath
190
+ tmp_home_path.chmod(0o777)
191
+ end
192
+ tmp_home_path.join(login).tap(&:mkpath)
193
+ end
194
+ rescue RuntimeError => e
195
+ raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
196
+ end
197
+
198
+ def user_bundle_path(dir = "home")
199
+ env_var, fallback = case dir
200
+ when "home"
201
+ ["BUNDLE_USER_HOME", Pathname.new(user_home).join(".bundle")]
202
+ when "cache"
203
+ ["BUNDLE_USER_CACHE", user_bundle_path.join("cache")]
204
+ when "config"
205
+ ["BUNDLE_USER_CONFIG", user_bundle_path.join("config")]
206
+ when "plugin"
207
+ ["BUNDLE_USER_PLUGIN", user_bundle_path.join("plugin")]
208
+ else
209
+ raise BundlerError, "Unknown user path requested: #{dir}"
210
+ end
211
+ # `fallback` will already be a Pathname, but Pathname.new() is
212
+ # idempotent so it's OK
213
+ Pathname.new(ENV.fetch(env_var, fallback))
214
+ end
215
+
216
+ def user_cache
217
+ user_bundle_path("cache")
147
218
  end
148
219
 
149
220
  def home
@@ -158,17 +229,9 @@ module Bundler
158
229
  bundle_path.join("specifications")
159
230
  end
160
231
 
161
- def cache
162
- bundle_path.join("cache/bundler")
163
- end
164
-
165
- def user_cache
166
- user_bundle_path.join("cache")
167
- end
168
-
169
232
  def root
170
233
  @root ||= begin
171
- default_gemfile.dirname.expand_path
234
+ SharedHelpers.root
172
235
  rescue GemfileNotFound
173
236
  bundle_dir = default_bundle_dir
174
237
  raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir
@@ -177,8 +240,8 @@ module Bundler
177
240
  end
178
241
 
179
242
  def app_config_path
180
- if ENV["BUNDLE_APP_CONFIG"]
181
- Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root)
243
+ if app_config = ENV["BUNDLE_APP_CONFIG"]
244
+ Pathname.new(app_config).expand_path(root)
182
245
  else
183
246
  root.join(".bundle")
184
247
  end
@@ -186,10 +249,11 @@ module Bundler
186
249
 
187
250
  def app_cache(custom_path = nil)
188
251
  path = custom_path || root
189
- path.join(settings.app_cache_path)
252
+ Pathname.new(path).join(settings.app_cache_path)
190
253
  end
191
254
 
192
255
  def tmp(name = Process.pid.to_s)
256
+ Kernel.send(:require, "tmpdir")
193
257
  Pathname.new(Dir.mktmpdir(["bundler", name]))
194
258
  end
195
259
 
@@ -219,7 +283,7 @@ EOF
219
283
  # @deprecated Use `original_env` instead
220
284
  # @return [Hash] Environment with all bundler-related variables removed
221
285
  def clean_env
222
- Bundler::SharedHelpers.major_deprecation("`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
286
+ Bundler::SharedHelpers.major_deprecation(2, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
223
287
  env = original_env
224
288
 
225
289
  if env.key?("BUNDLER_ORIG_MANPATH")
@@ -257,6 +321,11 @@ EOF
257
321
  with_clean_env { Kernel.exec(*args) }
258
322
  end
259
323
 
324
+ def local_platform
325
+ return Gem::Platform::RUBY if settings[:force_ruby_platform]
326
+ Gem::Platform.local
327
+ end
328
+
260
329
  def default_gemfile
261
330
  SharedHelpers.default_gemfile
262
331
  end
@@ -270,21 +339,25 @@ EOF
270
339
  end
271
340
 
272
341
  def system_bindir
273
- # Gem.bindir doesn't always return the location that Rubygems will install
274
- # system binaries. If you put '-n foo' in your .gemrc, Rubygems will
275
- # install binstubs there instead. Unfortunately, Rubygems doesn't expose
342
+ # Gem.bindir doesn't always return the location that RubyGems will install
343
+ # system binaries. If you put '-n foo' in your .gemrc, RubyGems will
344
+ # install binstubs there instead. Unfortunately, RubyGems doesn't expose
276
345
  # that directory at all, so rather than parse .gemrc ourselves, we allow
277
346
  # the directory to be set as well, via `bundle config bindir foo`.
278
347
  Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
279
348
  end
280
349
 
350
+ def use_system_gems?
351
+ configured_bundle_path.use_system_gems?
352
+ end
353
+
281
354
  def requires_sudo?
282
355
  return @requires_sudo if defined?(@requires_sudo_ran)
283
356
 
284
357
  sudo_present = which "sudo" if settings.allow_sudo?
285
358
 
286
359
  if sudo_present
287
- # the bundle path and subdirectories need to be writable for Rubygems
360
+ # the bundle path and subdirectories need to be writable for RubyGems
288
361
  # to be able to unpack and install gems without exploding
289
362
  path = bundle_path
290
363
  path = path.parent until path.exist?
@@ -294,16 +367,20 @@ EOF
294
367
  bin_dir = bin_dir.parent until bin_dir.exist?
295
368
 
296
369
  # if any directory is not writable, we need sudo
297
- files = [path, bin_dir] | Dir[path.join("build_info/*").to_s] | Dir[path.join("*").to_s]
298
- sudo_needed = files.any? {|f| !File.writable?(f) }
370
+ files = [path, bin_dir] | Dir[bundle_path.join("build_info/*").to_s] | Dir[bundle_path.join("*").to_s]
371
+ unwritable_files = files.reject {|f| File.writable?(f) }
372
+ sudo_needed = !unwritable_files.empty?
373
+ if sudo_needed
374
+ Bundler.ui.warn "Following files may not be writable, so sudo is needed:\n #{unwritable_files.map(&:to_s).sort.join("\n ")}"
375
+ end
299
376
  end
300
377
 
301
378
  @requires_sudo_ran = true
302
379
  @requires_sudo = settings.allow_sudo? && sudo_present && sudo_needed
303
380
  end
304
381
 
305
- def mkdir_p(path)
306
- if requires_sudo?
382
+ def mkdir_p(path, options = {})
383
+ if requires_sudo? && !options[:no_sudo]
307
384
  sudo "mkdir -p '#{path}'" unless File.exist?(path)
308
385
  else
309
386
  SharedHelpers.filesystem_access(path, :write) do |p|
@@ -328,28 +405,36 @@ EOF
328
405
  def sudo(str)
329
406
  SUDO_MUTEX.synchronize do
330
407
  prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " "
331
- Your user account isn't allowed to install to the system Rubygems.
408
+ Your user account isn't allowed to install to the system RubyGems.
332
409
  You can cancel this installation and run:
333
410
 
334
411
  bundle install --path vendor/bundle
335
412
 
336
413
  to install the gems into ./vendor/bundle/, or you can enter your password
337
- and install the bundled gems to Rubygems using sudo.
414
+ and install the bundled gems to RubyGems using sudo.
338
415
 
339
416
  Password:
340
417
  PROMPT
341
418
 
419
+ unless @prompted_for_sudo ||= system(%(sudo -k -p "#{prompt}" true))
420
+ raise SudoNotPermittedError,
421
+ "Bundler requires sudo access to install at the moment. " \
422
+ "Try installing again, granting Bundler sudo access when prompted, or installing into a different path."
423
+ end
424
+
342
425
  `sudo -p "#{prompt}" #{str}`
343
426
  end
344
427
  end
345
428
 
346
429
  def read_file(file)
347
- File.open(file, "rb", &:read)
430
+ SharedHelpers.filesystem_access(file, :read) do
431
+ File.open(file, "r:UTF-8", &:read)
432
+ end
348
433
  end
349
434
 
350
435
  def load_marshal(data)
351
436
  Marshal.load(data)
352
- rescue => e
437
+ rescue StandardError => e
353
438
  raise MarshalError, "#{e.class}: #{e.message}"
354
439
  end
355
440
 
@@ -364,20 +449,20 @@ EOF
364
449
 
365
450
  def load_gemspec_uncached(file, validate = false)
366
451
  path = Pathname.new(file)
367
- # Eval the gemspec from its parent directory, because some gemspecs
368
- # depend on "./" relative paths.
369
- SharedHelpers.chdir(path.dirname.to_s) do
370
- contents = path.read
371
- spec = if contents[0..2] == "---" # YAML header
372
- eval_yaml_gemspec(path, contents)
373
- else
452
+ contents = read_file(file)
453
+ spec = if contents.start_with?("---") # YAML header
454
+ eval_yaml_gemspec(path, contents)
455
+ else
456
+ # Eval the gemspec from its parent directory, because some gemspecs
457
+ # depend on "./" relative paths.
458
+ SharedHelpers.chdir(path.dirname.to_s) do
374
459
  eval_gemspec(path, contents)
375
460
  end
376
- return unless spec
377
- spec.loaded_from = path.expand_path.to_s
378
- Bundler.rubygems.validate(spec) if validate
379
- spec
380
461
  end
462
+ return unless spec
463
+ spec.loaded_from = path.expand_path.to_s
464
+ Bundler.rubygems.validate(spec) if validate
465
+ spec
381
466
  end
382
467
 
383
468
  def clear_gemspec_cache
@@ -389,18 +474,32 @@ EOF
389
474
  @git_present = Bundler.which("git") || Bundler.which("git.exe")
390
475
  end
391
476
 
477
+ def feature_flag
478
+ @feature_flag ||= FeatureFlag.new(VERSION)
479
+ end
480
+
392
481
  def reset!
393
- @root = nil
394
- @settings = nil
482
+ reset_paths!
483
+ Plugin.reset!
484
+ reset_rubygems!
485
+ end
486
+
487
+ def reset_paths!
488
+ @bin_path = nil
489
+ @bundler_major_version = nil
490
+ @bundle_path = nil
491
+ @configured = nil
492
+ @configured_bundle_path = nil
395
493
  @definition = nil
396
- @setup = nil
397
494
  @load = nil
398
495
  @locked_gems = nil
399
- @bundle_path = nil
400
- @bin_path = nil
401
-
402
- Plugin.reset!
496
+ @root = nil
497
+ @settings = nil
498
+ @setup = nil
499
+ @user_home = nil
500
+ end
403
501
 
502
+ def reset_rubygems!
404
503
  return unless defined?(@rubygems) && @rubygems
405
504
  rubygems.undo_replacements
406
505
  rubygems.reset
@@ -410,6 +509,8 @@ EOF
410
509
  private
411
510
 
412
511
  def eval_yaml_gemspec(path, contents)
512
+ Kernel.send(:require, "bundler/psyched_yaml")
513
+
413
514
  # If the YAML is invalid, Syck raises an ArgumentError, and Psych
414
515
  # raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
415
516
  Gem::Specification.from_yaml(contents)
@@ -418,7 +519,7 @@ EOF
418
519
  end
419
520
 
420
521
  def eval_gemspec(path, contents)
421
- eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
522
+ eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
422
523
  rescue ScriptError, StandardError => e
423
524
  msg = "There was an error while loading `#{path.basename}`: #{e.message}"
424
525
 
@@ -435,14 +536,14 @@ EOF
435
536
  bundle_path
436
537
  end
437
538
 
438
- def configure_gem_path(env = ENV, settings = self.settings)
539
+ def configure_gem_path(env = ENV)
439
540
  blank_home = env["GEM_HOME"].nil? || env["GEM_HOME"].empty?
440
- if settings[:disable_shared_gems]
541
+ if !use_system_gems?
441
542
  # this needs to be empty string to cause
442
543
  # PathSupport.split_gem_path to only load up the
443
544
  # Bundler --path setting as the GEM_PATH.
444
545
  env["GEM_PATH"] = ""
445
- elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s
546
+ elsif blank_home
446
547
  possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
447
548
  paths = possibles.flatten.compact.uniq.reject(&:empty?)
448
549
  env["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
@@ -450,14 +551,7 @@ EOF
450
551
  end
451
552
 
452
553
  def configure_gem_home
453
- # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
454
- begin
455
- FileUtils.mkdir_p bundle_path.to_s
456
- rescue
457
- nil
458
- end
459
-
460
- ENV["GEM_HOME"] = File.expand_path(bundle_path, root)
554
+ Bundler::SharedHelpers.set_env "GEM_HOME", File.expand_path(bundle_path, root)
461
555
  Bundler.rubygems.clear_paths
462
556
  end
463
557