rubygems-update 2.6.14 → 2.7.0

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

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (347) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -7
  3. data/CONTRIBUTING.rdoc +53 -54
  4. data/History.txt +173 -9
  5. data/Manifest.txt +39 -11
  6. data/POLICIES.rdoc +3 -3
  7. data/README.md +72 -0
  8. data/Rakefile +30 -5
  9. data/appveyor.yml +29 -1
  10. data/bin/gem +1 -1
  11. data/bin/update_rubygems +2 -2
  12. data/bundler/CHANGELOG.md +269 -9
  13. data/bundler/CODE_OF_CONDUCT.md +1 -1
  14. data/bundler/CONTRIBUTING.md +10 -29
  15. data/bundler/README.md +22 -10
  16. data/bundler/exe/bundle +5 -7
  17. data/bundler/exe/bundle_ruby +4 -3
  18. data/bundler/lib/bundler.rb +94 -74
  19. data/bundler/lib/bundler/build_metadata.rb +36 -0
  20. data/bundler/lib/bundler/capistrano.rb +5 -0
  21. data/bundler/lib/bundler/cli.rb +229 -66
  22. data/bundler/lib/bundler/cli/add.rb +25 -0
  23. data/bundler/lib/bundler/cli/binstubs.rb +9 -7
  24. data/bundler/lib/bundler/cli/cache.rb +5 -4
  25. data/bundler/lib/bundler/cli/check.rb +3 -5
  26. data/bundler/lib/bundler/cli/clean.rb +5 -6
  27. data/bundler/lib/bundler/cli/common.rb +18 -2
  28. data/bundler/lib/bundler/cli/config.rb +26 -7
  29. data/bundler/lib/bundler/cli/console.rb +2 -1
  30. data/bundler/lib/bundler/cli/doctor.rb +1 -0
  31. data/bundler/lib/bundler/cli/exec.rb +3 -2
  32. data/bundler/lib/bundler/cli/gem.rb +36 -15
  33. data/bundler/lib/bundler/cli/info.rb +50 -0
  34. data/bundler/lib/bundler/cli/init.rb +20 -7
  35. data/bundler/lib/bundler/cli/inject.rb +13 -4
  36. data/bundler/lib/bundler/cli/install.rb +61 -77
  37. data/bundler/lib/bundler/cli/issue.rb +40 -0
  38. data/bundler/lib/bundler/cli/list.rb +22 -0
  39. data/bundler/lib/bundler/cli/lock.rb +4 -2
  40. data/bundler/lib/bundler/cli/open.rb +2 -2
  41. data/bundler/lib/bundler/cli/outdated.rb +30 -28
  42. data/bundler/lib/bundler/cli/package.rb +9 -6
  43. data/bundler/lib/bundler/cli/platform.rb +1 -0
  44. data/bundler/lib/bundler/cli/plugin.rb +1 -0
  45. data/bundler/lib/bundler/cli/pristine.rb +43 -0
  46. data/bundler/lib/bundler/cli/show.rb +1 -1
  47. data/bundler/lib/bundler/cli/update.rb +32 -11
  48. data/bundler/lib/bundler/cli/viz.rb +5 -1
  49. data/bundler/lib/bundler/compact_index_client.rb +1 -0
  50. data/bundler/lib/bundler/compact_index_client/cache.rb +1 -2
  51. data/bundler/lib/bundler/compact_index_client/updater.rb +26 -7
  52. data/bundler/lib/bundler/compatibility_guard.rb +14 -0
  53. data/bundler/lib/bundler/constants.rb +1 -0
  54. data/bundler/lib/bundler/current_ruby.rb +8 -7
  55. data/bundler/lib/bundler/definition.rb +231 -159
  56. data/bundler/lib/bundler/dep_proxy.rb +2 -0
  57. data/bundler/lib/bundler/dependency.rb +6 -7
  58. data/bundler/lib/bundler/deployment.rb +1 -1
  59. data/bundler/lib/bundler/deprecate.rb +14 -3
  60. data/bundler/lib/bundler/dsl.rb +103 -62
  61. data/bundler/lib/bundler/endpoint_specification.rb +12 -2
  62. data/bundler/lib/bundler/env.rb +97 -36
  63. data/bundler/lib/bundler/environment_preserver.rb +27 -6
  64. data/bundler/lib/bundler/errors.rb +3 -1
  65. data/bundler/lib/bundler/feature_flag.rb +39 -4
  66. data/bundler/lib/bundler/fetcher.rb +15 -8
  67. data/bundler/lib/bundler/fetcher/base.rb +1 -0
  68. data/bundler/lib/bundler/fetcher/compact_index.rb +2 -12
  69. data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
  70. data/bundler/lib/bundler/fetcher/downloader.rb +4 -2
  71. data/bundler/lib/bundler/fetcher/index.rb +1 -0
  72. data/bundler/lib/bundler/friendly_errors.rb +5 -2
  73. data/bundler/lib/bundler/gem_helper.rb +23 -9
  74. data/bundler/lib/bundler/gem_helpers.rb +1 -0
  75. data/bundler/lib/bundler/gem_remote_fetcher.rb +1 -0
  76. data/bundler/lib/bundler/gem_tasks.rb +1 -0
  77. data/bundler/lib/bundler/gem_version_promoter.rb +1 -0
  78. data/bundler/lib/bundler/gemdeps.rb +1 -0
  79. data/bundler/lib/bundler/graph.rb +1 -0
  80. data/bundler/lib/bundler/index.rb +19 -11
  81. data/bundler/lib/bundler/injector.rb +51 -27
  82. data/bundler/lib/bundler/inline.rb +10 -10
  83. data/bundler/lib/bundler/installer.rb +104 -50
  84. data/bundler/lib/bundler/installer/gem_installer.rb +5 -2
  85. data/bundler/lib/bundler/installer/parallel_installer.rb +91 -42
  86. data/bundler/lib/bundler/installer/standalone.rb +1 -0
  87. data/bundler/lib/bundler/lazy_specification.rb +17 -4
  88. data/bundler/lib/bundler/lockfile_generator.rb +95 -0
  89. data/bundler/lib/bundler/lockfile_parser.rb +49 -35
  90. data/bundler/lib/bundler/match_platform.rb +1 -0
  91. data/bundler/lib/bundler/mirror.rb +8 -3
  92. data/bundler/lib/bundler/plugin.rb +6 -1
  93. data/bundler/lib/bundler/plugin/api/source.rb +16 -3
  94. data/bundler/lib/bundler/plugin/index.rb +2 -0
  95. data/bundler/lib/bundler/plugin/installer.rb +7 -6
  96. data/bundler/lib/bundler/plugin/source_list.rb +7 -8
  97. data/bundler/lib/bundler/process_lock.rb +24 -0
  98. data/bundler/lib/bundler/psyched_yaml.rb +10 -0
  99. data/bundler/lib/bundler/remote_specification.rb +25 -1
  100. data/bundler/lib/bundler/resolver.rb +171 -192
  101. data/bundler/lib/bundler/resolver/spec_group.rb +111 -0
  102. data/bundler/lib/bundler/retry.rb +1 -0
  103. data/bundler/lib/bundler/ruby_dsl.rb +1 -0
  104. data/bundler/lib/bundler/ruby_version.rb +6 -1
  105. data/bundler/lib/bundler/rubygems_ext.rb +18 -8
  106. data/bundler/lib/bundler/rubygems_gem_installer.rb +25 -2
  107. data/bundler/lib/bundler/rubygems_integration.rb +157 -66
  108. data/bundler/lib/bundler/runtime.rb +28 -18
  109. data/bundler/lib/bundler/settings.rb +202 -87
  110. data/bundler/lib/bundler/settings/validator.rb +79 -0
  111. data/bundler/lib/bundler/setup.rb +4 -7
  112. data/bundler/lib/bundler/shared_helpers.rb +129 -25
  113. data/bundler/lib/bundler/similarity_detector.rb +1 -0
  114. data/bundler/lib/bundler/source.rb +53 -1
  115. data/bundler/lib/bundler/source/gemspec.rb +1 -0
  116. data/bundler/lib/bundler/source/git.rb +49 -21
  117. data/bundler/lib/bundler/source/git/git_proxy.rb +17 -12
  118. data/bundler/lib/bundler/source/metadata.rb +63 -0
  119. data/bundler/lib/bundler/source/path.rb +38 -17
  120. data/bundler/lib/bundler/source/path/installer.rb +4 -2
  121. data/bundler/lib/bundler/source/rubygems.rb +154 -82
  122. data/bundler/lib/bundler/source/rubygems/remote.rb +8 -1
  123. data/bundler/lib/bundler/source_list.rb +75 -15
  124. data/bundler/lib/bundler/spec_set.rb +34 -21
  125. data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
  126. data/bundler/lib/bundler/stub_specification.rb +86 -2
  127. data/bundler/lib/bundler/templates/Executable +5 -1
  128. data/bundler/lib/bundler/templates/Executable.bundler +105 -0
  129. data/bundler/lib/bundler/templates/Executable.standalone +5 -5
  130. data/bundler/lib/bundler/templates/Gemfile +3 -0
  131. data/bundler/lib/bundler/templates/gems.rb +8 -0
  132. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -2
  133. data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
  134. data/bundler/lib/bundler/templates/newgem/README.md.tt +14 -8
  135. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +5 -5
  136. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
  137. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
  138. data/bundler/lib/bundler/templates/newgem/gitignore.tt +0 -1
  139. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +6 -6
  140. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
  141. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -10
  142. data/bundler/lib/bundler/templates/newgem/rspec.tt +1 -0
  143. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
  144. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +3 -0
  145. data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
  146. data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
  147. data/bundler/lib/bundler/ui.rb +1 -0
  148. data/bundler/lib/bundler/ui/rg_proxy.rb +1 -0
  149. data/bundler/lib/bundler/ui/shell.rb +24 -10
  150. data/bundler/lib/bundler/ui/silent.rb +12 -1
  151. data/bundler/lib/bundler/uri_credentials_filter.rb +1 -0
  152. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
  153. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
  154. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  155. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  156. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
  157. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +16 -5
  158. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  159. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +10 -2
  160. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
  161. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
  162. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
  163. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
  164. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
  165. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
  166. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +5 -4
  167. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -6
  168. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  169. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  170. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
  171. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +501 -138
  172. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
  173. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
  174. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +3 -1
  175. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +46 -21
  176. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +24 -22
  177. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +2 -1
  178. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  179. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
  180. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
  181. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +66 -18
  182. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +17 -15
  183. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +55 -32
  184. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +13 -11
  185. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
  186. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
  187. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
  188. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
  189. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +13 -13
  190. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
  191. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
  192. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
  193. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
  194. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +42 -21
  195. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -10
  196. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +31 -29
  197. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  198. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +49 -33
  199. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
  200. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
  201. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
  202. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  203. data/bundler/lib/bundler/vendored_fileutils.rb +9 -0
  204. data/bundler/lib/bundler/vendored_molinillo.rb +1 -0
  205. data/bundler/lib/bundler/vendored_persistent.rb +35 -0
  206. data/bundler/lib/bundler/vendored_thor.rb +6 -2
  207. data/bundler/lib/bundler/version.rb +19 -2
  208. data/bundler/lib/bundler/version_ranges.rb +76 -0
  209. data/bundler/lib/bundler/vlad.rb +5 -0
  210. data/bundler/lib/bundler/worker.rb +3 -1
  211. data/bundler/lib/bundler/yaml_serializer.rb +3 -3
  212. data/bundler/man/bundle-add.ronn +29 -0
  213. data/bundler/man/bundle-binstubs.ronn +14 -0
  214. data/bundler/man/bundle-check.ronn +26 -0
  215. data/bundler/man/bundle-clean.ronn +18 -0
  216. data/bundler/man/bundle-config.ronn +180 -60
  217. data/bundler/man/bundle-exec.ronn +7 -0
  218. data/bundler/man/bundle-gem.ronn +3 -2
  219. data/bundler/man/bundle-info.ronn +17 -0
  220. data/bundler/man/bundle-init.ronn +18 -0
  221. data/bundler/man/bundle-inject.ronn +22 -0
  222. data/bundler/man/bundle-install.ronn +32 -32
  223. data/bundler/man/bundle-list.ronn +15 -0
  224. data/bundler/man/bundle-open.ronn +19 -0
  225. data/bundler/man/bundle-outdated.ronn +1 -1
  226. data/bundler/man/bundle-package.ronn +5 -0
  227. data/bundler/man/bundle-pristine.ronn +34 -0
  228. data/bundler/man/bundle-show.ronn +20 -0
  229. data/bundler/man/bundle-update.ronn +6 -3
  230. data/bundler/man/bundle-viz.ronn +30 -0
  231. data/bundler/man/bundle.ronn +11 -20
  232. data/bundler/man/gemfile.5.ronn +55 -64
  233. data/lib/rubygems.rb +79 -36
  234. data/lib/rubygems/basic_specification.rb +8 -4
  235. data/lib/rubygems/bundler_version_finder.rb +112 -0
  236. data/lib/rubygems/command.rb +1 -1
  237. data/lib/rubygems/command_manager.rb +3 -1
  238. data/lib/rubygems/commands/cert_command.rb +31 -6
  239. data/lib/rubygems/commands/cleanup_command.rb +1 -1
  240. data/lib/rubygems/commands/help_command.rb +1 -1
  241. data/lib/rubygems/commands/owner_command.rb +3 -1
  242. data/lib/rubygems/commands/pristine_command.rb +11 -8
  243. data/lib/rubygems/commands/push_command.rb +2 -1
  244. data/lib/rubygems/commands/query_command.rb +13 -14
  245. data/lib/rubygems/commands/setup_command.rb +124 -69
  246. data/lib/rubygems/commands/signin_command.rb +33 -0
  247. data/lib/rubygems/commands/signout_command.rb +33 -0
  248. data/lib/rubygems/commands/uninstall_command.rb +4 -3
  249. data/lib/rubygems/commands/unpack_command.rb +16 -4
  250. data/lib/rubygems/commands/update_command.rb +1 -1
  251. data/lib/rubygems/commands/which_command.rb +1 -1
  252. data/lib/rubygems/commands/yank_command.rb +4 -11
  253. data/lib/rubygems/config_file.rb +13 -24
  254. data/lib/rubygems/core_ext/kernel_require.rb +10 -9
  255. data/lib/rubygems/dependency.rb +2 -0
  256. data/lib/rubygems/dependency_installer.rb +4 -0
  257. data/lib/rubygems/errors.rb +3 -0
  258. data/lib/rubygems/exceptions.rb +6 -0
  259. data/lib/rubygems/ext/builder.rb +1 -1
  260. data/lib/rubygems/ext/ext_conf_builder.rb +2 -4
  261. data/lib/rubygems/ext/rake_builder.rb +1 -1
  262. data/lib/rubygems/gem_runner.rb +5 -1
  263. data/lib/rubygems/install_update_options.rb +5 -28
  264. data/lib/rubygems/installer.rb +12 -7
  265. data/lib/rubygems/installer_test_case.rb +6 -3
  266. data/lib/rubygems/package/old.rb +1 -1
  267. data/lib/rubygems/request.rb +1 -1
  268. data/lib/rubygems/request_set.rb +20 -3
  269. data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
  270. data/lib/rubygems/requirement.rb +5 -1
  271. data/lib/rubygems/resolver.rb +24 -3
  272. data/lib/rubygems/resolver/installer_set.rb +4 -6
  273. data/lib/rubygems/safe_yaml.rb +4 -1
  274. data/lib/rubygems/security.rb +10 -3
  275. data/lib/rubygems/security_option.rb +43 -0
  276. data/lib/rubygems/server.rb +4 -12
  277. data/lib/rubygems/source.rb +7 -4
  278. data/lib/rubygems/source/git.rb +2 -1
  279. data/lib/rubygems/source/local.rb +38 -35
  280. data/lib/rubygems/source/lock.rb +4 -1
  281. data/lib/rubygems/source_local.rb +3 -1
  282. data/lib/rubygems/source_specific_file.rb +3 -2
  283. data/lib/rubygems/spec_fetcher.rb +7 -3
  284. data/lib/rubygems/specification.rb +281 -231
  285. data/lib/rubygems/stub_specification.rb +2 -3
  286. data/lib/rubygems/test_case.rb +14 -1
  287. data/lib/rubygems/user_interaction.rb +15 -13
  288. data/lib/rubygems/util.rb +6 -17
  289. data/lib/rubygems/version.rb +17 -3
  290. data/lib/rubygems/version_option.rb +6 -1
  291. data/setup.rb +1 -1
  292. data/test/rubygems/private3072_key.pem +40 -0
  293. data/test/rubygems/public3072_cert.pem +25 -0
  294. data/test/rubygems/test_config.rb +1 -1
  295. data/test/rubygems/test_gem.rb +72 -14
  296. data/test/rubygems/test_gem_bundler_version_finder.rb +125 -0
  297. data/test/rubygems/test_gem_command.rb +1 -1
  298. data/test/rubygems/test_gem_commands_build_command.rb +27 -1
  299. data/test/rubygems/test_gem_commands_cert_command.rb +64 -0
  300. data/test/rubygems/test_gem_commands_install_command.rb +35 -2
  301. data/test/rubygems/test_gem_commands_pristine_command.rb +1 -1
  302. data/test/rubygems/test_gem_commands_query_command.rb +19 -0
  303. data/test/rubygems/test_gem_commands_setup_command.rb +17 -0
  304. data/test/rubygems/test_gem_commands_signin_command.rb +95 -0
  305. data/test/rubygems/test_gem_commands_signout_command.rb +37 -0
  306. data/test/rubygems/test_gem_commands_sources_command.rb +1 -1
  307. data/test/rubygems/test_gem_commands_uninstall_command.rb +12 -0
  308. data/test/rubygems/test_gem_commands_update_command.rb +1 -1
  309. data/test/rubygems/test_gem_commands_which_command.rb +3 -3
  310. data/test/rubygems/test_gem_dependency.rb +28 -0
  311. data/test/rubygems/test_gem_ext_builder.rb +2 -2
  312. data/test/rubygems/test_gem_ext_rake_builder.rb +2 -2
  313. data/test/rubygems/test_gem_install_update_options.rb +2 -1
  314. data/test/rubygems/test_gem_installer.rb +29 -27
  315. data/test/rubygems/test_gem_package.rb +5 -5
  316. data/test/rubygems/test_gem_remote_fetcher.rb +2 -2
  317. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +3 -3
  318. data/test/rubygems/test_gem_requirement.rb +6 -0
  319. data/test/rubygems/test_gem_resolver.rb +26 -0
  320. data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
  321. data/test/rubygems/test_gem_security.rb +5 -0
  322. data/test/rubygems/test_gem_security_policy.rb +24 -24
  323. data/test/rubygems/test_gem_security_signer.rb +6 -6
  324. data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
  325. data/test/rubygems/test_gem_server.rb +18 -1
  326. data/test/rubygems/test_gem_source.rb +9 -0
  327. data/test/rubygems/test_gem_spec_fetcher.rb +20 -0
  328. data/test/rubygems/test_gem_specification.rb +85 -10
  329. data/test/rubygems/test_gem_stream_ui.rb +6 -6
  330. data/test/rubygems/test_gem_stub_specification.rb +19 -1
  331. data/test/rubygems/test_gem_util.rb +1 -0
  332. data/test/rubygems/test_gem_version.rb +28 -7
  333. data/test/rubygems/test_gem_version_option.rb +15 -0
  334. data/test/rubygems/test_kernel.rb +30 -0
  335. data/test/rubygems/test_require.rb +44 -0
  336. metadata +47 -46
  337. data/README.rdoc +0 -54
  338. data/bundler/DEVELOPMENT.md +0 -150
  339. data/bundler/ISSUES.md +0 -117
  340. data/bundler/lib/bundler/postit_trampoline.rb +0 -73
  341. data/bundler/lib/bundler/vendor/postit/lib/postit.rb +0 -15
  342. data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
  343. data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
  344. data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
  345. data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
  346. data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
  347. data/bundler/man/index.txt +0 -8
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class Settings
5
+ class Validator
6
+ class Rule
7
+ attr_reader :description
8
+
9
+ def initialize(keys, description, &validate)
10
+ @keys = keys
11
+ @description = description
12
+ @validate = validate
13
+ end
14
+
15
+ def validate!(key, value, settings)
16
+ instance_exec(key, value, settings, &@validate)
17
+ end
18
+
19
+ def fail!(key, value, *reasons)
20
+ reasons.unshift @description
21
+ raise InvalidOption, "Setting `#{key}` to #{value.inspect} failed:\n#{reasons.map {|r| " - #{r}" }.join("\n")}"
22
+ end
23
+
24
+ def set(settings, key, value, *reasons)
25
+ hash_key = k(key)
26
+ return if settings[hash_key] == value
27
+ reasons.unshift @description
28
+ Bundler.ui.info "Setting `#{key}` to #{value.inspect}, since #{reasons.join(", ")}"
29
+ if value.nil?
30
+ settings.delete(hash_key)
31
+ else
32
+ settings[hash_key] = value
33
+ end
34
+ end
35
+
36
+ def k(key)
37
+ Bundler.settings.key_for(key)
38
+ end
39
+ end
40
+
41
+ def self.rules
42
+ @rules ||= Hash.new {|h, k| h[k] = [] }
43
+ end
44
+ private_class_method :rules
45
+
46
+ def self.rule(keys, description, &blk)
47
+ rule = Rule.new(keys, description, &blk)
48
+ keys.each {|k| rules[k] << rule }
49
+ end
50
+ private_class_method :rule
51
+
52
+ def self.validate!(key, value, settings)
53
+ rules_to_validate = rules[key]
54
+ rules_to_validate.each {|rule| rule.validate!(key, value, settings) }
55
+ end
56
+
57
+ rule %w[path path.system], "path and path.system are mutually exclusive" do |key, value, settings|
58
+ if key == "path" && value
59
+ set(settings, "path.system", nil)
60
+ elsif key == "path.system" && value
61
+ set(settings, :path, nil)
62
+ end
63
+ end
64
+
65
+ rule %w[with without], "a group cannot be in both `with` & `without` simultaneously" do |key, value, settings|
66
+ with = settings.fetch(k(:with), "").split(":").map(&:to_sym)
67
+ without = settings.fetch(k(:without), "").split(":").map(&:to_sym)
68
+
69
+ other_key = key == "with" ? :without : :with
70
+ other_setting = key == "with" ? without : with
71
+
72
+ conflicting = with & without
73
+ if conflicting.any?
74
+ fail!(key, value, "`#{other_key}` is current set to #{other_setting.inspect}", "the `#{conflicting.join("`, `")}` groups conflict")
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require "bundler/postit_trampoline"
2
+
3
3
  require "bundler/shared_helpers"
4
4
 
5
5
  if Bundler::SharedHelpers.in_bundle?
@@ -20,12 +20,9 @@ if Bundler::SharedHelpers.in_bundle?
20
20
  Bundler.setup
21
21
  end
22
22
 
23
- unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"]
24
- # Add bundler to the load path after disabling system gems
25
- # This is guarenteed to be done already if we've trampolined
26
- bundler_lib = File.expand_path("../..", __FILE__)
27
- $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
28
- end
23
+ # Add bundler to the load path after disabling system gems
24
+ bundler_lib = File.expand_path("../..", __FILE__)
25
+ $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
29
26
 
30
27
  Bundler.ui = nil
31
28
  end
@@ -1,7 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
3
+ require "bundler/compatibility_guard"
4
+
2
5
  require "pathname"
3
6
  require "rubygems"
4
7
 
8
+ require "bundler/version"
5
9
  require "bundler/constants"
6
10
  require "bundler/rubygems_integration"
7
11
  require "bundler/current_ruby"
@@ -19,10 +23,16 @@ end
19
23
 
20
24
  module Bundler
21
25
  module SharedHelpers
22
- def default_gemfile
26
+ def root
23
27
  gemfile = find_gemfile
24
28
  raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
25
- Pathname.new(gemfile).untaint
29
+ Pathname.new(gemfile).untaint.expand_path.parent
30
+ end
31
+
32
+ def default_gemfile
33
+ gemfile = find_gemfile(:order_matters)
34
+ raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
35
+ Pathname.new(gemfile).untaint.expand_path
26
36
  end
27
37
 
28
38
  def default_lockfile
@@ -63,7 +73,7 @@ module Bundler
63
73
  end
64
74
 
65
75
  def with_clean_git_env(&block)
66
- keys = %w(GIT_DIR GIT_WORK_TREE)
76
+ keys = %w[GIT_DIR GIT_WORK_TREE]
67
77
  old_env = keys.inject({}) do |h, k|
68
78
  h.update(k => ENV[k])
69
79
  end
@@ -102,8 +112,10 @@ module Bundler
102
112
  # end
103
113
  #
104
114
  # @see {Bundler::PermissionError}
105
- def filesystem_access(path, action = :write)
106
- yield path.dup.untaint
115
+ def filesystem_access(path, action = :write, &block)
116
+ # Use block.call instead of yield because of a bug in Ruby 2.2.2
117
+ # See https://github.com/bundler/bundler/issues/5341 for details
118
+ block.call(path.dup.untaint)
107
119
  rescue Errno::EACCES
108
120
  raise PermissionError.new(path, action)
109
121
  rescue Errno::EAGAIN
@@ -127,28 +139,114 @@ module Bundler
127
139
  namespace.const_get(constant_name)
128
140
  end
129
141
 
130
- def major_deprecation(message)
142
+ def major_deprecation(major_version, message)
143
+ if Bundler.bundler_major_version >= major_version
144
+ require "bundler/errors"
145
+ raise DeprecatedError, "[REMOVED FROM #{major_version}.0] #{message}"
146
+ end
147
+
131
148
  return unless prints_major_deprecations?
132
149
  @major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
133
150
  ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui
134
- ui.warn("[DEPRECATED FOR #{Bundler::VERSION.split(".").first.to_i + 1}.0] #{message}")
151
+ ui.warn("[DEPRECATED FOR #{major_version}.0] #{message}")
135
152
  end
136
153
 
137
154
  def print_major_deprecations!
138
- deprecate_gemfile(find_gemfile) if find_gemfile == find_file("Gemfile")
155
+ multiple_gemfiles = search_up(".") do |dir|
156
+ gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
157
+ next if gemfiles.empty?
158
+ break false if gemfiles.size == 1
159
+ end
160
+ if multiple_gemfiles && Bundler.bundler_major_version == 1
161
+ Bundler::SharedHelpers.major_deprecation 2, \
162
+ "gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
163
+ end
164
+
139
165
  if RUBY_VERSION < "2"
140
- major_deprecation("Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
166
+ major_deprecation(2, "Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
141
167
  end
142
168
  return if Bundler.rubygems.provides?(">= 2")
143
- major_deprecation("Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
169
+ major_deprecation(2, "Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
170
+ end
171
+
172
+ def trap(signal, override = false, &block)
173
+ prior = Signal.trap(signal) do
174
+ block.call
175
+ prior.call unless override
176
+ end
177
+ end
178
+
179
+ def ensure_same_dependencies(spec, old_deps, new_deps)
180
+ new_deps = new_deps.reject {|d| d.type == :development }
181
+ old_deps = old_deps.reject {|d| d.type == :development }
182
+
183
+ without_type = proc {|d| Gem::Dependency.new(d.name, d.requirements_list.sort) }
184
+ new_deps.map!(&without_type)
185
+ old_deps.map!(&without_type)
186
+
187
+ extra_deps = new_deps - old_deps
188
+ return if extra_deps.empty?
189
+
190
+ Bundler.ui.debug "#{spec.full_name} from #{spec.remote} has either corrupted API or lockfile dependencies" \
191
+ " (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})"
192
+ raise APIResponseMismatchError,
193
+ "Downloading #{spec.full_name} revealed dependencies not in the API or the lockfile (#{extra_deps.join(", ")})." \
194
+ "\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
195
+ end
196
+
197
+ def pretty_dependency(dep, print_source = false)
198
+ msg = String.new(dep.name)
199
+ msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
200
+ if dep.is_a?(Bundler::Dependency)
201
+ platform_string = dep.platforms.join(", ")
202
+ msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
203
+ end
204
+ msg << " from the `#{dep.source}` source" if print_source && dep.source
205
+ msg
206
+ end
207
+
208
+ def md5_available?
209
+ return @md5_available if defined?(@md5_available)
210
+ @md5_available = begin
211
+ require "openssl"
212
+ OpenSSL::Digest::MD5.digest("")
213
+ true
214
+ rescue LoadError
215
+ true
216
+ rescue OpenSSL::Digest::DigestError
217
+ false
218
+ end
219
+ end
220
+
221
+ def digest(name)
222
+ require "digest"
223
+ Digest(name)
144
224
  end
145
225
 
146
226
  private
147
227
 
148
- def find_gemfile
228
+ def validate_bundle_path
229
+ path_separator = Bundler.rubygems.path_separator
230
+ return unless Bundler.bundle_path.to_s.split(path_separator).size > 1
231
+ message = "Your bundle path contains text matching #{path_separator.inspect}, " \
232
+ "which is the path separator for your system. Bundler cannot " \
233
+ "function correctly when the Bundle path contains the " \
234
+ "system's PATH separator. Please change your " \
235
+ "bundle path to not match #{path_separator.inspect}." \
236
+ "\nYour current bundle path is '#{Bundler.bundle_path}'."
237
+ raise Bundler::PathError, message
238
+ end
239
+
240
+ def find_gemfile(order_matters = false)
149
241
  given = ENV["BUNDLE_GEMFILE"]
150
242
  return given if given && !given.empty?
151
- find_file("Gemfile", "gems.rb")
243
+ names = gemfile_names
244
+ names.reverse! if order_matters && Bundler.feature_flag.prefer_gems_rb?
245
+ find_file(*names)
246
+ end
247
+
248
+ def gemfile_names
249
+ ["Gemfile", "gems.rb"]
152
250
  end
153
251
 
154
252
  def find_file(*names)
@@ -182,35 +280,47 @@ module Bundler
182
280
  end
183
281
  end
184
282
 
283
+ def set_env(key, value)
284
+ raise ArgumentError, "new key #{key}" unless EnvironmentPreserver::BUNDLER_KEYS.include?(key)
285
+ orig_key = "#{EnvironmentPreserver::BUNDLER_PREFIX}#{key}"
286
+ orig = ENV[key]
287
+ orig ||= EnvironmentPreserver::INTENTIONALLY_NIL
288
+ ENV[orig_key] ||= orig
289
+
290
+ ENV[key] = value
291
+ end
292
+ public :set_env
293
+
185
294
  def set_bundle_variables
186
295
  begin
187
- ENV["BUNDLE_BIN_PATH"] = Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
296
+ Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
188
297
  rescue Gem::GemNotFoundException
189
- ENV["BUNDLE_BIN_PATH"] = File.expand_path("../../../exe/bundle", __FILE__)
298
+ Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", File.expand_path("../../../exe/bundle", __FILE__)
190
299
  end
191
300
 
192
301
  # Set BUNDLE_GEMFILE
193
- ENV["BUNDLE_GEMFILE"] = find_gemfile.to_s
194
- ENV["BUNDLER_VERSION"] = Bundler::VERSION
302
+ Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile(:order_matters).to_s
303
+ Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
195
304
  end
196
305
 
197
306
  def set_path
307
+ validate_bundle_path
198
308
  paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
199
309
  paths.unshift "#{Bundler.bundle_path}/bin"
200
- ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR)
310
+ Bundler::SharedHelpers.set_env "PATH", paths.uniq.join(File::PATH_SEPARATOR)
201
311
  end
202
312
 
203
313
  def set_rubyopt
204
314
  rubyopt = [ENV["RUBYOPT"]].compact
205
315
  return if !rubyopt.empty? && rubyopt.first =~ %r{-rbundler/setup}
206
316
  rubyopt.unshift %(-rbundler/setup)
207
- ENV["RUBYOPT"] = rubyopt.join(" ")
317
+ Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
208
318
  end
209
319
 
210
320
  def set_rubylib
211
321
  rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
212
322
  rubylib.unshift bundler_ruby_lib
213
- ENV["RUBYLIB"] = rubylib.uniq.join(File::PATH_SEPARATOR)
323
+ Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR)
214
324
  end
215
325
 
216
326
  def bundler_ruby_lib
@@ -241,12 +351,6 @@ module Bundler
241
351
  true
242
352
  end
243
353
 
244
- def deprecate_gemfile(gemfile)
245
- return unless gemfile && File.basename(gemfile) == "Gemfile"
246
- Bundler::SharedHelpers.major_deprecation \
247
- "gems.rb and gems.locked will be prefered to Gemfile and Gemfile.lock."
248
- end
249
-
250
354
  extend self
251
355
  end
252
356
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  class SimilarityDetector
4
5
  SimilarityScore = Struct.new(:string, :distance)
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  class Source
4
5
  autoload :Gemspec, "bundler/source/gemspec"
5
6
  autoload :Git, "bundler/source/git"
7
+ autoload :Metadata, "bundler/source/metadata"
6
8
  autoload :Path, "bundler/source/path"
7
9
  autoload :Rubygems, "bundler/source/rubygems"
8
10
 
@@ -20,7 +22,7 @@ module Bundler
20
22
  locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
21
23
  locked_spec_version = locked_spec.version if locked_spec
22
24
  if locked_spec_version && spec.version != locked_spec_version
23
- message += Bundler.ui.add_color(" (was #{locked_spec_version})", :green)
25
+ message += Bundler.ui.add_color(" (was #{locked_spec_version})", version_color(spec.version, locked_spec_version))
24
26
  end
25
27
  end
26
28
 
@@ -31,6 +33,15 @@ module Bundler
31
33
  spec.source == self
32
34
  end
33
35
 
36
+ # it's possible that gems from one source depend on gems from some
37
+ # other source, so now we download gemspecs and iterate over those
38
+ # dependencies, looking for gems we don't have info on yet.
39
+ def double_check_for(*); end
40
+
41
+ def dependency_names_to_double_check
42
+ specs.dependency_names
43
+ end
44
+
34
45
  def include?(other)
35
46
  other == self
36
47
  end
@@ -38,5 +49,46 @@ module Bundler
38
49
  def inspect
39
50
  "#<#{self.class}:0x#{object_id} #{self}>"
40
51
  end
52
+
53
+ def path?
54
+ instance_of?(Bundler::Source::Path)
55
+ end
56
+
57
+ private
58
+
59
+ def version_color(spec_version, locked_spec_version)
60
+ if Gem::Version.correct?(spec_version) && Gem::Version.correct?(locked_spec_version)
61
+ # display yellow if there appears to be a regression
62
+ earlier_version?(spec_version, locked_spec_version) ? :yellow : :green
63
+ else
64
+ # default to green if the versions cannot be directly compared
65
+ :green
66
+ end
67
+ end
68
+
69
+ def earlier_version?(spec_version, locked_spec_version)
70
+ Gem::Version.new(spec_version) < Gem::Version.new(locked_spec_version)
71
+ end
72
+
73
+ def print_using_message(message)
74
+ if !message.include?("(was ") && Bundler.feature_flag.suppress_install_using_messages?
75
+ Bundler.ui.debug message
76
+ else
77
+ Bundler.ui.info message
78
+ end
79
+ end
80
+
81
+ def extension_cache_path(spec)
82
+ return unless Bundler.feature_flag.global_gem_cache?
83
+ return unless source_slug = extension_cache_slug(spec)
84
+ Bundler.user_cache.join(
85
+ "extensions", Gem::Platform.local.to_s, Bundler.ruby_scope,
86
+ source_slug, spec.full_name
87
+ )
88
+ end
89
+
90
+ def extension_cache_slug(_)
91
+ nil
92
+ end
41
93
  end
42
94
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  class Source
4
5
  class Gemspec < Path
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
- require "fileutils"
2
+
3
+ require "bundler/vendored_fileutils"
3
4
  require "uri"
4
- require "digest/sha1"
5
5
 
6
6
  module Bundler
7
7
  class Source
@@ -18,7 +18,7 @@ module Bundler
18
18
  @allow_remote = false
19
19
 
20
20
  # Stringify options that could be set as symbols
21
- %w(ref branch tag revision).each {|k| options[k] = options[k].to_s if options[k] }
21
+ %w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
22
22
 
23
23
  @uri = options["uri"] || ""
24
24
  @branch = options["branch"]
@@ -39,7 +39,7 @@ module Bundler
39
39
  out = String.new("GIT\n")
40
40
  out << " remote: #{@uri}\n"
41
41
  out << " revision: #{revision}\n"
42
- %w(ref branch tag submodules).each do |opt|
42
+ %w[ref branch tag submodules].each do |opt|
43
43
  out << " #{opt}: #{options[opt]}\n" if options[opt]
44
44
  end
45
45
  out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
@@ -61,8 +61,12 @@ module Bundler
61
61
  def to_s
62
62
  at = if local?
63
63
  path
64
- elsif options["ref"]
65
- shortref_for_display(options["ref"])
64
+ elsif user_ref = options["ref"]
65
+ if ref =~ /\A[a-z0-9]{4,}\z/i
66
+ shortref_for_display(user_ref)
67
+ else
68
+ user_ref
69
+ end
66
70
  else
67
71
  ref
68
72
  end
@@ -105,6 +109,8 @@ module Bundler
105
109
 
106
110
  def unlock!
107
111
  git_proxy.revision = nil
112
+ options["revision"] = nil
113
+
108
114
  @unlocked = true
109
115
  end
110
116
 
@@ -147,7 +153,6 @@ module Bundler
147
153
  changed
148
154
  end
149
155
 
150
- # TODO: cache git specs
151
156
  def specs(*)
152
157
  set_local!(app_cache_path) if has_app_cache? && !local?
153
158
 
@@ -161,23 +166,27 @@ module Bundler
161
166
  local_specs
162
167
  end
163
168
 
164
- def install(spec, force = false)
165
- Bundler.ui.info "Using #{version_message(spec)} from #{self}"
169
+ def install(spec, options = {})
170
+ force = options[:force]
166
171
 
167
- if requires_checkout? && !@copied && !force
172
+ print_using_message "Using #{version_message(spec)} from #{self}"
173
+
174
+ if (requires_checkout? && !@copied) || force
168
175
  Bundler.ui.debug " * Checking out revision: #{ref}"
169
176
  git_proxy.copy_to(install_path, submodules)
170
177
  serialize_gemspecs_in(install_path)
171
178
  @copied = true
172
179
  end
173
- generate_bin(spec, !Bundler.rubygems.spec_missing_extensions?(spec))
180
+
181
+ generate_bin_options = { :disable_extensions => !Bundler.rubygems.spec_missing_extensions?(spec), :build_args => options[:build_args] }
182
+ generate_bin(spec, generate_bin_options)
174
183
 
175
184
  requires_checkout? ? spec.post_install_message : nil
176
185
  end
177
186
 
178
187
  def cache(spec, custom_path = nil)
179
188
  app_cache_path = app_cache_path(custom_path)
180
- return unless Bundler.settings[:cache_all]
189
+ return unless Bundler.feature_flag.cache_all?
181
190
  return if path == app_cache_path
182
191
  cached!
183
192
  FileUtils.rm_rf(app_cache_path)
@@ -199,13 +208,11 @@ module Bundler
199
208
  # When using local git repos, this is set to the local repo.
200
209
  def cache_path
201
210
  @cache_path ||= begin
202
- git_scope = "#{base_name}-#{uri_hash}"
203
-
204
- if Bundler.requires_sudo?
205
- Bundler.user_bundle_path.join("cache/git", git_scope)
211
+ if Bundler.requires_sudo? || Bundler.feature_flag.global_gem_cache?
212
+ Bundler.user_cache
206
213
  else
207
- Bundler.cache.join("git", git_scope)
208
- end
214
+ Bundler.bundle_path.join("cache", "bundler")
215
+ end.join("git", git_scope)
209
216
  end
210
217
  end
211
218
 
@@ -231,6 +238,8 @@ module Bundler
231
238
  # The gemspecs we cache should already be evaluated.
232
239
  spec = Bundler.load_gemspec(spec_path)
233
240
  next unless spec
241
+ Bundler.rubygems.set_installed_by_version(spec)
242
+ Bundler.rubygems.validate(spec)
234
243
  File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) }
235
244
  end
236
245
  end
@@ -274,7 +283,7 @@ module Bundler
274
283
  # If there is no URI scheme, assume it is an ssh/git URI
275
284
  input = uri
276
285
  end
277
- Digest::SHA1.hexdigest(input)
286
+ SharedHelpers.digest(:SHA1).hexdigest(input)
278
287
  end
279
288
 
280
289
  def cached_revision
@@ -291,9 +300,28 @@ module Bundler
291
300
 
292
301
  def fetch
293
302
  git_proxy.checkout
294
- rescue GitError
303
+ rescue GitError => e
295
304
  raise unless Bundler.feature_flag.allow_offline_install?
296
- Bundler.ui.warn "Using cached git data because of network errors"
305
+ Bundler.ui.warn "Using cached git data because of network errors:\n#{e}"
306
+ end
307
+
308
+ # no-op, since we validate when re-serializing the gemspec
309
+ def validate_spec(_spec); end
310
+
311
+ if Bundler.rubygems.stubs_provide_full_functionality?
312
+ def load_gemspec(file)
313
+ stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
314
+ stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.untaint
315
+ StubSpecification.from_stub(stub)
316
+ end
317
+ end
318
+
319
+ def git_scope
320
+ "#{base_name}-#{uri_hash}"
321
+ end
322
+
323
+ def extension_cache_slug(_)
324
+ extension_dir_name
297
325
  end
298
326
  end
299
327
  end