rubygems-update 2.6.11 → 2.7.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (405) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +8 -22
  3. data/CONTRIBUTING.rdoc +53 -54
  4. data/History.txt +405 -0
  5. data/Manifest.txt +46 -15
  6. data/POLICIES.rdoc +3 -3
  7. data/README.md +72 -0
  8. data/Rakefile +55 -12
  9. data/appveyor.yml +29 -1
  10. data/bin/gem +1 -1
  11. data/bin/update_rubygems +2 -2
  12. data/bundler/CHANGELOG.md +412 -9
  13. data/bundler/CODE_OF_CONDUCT.md +1 -1
  14. data/bundler/CONTRIBUTING.md +10 -29
  15. data/bundler/README.md +27 -11
  16. data/bundler/bundler.gemspec +58 -0
  17. data/bundler/exe/bundle +5 -7
  18. data/bundler/exe/bundle_ruby +4 -3
  19. data/bundler/lib/bundler.rb +103 -79
  20. data/bundler/lib/bundler/build_metadata.rb +53 -0
  21. data/bundler/lib/bundler/capistrano.rb +5 -0
  22. data/bundler/lib/bundler/cli.rb +231 -66
  23. data/bundler/lib/bundler/cli/add.rb +25 -0
  24. data/bundler/lib/bundler/cli/binstubs.rb +9 -7
  25. data/bundler/lib/bundler/cli/cache.rb +5 -4
  26. data/bundler/lib/bundler/cli/check.rb +3 -5
  27. data/bundler/lib/bundler/cli/clean.rb +5 -6
  28. data/bundler/lib/bundler/cli/common.rb +18 -2
  29. data/bundler/lib/bundler/cli/config.rb +26 -7
  30. data/bundler/lib/bundler/cli/console.rb +2 -1
  31. data/bundler/lib/bundler/cli/doctor.rb +1 -0
  32. data/bundler/lib/bundler/cli/exec.rb +6 -5
  33. data/bundler/lib/bundler/cli/gem.rb +42 -18
  34. data/bundler/lib/bundler/cli/info.rb +50 -0
  35. data/bundler/lib/bundler/cli/init.rb +21 -7
  36. data/bundler/lib/bundler/cli/inject.rb +13 -4
  37. data/bundler/lib/bundler/cli/install.rb +61 -77
  38. data/bundler/lib/bundler/cli/issue.rb +40 -0
  39. data/bundler/lib/bundler/cli/list.rb +22 -0
  40. data/bundler/lib/bundler/cli/lock.rb +4 -2
  41. data/bundler/lib/bundler/cli/open.rb +2 -2
  42. data/bundler/lib/bundler/cli/outdated.rb +30 -28
  43. data/bundler/lib/bundler/cli/package.rb +9 -6
  44. data/bundler/lib/bundler/cli/platform.rb +1 -0
  45. data/bundler/lib/bundler/cli/plugin.rb +1 -0
  46. data/bundler/lib/bundler/cli/pristine.rb +43 -0
  47. data/bundler/lib/bundler/cli/show.rb +1 -1
  48. data/bundler/lib/bundler/cli/update.rb +36 -13
  49. data/bundler/lib/bundler/cli/viz.rb +5 -1
  50. data/bundler/lib/bundler/compact_index_client.rb +1 -0
  51. data/bundler/lib/bundler/compact_index_client/cache.rb +1 -2
  52. data/bundler/lib/bundler/compact_index_client/updater.rb +36 -8
  53. data/bundler/lib/bundler/compatibility_guard.rb +14 -0
  54. data/bundler/lib/bundler/constants.rb +1 -0
  55. data/bundler/lib/bundler/current_ruby.rb +16 -8
  56. data/bundler/lib/bundler/definition.rb +252 -170
  57. data/bundler/lib/bundler/dep_proxy.rb +3 -1
  58. data/bundler/lib/bundler/dependency.rb +7 -7
  59. data/bundler/lib/bundler/deployment.rb +1 -1
  60. data/bundler/lib/bundler/deprecate.rb +15 -3
  61. data/bundler/lib/bundler/dsl.rb +103 -62
  62. data/bundler/lib/bundler/endpoint_specification.rb +13 -3
  63. data/bundler/lib/bundler/env.rb +101 -38
  64. data/bundler/lib/bundler/environment_preserver.rb +27 -6
  65. data/bundler/lib/bundler/errors.rb +3 -1
  66. data/bundler/lib/bundler/feature_flag.rb +39 -4
  67. data/bundler/lib/bundler/fetcher.rb +18 -11
  68. data/bundler/lib/bundler/fetcher/base.rb +1 -0
  69. data/bundler/lib/bundler/fetcher/compact_index.rb +2 -12
  70. data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
  71. data/bundler/lib/bundler/fetcher/downloader.rb +14 -7
  72. data/bundler/lib/bundler/fetcher/index.rb +3 -2
  73. data/bundler/lib/bundler/friendly_errors.rb +7 -2
  74. data/bundler/lib/bundler/gem_helper.rb +24 -10
  75. data/bundler/lib/bundler/gem_helpers.rb +1 -0
  76. data/bundler/lib/bundler/gem_remote_fetcher.rb +1 -0
  77. data/bundler/lib/bundler/gem_tasks.rb +1 -0
  78. data/bundler/lib/bundler/gem_version_promoter.rb +13 -0
  79. data/bundler/lib/bundler/gemdeps.rb +1 -0
  80. data/bundler/lib/bundler/graph.rb +1 -0
  81. data/bundler/lib/bundler/index.rb +19 -11
  82. data/bundler/lib/bundler/injector.rb +54 -30
  83. data/bundler/lib/bundler/inline.rb +10 -10
  84. data/bundler/lib/bundler/installer.rb +114 -52
  85. data/bundler/lib/bundler/installer/gem_installer.rb +14 -4
  86. data/bundler/lib/bundler/installer/parallel_installer.rb +91 -42
  87. data/bundler/lib/bundler/installer/standalone.rb +1 -0
  88. data/bundler/lib/bundler/lazy_specification.rb +17 -4
  89. data/bundler/lib/bundler/lockfile_generator.rb +95 -0
  90. data/bundler/lib/bundler/lockfile_parser.rb +49 -35
  91. data/bundler/lib/bundler/match_platform.rb +1 -0
  92. data/bundler/lib/bundler/mirror.rb +10 -5
  93. data/bundler/lib/bundler/plugin.rb +8 -3
  94. data/bundler/lib/bundler/plugin/api/source.rb +16 -3
  95. data/bundler/lib/bundler/plugin/index.rb +9 -2
  96. data/bundler/lib/bundler/plugin/installer.rb +7 -6
  97. data/bundler/lib/bundler/plugin/source_list.rb +7 -8
  98. data/bundler/lib/bundler/process_lock.rb +24 -0
  99. data/bundler/lib/bundler/psyched_yaml.rb +10 -0
  100. data/bundler/lib/bundler/remote_specification.rb +25 -1
  101. data/bundler/lib/bundler/resolver.rb +176 -193
  102. data/bundler/lib/bundler/resolver/spec_group.rb +106 -0
  103. data/bundler/lib/bundler/retry.rb +1 -0
  104. data/bundler/lib/bundler/ruby_dsl.rb +1 -0
  105. data/bundler/lib/bundler/ruby_version.rb +7 -2
  106. data/bundler/lib/bundler/rubygems_ext.rb +18 -8
  107. data/bundler/lib/bundler/rubygems_gem_installer.rb +25 -2
  108. data/bundler/lib/bundler/rubygems_integration.rb +166 -69
  109. data/bundler/lib/bundler/runtime.rb +29 -19
  110. data/bundler/lib/bundler/settings.rb +202 -87
  111. data/bundler/lib/bundler/settings/validator.rb +79 -0
  112. data/bundler/lib/bundler/setup.rb +4 -7
  113. data/bundler/lib/bundler/shared_helpers.rb +143 -27
  114. data/bundler/lib/bundler/similarity_detector.rb +1 -0
  115. data/bundler/lib/bundler/source.rb +53 -1
  116. data/bundler/lib/bundler/source/gemspec.rb +1 -0
  117. data/bundler/lib/bundler/source/git.rb +51 -22
  118. data/bundler/lib/bundler/source/git/git_proxy.rb +23 -13
  119. data/bundler/lib/bundler/source/metadata.rb +63 -0
  120. data/bundler/lib/bundler/source/path.rb +38 -17
  121. data/bundler/lib/bundler/source/path/installer.rb +4 -2
  122. data/bundler/lib/bundler/source/rubygems.rb +161 -82
  123. data/bundler/lib/bundler/source/rubygems/remote.rb +12 -2
  124. data/bundler/lib/bundler/source_list.rb +75 -15
  125. data/bundler/lib/bundler/spec_set.rb +37 -21
  126. data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
  127. data/bundler/lib/bundler/stub_specification.rb +86 -2
  128. data/bundler/lib/bundler/templates/.document +1 -0
  129. data/bundler/lib/bundler/templates/Executable +13 -1
  130. data/bundler/lib/bundler/templates/Executable.bundler +105 -0
  131. data/bundler/lib/bundler/templates/Executable.standalone +5 -5
  132. data/bundler/lib/bundler/templates/Gemfile +3 -0
  133. data/bundler/lib/bundler/templates/gems.rb +8 -0
  134. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -2
  135. data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
  136. data/bundler/lib/bundler/templates/newgem/README.md.tt +14 -8
  137. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +5 -5
  138. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
  139. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
  140. data/bundler/lib/bundler/templates/newgem/gitignore.tt +0 -1
  141. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +6 -6
  142. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
  143. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -12
  144. data/bundler/lib/bundler/templates/newgem/rspec.tt +1 -0
  145. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
  146. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +3 -0
  147. data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
  148. data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
  149. data/bundler/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
  150. data/bundler/lib/bundler/ui.rb +1 -0
  151. data/bundler/lib/bundler/ui/rg_proxy.rb +1 -0
  152. data/bundler/lib/bundler/ui/shell.rb +26 -10
  153. data/bundler/lib/bundler/ui/silent.rb +12 -1
  154. data/bundler/lib/bundler/uri_credentials_filter.rb +1 -0
  155. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
  156. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
  157. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
  158. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
  159. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
  160. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +16 -5
  161. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
  162. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +10 -2
  163. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
  164. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
  165. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
  166. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
  167. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
  168. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
  169. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +16 -5
  170. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -7
  171. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
  172. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
  173. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
  174. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +501 -138
  175. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
  176. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
  177. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +3 -1
  178. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +46 -21
  179. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +24 -22
  180. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +2 -1
  181. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  182. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
  183. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
  184. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +66 -18
  185. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +17 -15
  186. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +55 -32
  187. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +13 -11
  188. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
  189. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
  190. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
  191. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
  192. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +13 -13
  193. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
  194. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
  195. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
  196. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
  197. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +42 -21
  198. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -10
  199. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +31 -29
  200. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  201. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +49 -33
  202. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
  203. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
  204. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
  205. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  206. data/bundler/lib/bundler/vendored_fileutils.rb +9 -0
  207. data/bundler/lib/bundler/vendored_molinillo.rb +1 -0
  208. data/bundler/lib/bundler/vendored_persistent.rb +35 -0
  209. data/bundler/lib/bundler/vendored_thor.rb +6 -2
  210. data/bundler/lib/bundler/version.rb +19 -2
  211. data/bundler/lib/bundler/version_ranges.rb +76 -0
  212. data/bundler/lib/bundler/vlad.rb +5 -0
  213. data/bundler/lib/bundler/worker.rb +3 -1
  214. data/bundler/lib/bundler/yaml_serializer.rb +3 -3
  215. data/bundler/man/bundle-add.ronn +29 -0
  216. data/bundler/man/bundle-binstubs.ronn +15 -1
  217. data/bundler/man/bundle-check.ronn +26 -0
  218. data/bundler/man/bundle-clean.ronn +18 -0
  219. data/bundler/man/bundle-config.ronn +193 -69
  220. data/bundler/man/bundle-doctor.ronn +33 -0
  221. data/bundler/man/bundle-exec.ronn +10 -3
  222. data/bundler/man/bundle-gem.ronn +3 -2
  223. data/bundler/man/bundle-info.ronn +17 -0
  224. data/bundler/man/bundle-init.ronn +29 -0
  225. data/bundler/man/bundle-inject.ronn +22 -0
  226. data/bundler/man/bundle-install.ronn +44 -35
  227. data/bundler/man/bundle-list.ronn +15 -0
  228. data/bundler/man/bundle-lock.ronn +1 -1
  229. data/bundler/man/bundle-open.ronn +19 -0
  230. data/bundler/man/bundle-outdated.ronn +2 -2
  231. data/bundler/man/bundle-package.ronn +7 -2
  232. data/bundler/man/bundle-pristine.ronn +34 -0
  233. data/bundler/man/bundle-show.ronn +21 -0
  234. data/bundler/man/bundle-update.ronn +24 -17
  235. data/bundler/man/bundle-viz.ronn +30 -0
  236. data/bundler/man/bundle.ronn +36 -45
  237. data/bundler/man/gemfile.5.ronn +77 -71
  238. data/lib/rubygems.rb +102 -46
  239. data/lib/rubygems/basic_specification.rb +8 -4
  240. data/lib/rubygems/bundler_version_finder.rb +99 -0
  241. data/lib/rubygems/command.rb +10 -2
  242. data/lib/rubygems/command_manager.rb +8 -4
  243. data/lib/rubygems/commands/cert_command.rb +31 -6
  244. data/lib/rubygems/commands/cleanup_command.rb +10 -3
  245. data/lib/rubygems/commands/generate_index_command.rb +1 -1
  246. data/lib/rubygems/commands/help_command.rb +1 -1
  247. data/lib/rubygems/commands/install_command.rb +7 -0
  248. data/lib/rubygems/commands/open_command.rb +1 -1
  249. data/lib/rubygems/commands/owner_command.rb +7 -2
  250. data/lib/rubygems/commands/pristine_command.rb +11 -8
  251. data/lib/rubygems/commands/push_command.rb +39 -5
  252. data/lib/rubygems/commands/query_command.rb +17 -17
  253. data/lib/rubygems/commands/setup_command.rb +174 -69
  254. data/lib/rubygems/commands/signin_command.rb +33 -0
  255. data/lib/rubygems/commands/signout_command.rb +33 -0
  256. data/lib/rubygems/commands/sources_command.rb +1 -1
  257. data/lib/rubygems/commands/uninstall_command.rb +5 -4
  258. data/lib/rubygems/commands/unpack_command.rb +19 -7
  259. data/lib/rubygems/commands/update_command.rb +1 -1
  260. data/lib/rubygems/commands/which_command.rb +1 -1
  261. data/lib/rubygems/commands/yank_command.rb +4 -11
  262. data/lib/rubygems/config_file.rb +15 -26
  263. data/lib/rubygems/core_ext/kernel_require.rb +12 -16
  264. data/lib/rubygems/dependency.rb +3 -0
  265. data/lib/rubygems/dependency_installer.rb +8 -2
  266. data/lib/rubygems/dependency_list.rb +1 -1
  267. data/lib/rubygems/errors.rb +3 -0
  268. data/lib/rubygems/exceptions.rb +11 -1
  269. data/lib/rubygems/ext/builder.rb +2 -2
  270. data/lib/rubygems/ext/ext_conf_builder.rb +2 -4
  271. data/lib/rubygems/ext/rake_builder.rb +1 -1
  272. data/lib/rubygems/gem_runner.rb +5 -1
  273. data/lib/rubygems/gemcutter_utilities.rb +5 -2
  274. data/lib/rubygems/indexer.rb +6 -5
  275. data/lib/rubygems/install_update_options.rb +6 -29
  276. data/lib/rubygems/installer.rb +60 -13
  277. data/lib/rubygems/installer_test_case.rb +6 -3
  278. data/lib/rubygems/package.rb +55 -8
  279. data/lib/rubygems/package/file_source.rb +2 -2
  280. data/lib/rubygems/package/old.rb +3 -3
  281. data/lib/rubygems/package/tar_header.rb +17 -10
  282. data/lib/rubygems/package/tar_writer.rb +4 -3
  283. data/lib/rubygems/platform.rb +1 -1
  284. data/lib/rubygems/remote_fetcher.rb +2 -2
  285. data/lib/rubygems/request.rb +1 -1
  286. data/lib/rubygems/request_set.rb +47 -19
  287. data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
  288. data/lib/rubygems/request_set/lockfile.rb +1 -1
  289. data/lib/rubygems/requirement.rb +19 -4
  290. data/lib/rubygems/resolver.rb +24 -3
  291. data/lib/rubygems/resolver/api_specification.rb +5 -0
  292. data/lib/rubygems/resolver/installer_set.rb +4 -6
  293. data/lib/rubygems/safe_yaml.rb +51 -0
  294. data/lib/rubygems/security.rb +18 -6
  295. data/lib/rubygems/security/trust_dir.rb +1 -1
  296. data/lib/rubygems/security_option.rb +43 -0
  297. data/lib/rubygems/server.rb +21 -17
  298. data/lib/rubygems/source.rb +9 -6
  299. data/lib/rubygems/source/git.rb +2 -1
  300. data/lib/rubygems/source/local.rb +38 -35
  301. data/lib/rubygems/source/lock.rb +4 -1
  302. data/lib/rubygems/source_local.rb +3 -1
  303. data/lib/rubygems/source_specific_file.rb +3 -2
  304. data/lib/rubygems/spec_fetcher.rb +7 -3
  305. data/lib/rubygems/specification.rb +315 -249
  306. data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
  307. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
  308. data/lib/rubygems/stub_specification.rb +4 -3
  309. data/lib/rubygems/test_case.rb +51 -11
  310. data/lib/rubygems/test_utilities.rb +2 -2
  311. data/lib/rubygems/text.rb +14 -1
  312. data/lib/rubygems/user_interaction.rb +24 -15
  313. data/lib/rubygems/util.rb +6 -16
  314. data/lib/rubygems/util/licenses.rb +72 -4
  315. data/lib/rubygems/validator.rb +3 -3
  316. data/lib/rubygems/version.rb +24 -4
  317. data/lib/rubygems/version_option.rb +6 -1
  318. data/lib/ubygems.rb +3 -0
  319. data/setup.rb +1 -1
  320. data/test/rubygems/private3072_key.pem +40 -0
  321. data/test/rubygems/public3072_cert.pem +25 -0
  322. data/test/rubygems/test_bundled_ca.rb +7 -4
  323. data/test/rubygems/test_config.rb +1 -1
  324. data/test/rubygems/test_gem.rb +158 -39
  325. data/test/rubygems/test_gem_bundler_version_finder.rb +126 -0
  326. data/test/rubygems/test_gem_command.rb +7 -1
  327. data/test/rubygems/test_gem_command_manager.rb +2 -2
  328. data/test/rubygems/test_gem_commands_build_command.rb +29 -1
  329. data/test/rubygems/test_gem_commands_cert_command.rb +64 -0
  330. data/test/rubygems/test_gem_commands_cleanup_command.rb +44 -1
  331. data/test/rubygems/test_gem_commands_install_command.rb +73 -2
  332. data/test/rubygems/test_gem_commands_open_command.rb +2 -1
  333. data/test/rubygems/test_gem_commands_owner_command.rb +25 -0
  334. data/test/rubygems/test_gem_commands_pristine_command.rb +1 -1
  335. data/test/rubygems/test_gem_commands_push_command.rb +25 -5
  336. data/test/rubygems/test_gem_commands_query_command.rb +154 -1
  337. data/test/rubygems/test_gem_commands_setup_command.rb +140 -10
  338. data/test/rubygems/test_gem_commands_signin_command.rb +98 -0
  339. data/test/rubygems/test_gem_commands_signout_command.rb +37 -0
  340. data/test/rubygems/test_gem_commands_sources_command.rb +52 -0
  341. data/test/rubygems/test_gem_commands_uninstall_command.rb +15 -3
  342. data/test/rubygems/test_gem_commands_update_command.rb +1 -7
  343. data/test/rubygems/test_gem_commands_which_command.rb +3 -3
  344. data/test/rubygems/test_gem_dependency.rb +28 -0
  345. data/test/rubygems/test_gem_dependency_installer.rb +1 -1
  346. data/test/rubygems/test_gem_doctor.rb +2 -2
  347. data/test/rubygems/test_gem_ext_builder.rb +8 -8
  348. data/test/rubygems/test_gem_ext_configure_builder.rb +1 -1
  349. data/test/rubygems/test_gem_ext_rake_builder.rb +2 -6
  350. data/test/rubygems/test_gem_gemcutter_utilities.rb +4 -4
  351. data/test/rubygems/test_gem_indexer.rb +1 -2
  352. data/test/rubygems/test_gem_install_update_options.rb +6 -1
  353. data/test/rubygems/test_gem_installer.rb +168 -31
  354. data/test/rubygems/test_gem_package.rb +183 -26
  355. data/test/rubygems/test_gem_package_old.rb +1 -1
  356. data/test/rubygems/test_gem_package_tar_header.rb +21 -0
  357. data/test/rubygems/test_gem_rdoc.rb +2 -0
  358. data/test/rubygems/test_gem_remote_fetcher.rb +24 -5
  359. data/test/rubygems/test_gem_request.rb +5 -2
  360. data/test/rubygems/test_gem_request_connection_pools.rb +6 -7
  361. data/test/rubygems/test_gem_request_set.rb +7 -7
  362. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +3 -3
  363. data/test/rubygems/test_gem_request_set_lockfile.rb +4 -4
  364. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +1 -1
  365. data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
  366. data/test/rubygems/test_gem_requirement.rb +12 -0
  367. data/test/rubygems/test_gem_resolver.rb +26 -0
  368. data/test/rubygems/test_gem_resolver_api_specification.rb +24 -0
  369. data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
  370. data/test/rubygems/test_gem_resolver_git_specification.rb +1 -1
  371. data/test/rubygems/test_gem_resolver_installer_set.rb +1 -1
  372. data/test/rubygems/test_gem_security.rb +5 -0
  373. data/test/rubygems/test_gem_security_policy.rb +27 -27
  374. data/test/rubygems/test_gem_security_signer.rb +6 -6
  375. data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
  376. data/test/rubygems/test_gem_server.rb +194 -12
  377. data/test/rubygems/test_gem_source.rb +12 -3
  378. data/test/rubygems/test_gem_source_git.rb +1 -1
  379. data/test/rubygems/test_gem_spec_fetcher.rb +20 -0
  380. data/test/rubygems/test_gem_specification.rb +180 -42
  381. data/test/rubygems/test_gem_stream_ui.rb +8 -8
  382. data/test/rubygems/test_gem_stub_specification.rb +26 -8
  383. data/test/rubygems/test_gem_text.rb +16 -0
  384. data/test/rubygems/test_gem_util.rb +26 -0
  385. data/test/rubygems/test_gem_version.rb +68 -9
  386. data/test/rubygems/test_gem_version_option.rb +15 -0
  387. data/test/rubygems/test_kernel.rb +30 -0
  388. data/test/rubygems/test_require.rb +70 -21
  389. data/util/ci +1 -0
  390. data/util/generate_spdx_license_list.rb +16 -6
  391. data/util/update_bundled_ca_certificates.rb +1 -3
  392. metadata +61 -57
  393. data/README.rdoc +0 -54
  394. data/bundler/DEVELOPMENT.md +0 -150
  395. data/bundler/ISSUES.md +0 -117
  396. data/bundler/lib/bundler/postit_trampoline.rb +0 -73
  397. data/bundler/lib/bundler/vendor/postit/lib/postit.rb +0 -15
  398. data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
  399. data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
  400. data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
  401. data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
  402. data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
  403. data/bundler/man/index.txt +0 -8
  404. data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
  405. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -1,4 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
3
+ require "bundler/compatibility_guard"
4
+
2
5
  # Allows for declaring a Gemfile inline in a ruby script, optionally installing
3
6
  # any gems that aren't already installed on the user's system.
4
7
  #
@@ -39,7 +42,7 @@ def gemfile(install = false, options = {}, &gemfile)
39
42
  def Bundler.root
40
43
  Bundler::SharedHelpers.pwd.expand_path
41
44
  end
42
- ENV["BUNDLE_GEMFILE"] ||= "Gemfile"
45
+ Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
43
46
 
44
47
  Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
45
48
  builder = Bundler::Dsl.new
@@ -50,19 +53,16 @@ def gemfile(install = false, options = {}, &gemfile)
50
53
  definition.validate_runtime!
51
54
 
52
55
  missing_specs = proc do
53
- begin
54
- !definition.missing_specs.empty?
55
- rescue Bundler::GemNotFound, Bundler::GitError
56
- definition.instance_variable_set(:@index, nil)
57
- true
58
- end
56
+ definition.missing_specs?
59
57
  end
60
58
 
61
59
  Bundler.ui = ui if install
62
60
  if install || missing_specs.call
63
- installer = Bundler::Installer.install(Bundler.root, definition, :system => true, :inline => true)
64
- installer.post_install_messages.each do |name, message|
65
- Bundler.ui.info "Post-install message from #{name}:\n#{message}"
61
+ Bundler.settings.temporary(:inline => true) do
62
+ installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
63
+ installer.post_install_messages.each do |name, message|
64
+ Bundler.ui.info "Post-install message from #{name}:\n#{message}"
65
+ end
66
66
  end
67
67
  end
68
68
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "erb"
3
4
  require "rubygems/dependency_installer"
4
5
  require "bundler/worker"
@@ -33,25 +34,26 @@ module Bundler
33
34
 
34
35
  # Runs the install procedures for a specific Gemfile.
35
36
  #
36
- # Firstly, this method will check to see if Bundler.bundle_path exists
37
- # and if not then will create it. This is usually the location of gems
38
- # on the system, be it RVM or at a system path.
37
+ # Firstly, this method will check to see if `Bundler.bundle_path` exists
38
+ # and if not then Bundler will create the directory. This is usually the same
39
+ # location as RubyGems which typically is the `~/.gem` directory
40
+ # unless other specified.
39
41
  #
40
- # Secondly, it checks if Bundler has been configured to be "frozen"
42
+ # Secondly, it checks if Bundler has been configured to be "frozen".
41
43
  # Frozen ensures that the Gemfile and the Gemfile.lock file are matching.
42
44
  # This stops a situation where a developer may update the Gemfile but may not run
43
45
  # `bundle install`, which leads to the Gemfile.lock file not being correctly updated.
44
46
  # If this file is not correctly updated then any other developer running
45
47
  # `bundle install` will potentially not install the correct gems.
46
48
  #
47
- # Thirdly, Bundler checks if there are any dependencies specified in the Gemfile using
48
- # Bundler::Environment#dependencies. If there are no dependencies specified then
49
- # Bundler returns a warning message stating so and this method returns.
49
+ # Thirdly, Bundler checks if there are any dependencies specified in the Gemfile.
50
+ # If there are no dependencies specified then Bundler returns a warning message stating
51
+ # so and this method returns.
50
52
  #
51
- # Fourthly, Bundler checks if the default lockfile (Gemfile.lock) exists, and if so
52
- # then proceeds to set up a defintion based on the default gemfile (Gemfile) and the
53
- # default lock file (Gemfile.lock). However, this is not the case if the platform is different
54
- # to that which is specified in Gemfile.lock, or if there are any missing specs for the gems.
53
+ # Fourthly, Bundler checks if the Gemfile.lock exists, and if so
54
+ # then proceeds to set up a definition based on the Gemfile and the Gemfile.lock.
55
+ # During this step Bundler will also download information about any new gems
56
+ # that are not in the Gemfile.lock and resolve any dependencies if needed.
55
57
  #
56
58
  # Fifthly, Bundler resolves the dependencies either through a cache of gems or by remote.
57
59
  # This then leads into the gems being installed, along with stubs for their executables,
@@ -61,26 +63,36 @@ module Bundler
61
63
  # Sixthly, a new Gemfile.lock is created from the installed gems to ensure that the next time
62
64
  # that a user runs `bundle install` they will receive any updates from this process.
63
65
  #
64
- # Finally: TODO add documentation for how the standalone process works.
66
+ # Finally, if the user has specified the standalone flag, Bundler will generate the needed
67
+ # require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
68
+ # information.
65
69
  def run(options)
66
70
  create_bundle_path
67
71
 
68
- if Bundler.settings[:frozen]
69
- @definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
70
- end
72
+ ProcessLock.lock do
73
+ if Bundler.frozen_bundle?
74
+ @definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
75
+ end
71
76
 
72
- if @definition.dependencies.empty?
73
- Bundler.ui.warn "The Gemfile specifies no dependencies"
74
- lock
75
- return
76
- end
77
+ if @definition.dependencies.empty?
78
+ Bundler.ui.warn "The Gemfile specifies no dependencies"
79
+ lock
80
+ return
81
+ end
77
82
 
78
- resolve_if_need(options)
79
- ensure_specs_are_compatible!
80
- install(options)
83
+ if resolve_if_needed(options)
84
+ ensure_specs_are_compatible!
85
+ warn_on_incompatible_bundler_deps
86
+ load_plugins
87
+ options.delete(:jobs)
88
+ else
89
+ options[:jobs] = 1 # to avoid the overhead of Bundler::Worker
90
+ end
91
+ install(options)
81
92
 
82
- lock unless Bundler.settings[:frozen]
83
- Standalone.new(options[:standalone], @definition).generate if options[:standalone]
93
+ lock unless Bundler.frozen_bundle?
94
+ Standalone.new(options[:standalone], @definition).generate if options[:standalone]
95
+ end
84
96
  end
85
97
 
86
98
  def generate_bundler_executable_stubs(spec, options = {})
@@ -101,15 +113,21 @@ module Bundler
101
113
  end
102
114
 
103
115
  # double-assignment to avoid warnings about variables that will be used by ERB
104
- bin_path = bin_path = Bundler.bin_path
105
- template = template = File.read(File.expand_path("../templates/Executable", __FILE__))
106
- relative_gemfile_path = relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path)
107
- ruby_command = ruby_command = Thor::Util.ruby_command
116
+ bin_path = Bundler.bin_path
117
+ bin_path = bin_path
118
+ relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path)
119
+ relative_gemfile_path = relative_gemfile_path
120
+ ruby_command = Thor::Util.ruby_command
121
+ ruby_command = ruby_command
122
+ template_path = File.expand_path("../templates/Executable", __FILE__)
123
+ if spec.name == "bundler"
124
+ template_path += ".bundler"
125
+ spec.executables = %(bundle)
126
+ end
127
+ template = File.read(template_path)
108
128
 
109
129
  exists = []
110
130
  spec.executables.each do |executable|
111
- next if executable == "bundle"
112
-
113
131
  binstub_path = "#{bin_path}/#{executable}"
114
132
  if File.exist?(binstub_path) && !options[:force]
115
133
  exists << executable
@@ -117,7 +135,11 @@ module Bundler
117
135
  end
118
136
 
119
137
  File.open(binstub_path, "w", 0o777 & ~File.umask) do |f|
120
- f.puts ERB.new(template, nil, "-").result(binding)
138
+ if RUBY_VERSION >= "2.6"
139
+ f.puts ERB.new(template, :trim_mode => "-").result(binding)
140
+ else
141
+ f.puts ERB.new(template, nil, "-").result(binding)
142
+ end
121
143
  end
122
144
  end
123
145
 
@@ -139,15 +161,25 @@ module Bundler
139
161
  def generate_standalone_bundler_executable_stubs(spec)
140
162
  # double-assignment to avoid warnings about variables that will be used by ERB
141
163
  bin_path = Bundler.bin_path
142
- standalone_path = standalone_path = Bundler.root.join(Bundler.settings[:path]).relative_path_from(bin_path)
164
+ unless path = Bundler.settings[:path]
165
+ raise "Can't standalone without an explicit path set"
166
+ end
167
+ standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
168
+ standalone_path = standalone_path
143
169
  template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__))
144
- ruby_command = ruby_command = Thor::Util.ruby_command
170
+ ruby_command = Thor::Util.ruby_command
171
+ ruby_command = ruby_command
145
172
 
146
173
  spec.executables.each do |executable|
147
174
  next if executable == "bundle"
148
- executable_path = executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
175
+ executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
176
+ executable_path = executable_path
149
177
  File.open "#{bin_path}/#{executable}", "w", 0o755 do |f|
150
- f.puts ERB.new(template, nil, "-").result(binding)
178
+ if RUBY_VERSION >= "2.6"
179
+ f.puts ERB.new(template, :trim_mode => "-").result(binding)
180
+ else
181
+ f.puts ERB.new(template, nil, "-").result(binding)
182
+ end
151
183
  end
152
184
  end
153
185
  end
@@ -159,13 +191,32 @@ module Bundler
159
191
  # that said, it's a rare situation (other than rake), and parallel
160
192
  # installation is SO MUCH FASTER. so we let people opt in.
161
193
  def install(options)
162
- Bundler.rubygems.load_plugins
163
194
  force = options["force"]
164
- jobs = 1
165
- jobs = [Bundler.settings[:jobs].to_i - 1, 1].max if can_install_in_parallel?
195
+ jobs = options.delete(:jobs) do
196
+ if can_install_in_parallel?
197
+ [Bundler.settings[:jobs].to_i - 1, 1].max
198
+ else
199
+ 1
200
+ end
201
+ end
166
202
  install_in_parallel jobs, options[:standalone], force
167
203
  end
168
204
 
205
+ def load_plugins
206
+ Bundler.rubygems.load_plugins
207
+
208
+ requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
209
+ path_plugin_files = requested_path_gems.map do |spec|
210
+ begin
211
+ Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
212
+ rescue TypeError
213
+ error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
214
+ raise Gem::InvalidSpecificationException, error_message
215
+ end
216
+ end.flatten
217
+ Bundler.rubygems.load_plugin_files(path_plugin_files)
218
+ end
219
+
169
220
  def ensure_specs_are_compatible!
170
221
  system_ruby = Bundler::RubyVersion.system
171
222
  rubygems_version = Gem::Version.create(Gem::VERSION)
@@ -184,12 +235,28 @@ module Bundler
184
235
  end
185
236
  end
186
237
 
238
+ def warn_on_incompatible_bundler_deps
239
+ bundler_version = Gem::Version.create(Bundler::VERSION)
240
+ @definition.specs.each do |spec|
241
+ spec.dependencies.each do |dep|
242
+ next if dep.type == :development
243
+ next unless dep.name == "bundler".freeze
244
+ next if dep.requirement.satisfied_by?(bundler_version)
245
+
246
+ Bundler.ui.warn "#{spec.name} (#{spec.version}) has dependency" \
247
+ " #{SharedHelpers.pretty_dependency(dep)}" \
248
+ ", which is unsatisfied by the current bundler version #{VERSION}" \
249
+ ", so the dependency is being ignored"
250
+ end
251
+ end
252
+ end
253
+
187
254
  def can_install_in_parallel?
188
255
  if Bundler.rubygems.provides?(">= 2.1.0")
189
256
  true
190
257
  else
191
- Bundler.ui.warn "Rubygems #{Gem::VERSION} is not threadsafe, so your "\
192
- "gems will be installed one at a time. Upgrade to Rubygems 2.1.0 " \
258
+ Bundler.ui.warn "RubyGems #{Gem::VERSION} is not threadsafe, so your "\
259
+ "gems will be installed one at a time. Upgrade to RubyGems 2.1.0 " \
193
260
  "or higher to enable parallel gem installation."
194
261
  false
195
262
  end
@@ -207,23 +274,18 @@ module Bundler
207
274
  Bundler.mkdir_p(p)
208
275
  end unless Bundler.bundle_path.exist?
209
276
  rescue Errno::EEXIST
210
- raise PathError, "Could not install to path `#{Bundler.settings[:path]}` " \
277
+ raise PathError, "Could not install to path `#{Bundler.bundle_path}` " \
211
278
  "because a file already exists at that path. Either remove or rename the file so the directory can be created."
212
279
  end
213
280
 
214
- def resolve_if_need(options)
215
- if Bundler.default_lockfile.exist? && !options["update"] && !options[:inline]
216
- local = Bundler.ui.silence do
217
- begin
218
- tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil)
219
- true unless tmpdef.new_platform? || tmpdef.missing_dependencies.any?
220
- rescue BundlerError
221
- end
222
- end
281
+ # returns whether or not a re-resolve was needed
282
+ def resolve_if_needed(options)
283
+ if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
284
+ return false if @definition.nothing_changed? && !@definition.missing_specs?
223
285
  end
224
286
 
225
- return if local
226
287
  options["local"] ? @definition.resolve_with_cache! : @definition.resolve_remotely!
288
+ true
227
289
  end
228
290
 
229
291
  def lock(opts = {})
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Bundler
3
4
  class GemInstaller
4
5
  attr_reader :spec, :standalone, :worker, :force, :installer
@@ -16,11 +17,11 @@ module Bundler
16
17
  Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
17
18
  generate_executable_stubs
18
19
  return true, post_install_message
19
- rescue Bundler::InstallHookError, Bundler::SecurityError
20
+ rescue Bundler::InstallHookError, Bundler::SecurityError, APIResponseMismatchError
20
21
  raise
21
22
  rescue Errno::ENOSPC
22
23
  return false, out_of_space_message
23
- rescue => e
24
+ rescue StandardError => e
24
25
  return false, specific_failure_message(e)
25
26
  end
26
27
 
@@ -43,7 +44,14 @@ module Bundler
43
44
  end
44
45
 
45
46
  def gem_install_message
46
- "Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling."
47
+ source = spec.source
48
+ return unless source.respond_to?(:remotes)
49
+
50
+ if source.remotes.size == 1
51
+ "Make sure that `gem install #{spec.name} -v '#{spec.version}' --source '#{source.remotes.first}'` succeeds before bundling."
52
+ else
53
+ "Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling."
54
+ end
47
55
  end
48
56
 
49
57
  def spec_settings
@@ -52,7 +60,7 @@ module Bundler
52
60
  end
53
61
 
54
62
  def install
55
- spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone, :build_args => [spec_settings])
63
+ spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone, :build_args => Array(spec_settings))
56
64
  end
57
65
 
58
66
  def install_with_settings
@@ -65,6 +73,8 @@ module Bundler
65
73
  end
66
74
 
67
75
  def generate_executable_stubs
76
+ return if Bundler.feature_flag.forget_cli_options?
77
+ return if Bundler.settings[:inline]
68
78
  if Bundler.settings[:bin] && standalone
69
79
  installer.generate_standalone_bundler_executable_stubs(spec)
70
80
  elsif Bundler.settings[:bin]
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "bundler/worker"
3
4
  require "bundler/installer/gem_installer"
4
5
 
@@ -67,17 +68,16 @@ module Bundler
67
68
  def all_dependencies
68
69
  @spec.dependencies
69
70
  end
71
+
72
+ def to_s
73
+ "#<#{self.class} #{@spec.full_name} (#{state})>"
74
+ end
70
75
  end
71
76
 
72
77
  def self.call(*args)
73
78
  new(*args).call
74
79
  end
75
80
 
76
- # Returns max number of threads machine can handle with a min of 1
77
- def self.max_threads
78
- [Bundler.settings[:jobs].to_i - 1, 1].max
79
- end
80
-
81
81
  attr_reader :size
82
82
 
83
83
  def initialize(installer, all_specs, size, standalone, force)
@@ -86,6 +86,7 @@ module Bundler
86
86
  @standalone = standalone
87
87
  @force = force
88
88
  @specs = all_specs.map {|s| SpecInstallation.new(s) }
89
+ @spec_set = all_specs
89
90
  end
90
91
 
91
92
  def call
@@ -94,49 +95,19 @@ module Bundler
94
95
  require "bundler/gem_remote_fetcher" if RUBY_VERSION < "1.9"
95
96
 
96
97
  check_for_corrupt_lockfile
97
- enqueue_specs
98
- process_specs until @specs.all?(&:installed?) || @specs.any?(&:failed?)
98
+
99
+ if @size > 1
100
+ install_with_worker
101
+ else
102
+ install_serially
103
+ end
104
+
99
105
  handle_error if @specs.any?(&:failed?)
100
106
  @specs
101
107
  ensure
102
108
  worker_pool && worker_pool.stop
103
109
  end
104
110
 
105
- def worker_pool
106
- @worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda { |spec_install, worker_num|
107
- gem_installer = Bundler::GemInstaller.new(
108
- spec_install.spec, @installer, @standalone, worker_num, @force
109
- )
110
- success, message = gem_installer.install_from_spec
111
- if success && !message.nil?
112
- spec_install.post_install_message = message
113
- elsif !success
114
- spec_install.state = :failed
115
- spec_install.error = message
116
- end
117
- spec_install
118
- }
119
- end
120
-
121
- # Dequeue a spec and save its post-install message and then enqueue the
122
- # remaining specs.
123
- # Some specs might've had to wait til this spec was installed to be
124
- # processed so the call to `enqueue_specs` is important after every
125
- # dequeue.
126
- def process_specs
127
- spec = worker_pool.deq
128
- spec.state = :installed unless spec.failed?
129
- enqueue_specs
130
- end
131
-
132
- def handle_error
133
- errors = @specs.select(&:failed?).map(&:error)
134
- if exception = errors.find {|e| e.is_a?(Bundler::BundlerError) }
135
- raise exception
136
- end
137
- raise Bundler::InstallError, errors.map(&:to_s).join("\n\n")
138
- end
139
-
140
111
  def check_for_corrupt_lockfile
141
112
  missing_dependencies = @specs.map do |s|
142
113
  [
@@ -162,6 +133,84 @@ module Bundler
162
133
  Bundler.ui.warn(warning.join("\n"))
163
134
  end
164
135
 
136
+ private
137
+
138
+ def install_with_worker
139
+ enqueue_specs
140
+ process_specs until finished_installing?
141
+ end
142
+
143
+ def install_serially
144
+ until finished_installing?
145
+ raise "failed to find a spec to enqueue while installing serially" unless spec_install = @specs.find(&:ready_to_enqueue?)
146
+ spec_install.state = :enqueued
147
+ do_install(spec_install, 0)
148
+ end
149
+ end
150
+
151
+ def worker_pool
152
+ @worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda { |spec_install, worker_num|
153
+ do_install(spec_install, worker_num)
154
+ }
155
+ end
156
+
157
+ def do_install(spec_install, worker_num)
158
+ gem_installer = Bundler::GemInstaller.new(
159
+ spec_install.spec, @installer, @standalone, worker_num, @force
160
+ )
161
+ success, message = begin
162
+ gem_installer.install_from_spec
163
+ rescue RuntimeError => e
164
+ raise e, "#{e}\n\n#{require_tree_for_spec(spec_install.spec)}"
165
+ end
166
+ if success
167
+ spec_install.state = :installed
168
+ spec_install.post_install_message = message unless message.nil?
169
+ else
170
+ spec_install.state = :failed
171
+ spec_install.error = "#{message}\n\n#{require_tree_for_spec(spec_install.spec)}"
172
+ end
173
+ spec_install
174
+ end
175
+
176
+ # Dequeue a spec and save its post-install message and then enqueue the
177
+ # remaining specs.
178
+ # Some specs might've had to wait til this spec was installed to be
179
+ # processed so the call to `enqueue_specs` is important after every
180
+ # dequeue.
181
+ def process_specs
182
+ worker_pool.deq
183
+ enqueue_specs
184
+ end
185
+
186
+ def finished_installing?
187
+ @specs.all? do |spec|
188
+ return true if spec.failed?
189
+ spec.installed?
190
+ end
191
+ end
192
+
193
+ def handle_error
194
+ errors = @specs.select(&:failed?).map(&:error)
195
+ if exception = errors.find {|e| e.is_a?(Bundler::BundlerError) }
196
+ raise exception
197
+ end
198
+ raise Bundler::InstallError, errors.map(&:to_s).join("\n\n")
199
+ end
200
+
201
+ def require_tree_for_spec(spec)
202
+ tree = @spec_set.what_required(spec)
203
+ t = String.new("In #{File.basename(SharedHelpers.default_gemfile)}:\n")
204
+ tree.each_with_index do |s, depth|
205
+ t << " " * depth.succ << s.name
206
+ unless tree.last == s
207
+ t << %( was resolved to #{s.version}, which depends on)
208
+ end
209
+ t << %(\n)
210
+ end
211
+ t
212
+ end
213
+
165
214
  # Keys in the remains hash represent uninstalled gems specs.
166
215
  # We enqueue all gem specs that do not have any dependencies.
167
216
  # Later we call this lambda again to install specs that depended on