bundler 2.1.4 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (338) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2468 -1430
  3. data/README.md +8 -10
  4. data/bundler.gemspec +10 -13
  5. data/exe/bundle +7 -8
  6. data/exe/bundler +1 -1
  7. data/lib/bundler/.document +1 -0
  8. data/lib/bundler/build_metadata.rb +3 -11
  9. data/lib/bundler/cli/add.rb +2 -2
  10. data/lib/bundler/cli/binstubs.rb +6 -2
  11. data/lib/bundler/cli/cache.rb +3 -8
  12. data/lib/bundler/cli/check.rb +5 -3
  13. data/lib/bundler/cli/clean.rb +1 -1
  14. data/lib/bundler/cli/common.rb +32 -3
  15. data/lib/bundler/cli/config.rb +10 -1
  16. data/lib/bundler/cli/console.rb +3 -3
  17. data/lib/bundler/cli/doctor.rb +23 -6
  18. data/lib/bundler/cli/exec.rb +5 -10
  19. data/lib/bundler/cli/fund.rb +36 -0
  20. data/lib/bundler/cli/gem.rb +258 -45
  21. data/lib/bundler/cli/info.rb +38 -6
  22. data/lib/bundler/cli/init.rb +7 -3
  23. data/lib/bundler/cli/inject.rb +1 -1
  24. data/lib/bundler/cli/install.rb +27 -57
  25. data/lib/bundler/cli/issue.rb +5 -4
  26. data/lib/bundler/cli/list.rb +19 -11
  27. data/lib/bundler/cli/lock.rb +11 -4
  28. data/lib/bundler/cli/open.rb +1 -2
  29. data/lib/bundler/cli/outdated.rb +106 -79
  30. data/lib/bundler/cli/platform.rb +2 -2
  31. data/lib/bundler/cli/plugin.rb +10 -0
  32. data/lib/bundler/cli/pristine.rb +5 -0
  33. data/lib/bundler/cli/remove.rb +1 -2
  34. data/lib/bundler/cli/show.rb +2 -2
  35. data/lib/bundler/cli/update.rb +20 -9
  36. data/lib/bundler/cli/viz.rb +1 -1
  37. data/lib/bundler/cli.rb +149 -85
  38. data/lib/bundler/compact_index_client/cache.rb +7 -24
  39. data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  40. data/lib/bundler/compact_index_client/updater.rb +56 -51
  41. data/lib/bundler/compact_index_client.rb +3 -9
  42. data/lib/bundler/constants.rb +1 -1
  43. data/lib/bundler/current_ruby.rb +17 -6
  44. data/lib/bundler/definition.rb +343 -440
  45. data/lib/bundler/dependency.rb +23 -77
  46. data/lib/bundler/digest.rb +71 -0
  47. data/lib/bundler/dsl.rb +77 -85
  48. data/lib/bundler/endpoint_specification.rb +20 -14
  49. data/lib/bundler/env.rb +3 -3
  50. data/lib/bundler/environment_preserver.rb +30 -2
  51. data/lib/bundler/errors.rb +31 -14
  52. data/lib/bundler/feature_flag.rb +0 -9
  53. data/lib/bundler/fetcher/base.rb +7 -9
  54. data/lib/bundler/fetcher/compact_index.rb +20 -27
  55. data/lib/bundler/fetcher/dependency.rb +1 -1
  56. data/lib/bundler/fetcher/downloader.rb +11 -11
  57. data/lib/bundler/fetcher/index.rb +2 -30
  58. data/lib/bundler/fetcher.rb +24 -29
  59. data/lib/bundler/force_platform.rb +18 -0
  60. data/lib/bundler/friendly_errors.rb +45 -49
  61. data/lib/bundler/gem_helper.rb +53 -31
  62. data/lib/bundler/gem_helpers.rb +42 -24
  63. data/lib/bundler/gem_version_promoter.rb +54 -99
  64. data/lib/bundler/graph.rb +4 -4
  65. data/lib/bundler/index.rb +14 -52
  66. data/lib/bundler/injector.rb +40 -8
  67. data/lib/bundler/inline.rb +6 -15
  68. data/lib/bundler/installer/gem_installer.rb +19 -24
  69. data/lib/bundler/installer/parallel_installer.rb +32 -42
  70. data/lib/bundler/installer/standalone.rb +58 -11
  71. data/lib/bundler/installer.rb +47 -87
  72. data/lib/bundler/lazy_specification.rb +76 -35
  73. data/lib/bundler/lockfile_generator.rb +3 -3
  74. data/lib/bundler/lockfile_parser.rb +24 -49
  75. data/lib/bundler/man/.document +1 -0
  76. data/{man → lib/bundler/man}/bundle-add.1 +21 -5
  77. data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +16 -4
  78. data/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
  79. data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
  80. data/{man → lib/bundler/man}/bundle-cache.1 +7 -1
  81. data/{man/bundle-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +7 -0
  82. data/{man → lib/bundler/man}/bundle-check.1 +1 -1
  83. data/{man → lib/bundler/man}/bundle-clean.1 +2 -2
  84. data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
  85. data/{man → lib/bundler/man}/bundle-config.1 +65 -47
  86. data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +74 -65
  87. data/lib/bundler/man/bundle-console.1 +53 -0
  88. data/lib/bundler/man/bundle-console.1.ronn +44 -0
  89. data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  90. data/{man → lib/bundler/man}/bundle-exec.1 +2 -2
  91. data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
  92. data/lib/bundler/man/bundle-gem.1 +105 -0
  93. data/lib/bundler/man/bundle-gem.1.ronn +117 -0
  94. data/lib/bundler/man/bundle-help.1 +13 -0
  95. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  96. data/{man → lib/bundler/man}/bundle-info.1 +1 -1
  97. data/{man → lib/bundler/man}/bundle-init.1 +1 -1
  98. data/{man → lib/bundler/man}/bundle-inject.1 +5 -2
  99. data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
  100. data/{man → lib/bundler/man}/bundle-install.1 +35 -33
  101. data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +33 -34
  102. data/{man → lib/bundler/man}/bundle-list.1 +7 -7
  103. data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
  104. data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  105. data/{man → lib/bundler/man}/bundle-open.1 +1 -1
  106. data/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
  107. data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
  108. data/{man → lib/bundler/man}/bundle-platform.1 +16 -6
  109. data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
  110. data/lib/bundler/man/bundle-plugin.1 +81 -0
  111. data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  112. data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  113. data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  114. data/{man → lib/bundler/man}/bundle-show.1 +1 -1
  115. data/{man → lib/bundler/man}/bundle-update.1 +5 -5
  116. data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +5 -4
  117. data/lib/bundler/man/bundle-version.1 +35 -0
  118. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  119. data/{man → lib/bundler/man}/bundle-viz.1 +4 -1
  120. data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
  121. data/{man → lib/bundler/man}/bundle.1 +15 -10
  122. data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +12 -7
  123. data/{man → lib/bundler/man}/gemfile.5 +120 -83
  124. data/{man → lib/bundler/man}/gemfile.5.ronn +109 -88
  125. data/{man → lib/bundler/man}/index.txt +4 -0
  126. data/lib/bundler/match_metadata.rb +13 -0
  127. data/lib/bundler/match_platform.rb +0 -1
  128. data/lib/bundler/match_remote_metadata.rb +29 -0
  129. data/lib/bundler/mirror.rb +7 -9
  130. data/lib/bundler/plugin/api/source.rb +25 -9
  131. data/lib/bundler/plugin/dsl.rb +1 -1
  132. data/lib/bundler/plugin/index.rb +17 -5
  133. data/lib/bundler/plugin/installer/git.rb +0 -4
  134. data/lib/bundler/plugin/installer/rubygems.rb +1 -9
  135. data/lib/bundler/plugin/installer.rb +11 -11
  136. data/lib/bundler/plugin/source_list.rb +5 -1
  137. data/lib/bundler/plugin.rb +58 -11
  138. data/lib/bundler/process_lock.rb +1 -1
  139. data/lib/bundler/remote_specification.rb +15 -6
  140. data/lib/bundler/resolver/base.rb +46 -0
  141. data/lib/bundler/resolver/candidate.rb +92 -0
  142. data/lib/bundler/resolver/incompatibility.rb +15 -0
  143. data/lib/bundler/resolver/package.rb +63 -0
  144. data/lib/bundler/resolver/root.rb +25 -0
  145. data/lib/bundler/resolver/spec_group.rb +49 -74
  146. data/lib/bundler/resolver.rb +320 -344
  147. data/lib/bundler/retry.rb +2 -2
  148. data/lib/bundler/ruby_dsl.rb +1 -1
  149. data/lib/bundler/ruby_version.rb +6 -19
  150. data/lib/bundler/rubygems_ext.rb +231 -32
  151. data/lib/bundler/rubygems_gem_installer.rb +89 -16
  152. data/lib/bundler/rubygems_integration.rb +72 -162
  153. data/lib/bundler/runtime.rb +23 -31
  154. data/lib/bundler/self_manager.rb +168 -0
  155. data/lib/bundler/settings.rb +145 -72
  156. data/lib/bundler/setup.rb +2 -2
  157. data/lib/bundler/shared_helpers.rb +19 -34
  158. data/lib/bundler/similarity_detector.rb +1 -1
  159. data/lib/bundler/source/git/git_proxy.rb +244 -114
  160. data/lib/bundler/source/git.rb +62 -46
  161. data/lib/bundler/source/metadata.rb +3 -8
  162. data/lib/bundler/source/path/installer.rb +11 -32
  163. data/lib/bundler/source/path.rb +15 -9
  164. data/lib/bundler/source/rubygems/remote.rb +1 -1
  165. data/lib/bundler/source/rubygems.rb +167 -199
  166. data/lib/bundler/source/rubygems_aggregate.rb +68 -0
  167. data/lib/bundler/source.rb +25 -5
  168. data/lib/bundler/source_list.rb +112 -64
  169. data/lib/bundler/source_map.rb +71 -0
  170. data/lib/bundler/spec_set.rb +64 -61
  171. data/lib/bundler/stub_specification.rb +30 -10
  172. data/lib/bundler/templates/Executable +3 -5
  173. data/lib/bundler/templates/Executable.bundler +10 -15
  174. data/lib/bundler/templates/Executable.standalone +4 -4
  175. data/lib/bundler/templates/Gemfile +0 -2
  176. data/lib/bundler/templates/gems.rb +0 -3
  177. data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  178. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
  179. data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  180. data/lib/bundler/templates/newgem/Gemfile.tt +15 -1
  181. data/lib/bundler/templates/newgem/README.md.tt +13 -16
  182. data/lib/bundler/templates/newgem/Rakefile.tt +33 -5
  183. data/lib/bundler/templates/newgem/bin/console.tt +1 -0
  184. data/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
  185. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  186. data/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +2 -0
  187. data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  188. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  189. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
  190. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  191. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
  192. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
  193. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
  194. data/lib/bundler/templates/newgem/newgem.gemspec.tt +34 -18
  195. data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
  196. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  197. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
  198. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
  199. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  200. data/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
  201. data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
  202. data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
  203. data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
  204. data/lib/bundler/ui/shell.rb +37 -14
  205. data/lib/bundler/ui/silent.rb +21 -5
  206. data/lib/bundler/uri_credentials_filter.rb +3 -1
  207. data/lib/bundler/vendor/.document +1 -0
  208. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  209. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  210. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  211. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
  212. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +41 -74
  213. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  214. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
  215. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  216. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +82 -189
  217. data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  218. data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  219. data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  220. data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  221. data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +151 -0
  222. data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  223. data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  224. data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  225. data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  226. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +53 -0
  227. data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  228. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  229. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +124 -0
  230. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +409 -0
  231. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +240 -0
  232. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  233. data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  234. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  235. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
  236. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
  237. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  238. data/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
  239. data/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
  240. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  241. data/lib/bundler/vendor/thor/lib/thor/error.rb +10 -5
  242. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  243. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
  244. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +28 -7
  245. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  246. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  247. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  248. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  249. data/lib/bundler/vendor/thor/lib/thor.rb +5 -13
  250. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  251. data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  252. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  253. data/lib/bundler/vendor/uri/lib/uri/common.rb +76 -91
  254. data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
  255. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
  256. data/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
  257. data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
  258. data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
  259. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
  260. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  261. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
  262. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +14 -21
  263. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -17
  264. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  265. data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
  266. data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
  267. data/lib/bundler/vendor/uri/lib/uri.rb +3 -3
  268. data/lib/bundler/vendored_persistent.rb +1 -40
  269. data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
  270. data/lib/bundler/vendored_tsort.rb +4 -0
  271. data/lib/bundler/version.rb +5 -1
  272. data/lib/bundler/worker.rb +25 -12
  273. data/lib/bundler/yaml_serializer.rb +1 -1
  274. data/lib/bundler.rb +95 -108
  275. metadata +132 -118
  276. data/lib/bundler/dep_proxy.rb +0 -48
  277. data/lib/bundler/gemdeps.rb +0 -29
  278. data/lib/bundler/psyched_yaml.rb +0 -37
  279. data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  280. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
  281. data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
  282. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  283. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
  284. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  285. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  286. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  287. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  288. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  289. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  290. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  291. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  292. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -158
  293. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
  294. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
  295. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  296. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
  297. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  298. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
  299. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  300. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  301. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
  302. data/lib/bundler/version_ranges.rb +0 -122
  303. data/man/bundle-add.1.txt +0 -58
  304. data/man/bundle-binstubs.1.txt +0 -48
  305. data/man/bundle-cache.1.txt +0 -78
  306. data/man/bundle-check.1.txt +0 -33
  307. data/man/bundle-clean.1.txt +0 -26
  308. data/man/bundle-config.1.txt +0 -528
  309. data/man/bundle-doctor.1.txt +0 -44
  310. data/man/bundle-exec.1.txt +0 -178
  311. data/man/bundle-gem.1 +0 -80
  312. data/man/bundle-gem.1.txt +0 -91
  313. data/man/bundle-gem.ronn +0 -78
  314. data/man/bundle-info.1.txt +0 -21
  315. data/man/bundle-init.1.txt +0 -34
  316. data/man/bundle-inject.1.txt +0 -32
  317. data/man/bundle-install.1.txt +0 -401
  318. data/man/bundle-list.1.txt +0 -43
  319. data/man/bundle-lock.1.txt +0 -93
  320. data/man/bundle-open.1.txt +0 -29
  321. data/man/bundle-outdated.1.txt +0 -131
  322. data/man/bundle-platform.1.txt +0 -57
  323. data/man/bundle-pristine.1.txt +0 -44
  324. data/man/bundle-remove.1.txt +0 -34
  325. data/man/bundle-show.1.txt +0 -27
  326. data/man/bundle-update.1.txt +0 -390
  327. data/man/bundle-viz.1.txt +0 -39
  328. data/man/bundle.1.txt +0 -116
  329. data/man/gemfile.5.txt +0 -649
  330. /data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
  331. /data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
  332. /data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
  333. /data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +0 -0
  334. /data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
  335. /data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
  336. /data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
  337. /data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
  338. /data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
@@ -20,18 +20,38 @@ module Bundler
20
20
  @dependency_names = []
21
21
  @allow_remote = false
22
22
  @allow_cached = false
23
+ @allow_local = options["allow_local"] || false
23
24
  @caches = [cache_path, *Bundler.rubygems.gem_cache]
24
25
 
25
- Array(options["remotes"] || []).reverse_each {|r| add_remote(r) }
26
+ Array(options["remotes"]).reverse_each {|r| add_remote(r) }
27
+ end
28
+
29
+ def local_only!
30
+ @specs = nil
31
+ @allow_local = true
32
+ @allow_cached = false
33
+ @allow_remote = false
34
+ end
35
+
36
+ def local!
37
+ return if @allow_local
38
+
39
+ @specs = nil
40
+ @allow_local = true
26
41
  end
27
42
 
28
43
  def remote!
44
+ return if @allow_remote
45
+
29
46
  @specs = nil
30
47
  @allow_remote = true
31
48
  end
32
49
 
33
50
  def cached!
51
+ return if @allow_cached
52
+
34
53
  @specs = nil
54
+ @allow_local = true
35
55
  @allow_cached = true
36
56
  end
37
57
 
@@ -49,9 +69,17 @@ module Bundler
49
69
  o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
50
70
  end
51
71
 
72
+ def multiple_remotes?
73
+ @remotes.size > 1
74
+ end
75
+
76
+ def no_remotes?
77
+ @remotes.size == 0
78
+ end
79
+
52
80
  def can_lock?(spec)
53
- return super if Bundler.feature_flag.disable_multisource?
54
- spec.source.is_a?(Rubygems)
81
+ return super unless multiple_remotes?
82
+ include?(spec.source)
55
83
  end
56
84
 
57
85
  def options
@@ -73,12 +101,27 @@ module Bundler
73
101
  def to_s
74
102
  if remotes.empty?
75
103
  "locally installed gems"
76
- else
77
- remote_names = remotes.map(&:to_s).join(", ")
104
+ elsif @allow_remote && @allow_cached && @allow_local
105
+ "rubygems repository #{remote_names}, cached gems or installed locally"
106
+ elsif @allow_remote && @allow_local
78
107
  "rubygems repository #{remote_names} or installed locally"
108
+ elsif @allow_remote
109
+ "rubygems repository #{remote_names}"
110
+ elsif @allow_cached && @allow_local
111
+ "cached gems or installed locally"
112
+ else
113
+ "locally installed gems"
79
114
  end
80
115
  end
81
- alias_method :name, :to_s
116
+
117
+ def identifier
118
+ if remotes.empty?
119
+ "locally installed gems"
120
+ else
121
+ "rubygems repository #{remote_names}"
122
+ end
123
+ end
124
+ alias_method :name, :identifier
82
125
 
83
126
  def specs
84
127
  @specs ||= begin
@@ -87,120 +130,84 @@ module Bundler
87
130
  # small_idx.use large_idx.
88
131
  idx = @allow_remote ? remote_specs.dup : Index.new
89
132
  idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
90
- idx.use(installed_specs, :override_dupes)
133
+ idx.use(installed_specs, :override_dupes) if @allow_local
91
134
  idx
92
135
  end
93
136
  end
94
137
 
95
- def install(spec, opts = {})
96
- force = opts[:force]
97
- ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
138
+ def install(spec, options = {})
139
+ force = options[:force]
140
+ ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
98
141
 
99
- if ensure_builtin_gems_cached && builtin_gem?(spec)
100
- if !cached_path(spec)
101
- cached_built_in_gem(spec) unless spec.remote
102
- force = true
103
- else
104
- spec.loaded_from = loaded_from(spec)
105
- end
142
+ if ensure_builtin_gems_cached && spec.default_gem? && !cached_path(spec)
143
+ cached_built_in_gem(spec) unless spec.remote
144
+ force = true
106
145
  end
107
146
 
108
- if (installed?(spec) || Plugin.installed?(spec.name)) && !force
109
- print_using_message "Using #{version_message(spec)}"
147
+ if installed?(spec) && !force
148
+ print_using_message "Using #{version_message(spec, options[:previous_spec])}"
110
149
  return nil # no post-install message
111
150
  end
112
151
 
113
- # Download the gem to get the spec, because some specs that are returned
114
- # by rubygems.org are broken and wrong.
115
152
  if spec.remote
116
153
  # Check for this spec from other sources
117
- uris = [spec.remote.anonymized_uri]
118
- uris += remotes_for_spec(spec).map(&:anonymized_uri)
119
- uris.uniq!
154
+ uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).uniq
120
155
  Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
156
+ end
157
+
158
+ path = fetch_gem_if_possible(spec, options[:previous_spec])
159
+ raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
160
+
161
+ return if Bundler.settings[:no_install]
121
162
 
122
- path = fetch_gem(spec)
123
- begin
124
- s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
125
- spec.__swap__(s)
126
- rescue StandardError
163
+ install_path = rubygems_dir
164
+ bin_path = Bundler.system_bindir
165
+
166
+ require_relative "../rubygems_gem_installer"
167
+
168
+ installer = Bundler::RubyGemsGemInstaller.at(
169
+ path,
170
+ :security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
171
+ :install_dir => install_path.to_s,
172
+ :bin_dir => bin_path.to_s,
173
+ :ignore_dependencies => true,
174
+ :wrappers => true,
175
+ :env_shebang => true,
176
+ :build_args => options[:build_args],
177
+ :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
178
+ :bundler_extension_cache_path => extension_cache_path(spec)
179
+ )
180
+
181
+ if spec.remote
182
+ s = begin
183
+ installer.spec
184
+ rescue Gem::Package::FormatError
127
185
  Bundler.rm_rf(path)
128
186
  raise
187
+ rescue Gem::Security::Exception => e
188
+ raise SecurityError,
189
+ "The gem #{File.basename(path, ".gem")} can't be installed because " \
190
+ "the security policy didn't allow it, with the message: #{e.message}"
129
191
  end
130
- end
131
192
 
132
- unless Bundler.settings[:no_install]
133
- message = "Installing #{version_message(spec)}"
134
- message += " with native extensions" if spec.extensions.any?
135
- Bundler.ui.confirm message
193
+ spec.__swap__(s)
194
+ end
136
195
 
137
- path = cached_gem(spec)
138
- if requires_sudo?
139
- install_path = Bundler.tmp(spec.full_name)
140
- bin_path = install_path.join("bin")
141
- else
142
- install_path = rubygems_dir
143
- bin_path = Bundler.system_bindir
144
- end
196
+ message = "Installing #{version_message(spec, options[:previous_spec])}"
197
+ message += " with native extensions" if spec.extensions.any?
198
+ Bundler.ui.confirm message
145
199
 
146
- Bundler.mkdir_p bin_path, :no_sudo => true unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5")
147
-
148
- installed_spec = nil
149
- Bundler.rubygems.preserve_paths do
150
- installed_spec = Bundler::RubyGemsGemInstaller.at(
151
- path,
152
- :install_dir => install_path.to_s,
153
- :bin_dir => bin_path.to_s,
154
- :ignore_dependencies => true,
155
- :wrappers => true,
156
- :env_shebang => true,
157
- :build_args => opts[:build_args],
158
- :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
159
- :bundler_extension_cache_path => extension_cache_path(spec)
160
- ).install
161
- end
162
- spec.full_gem_path = installed_spec.full_gem_path
163
-
164
- # SUDO HAX
165
- if requires_sudo?
166
- Bundler.rubygems.repository_subdirectories.each do |name|
167
- src = File.join(install_path, name, "*")
168
- dst = File.join(rubygems_dir, name)
169
- if name == "extensions" && Dir.glob(src).any?
170
- src = File.join(src, "*/*")
171
- ext_src = Dir.glob(src).first
172
- ext_src.gsub!(src[0..-6], "")
173
- dst = File.dirname(File.join(dst, ext_src))
174
- end
175
- SharedHelpers.filesystem_access(dst) do |p|
176
- Bundler.mkdir_p(p)
177
- end
178
- Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
179
- end
200
+ installed_spec = installer.install
180
201
 
181
- spec.executables.each do |exe|
182
- SharedHelpers.filesystem_access(Bundler.system_bindir) do |p|
183
- Bundler.mkdir_p(p)
184
- end
185
- Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
186
- end
187
- end
188
- installed_spec.loaded_from = loaded_from(spec)
189
- end
190
- spec.loaded_from = loaded_from(spec)
202
+ spec.full_gem_path = installed_spec.full_gem_path
203
+ spec.loaded_from = installed_spec.loaded_from
191
204
 
192
205
  spec.post_install_message
193
- ensure
194
- Bundler.rm_rf(install_path) if requires_sudo?
195
206
  end
196
207
 
197
208
  def cache(spec, custom_path = nil)
198
- if builtin_gem?(spec)
199
- cached_path = cached_built_in_gem(spec)
200
- else
201
- cached_path = cached_gem(spec)
202
- end
203
- raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path
209
+ cached_path = Bundler.settings[:cache_all_platforms] ? fetch_gem_if_possible(spec) : cached_gem(spec)
210
+ raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path
204
211
  return if File.dirname(cached_path) == Bundler.app_cache.to_s
205
212
  Bundler.ui.info " * #{File.basename(cached_path)}"
206
213
  FileUtils.cp(cached_path, Bundler.app_cache(custom_path))
@@ -227,25 +234,16 @@ module Bundler
227
234
  @remotes.unshift(uri) unless @remotes.include?(uri)
228
235
  end
229
236
 
230
- def equivalent_remotes?(other_remotes)
231
- other_remotes.map(&method(:remove_auth)) == @remotes.map(&method(:remove_auth))
232
- end
233
-
234
- def replace_remotes(other_remotes, allow_equivalent = false)
235
- return false if other_remotes == @remotes
236
-
237
- equivalent = allow_equivalent && equivalent_remotes?(other_remotes)
238
-
239
- @remotes = []
240
- other_remotes.reverse_each do |r|
241
- add_remote r.to_s
237
+ def spec_names
238
+ if @allow_remote && dependency_api_available?
239
+ remote_specs.spec_names
240
+ else
241
+ []
242
242
  end
243
-
244
- !equivalent
245
243
  end
246
244
 
247
245
  def unmet_deps
248
- if @allow_remote && api_fetchers.any?
246
+ if @allow_remote && dependency_api_available?
249
247
  remote_specs.unmet_dependency_names
250
248
  else
251
249
  []
@@ -261,7 +259,7 @@ module Bundler
261
259
 
262
260
  def double_check_for(unmet_dependency_names)
263
261
  return unless @allow_remote
264
- return unless api_fetchers.any?
262
+ return unless dependency_api_available?
265
263
 
266
264
  unmet_dependency_names = unmet_dependency_names.call
267
265
  unless unmet_dependency_names.nil?
@@ -283,21 +281,32 @@ module Bundler
283
281
  remote_specs.each do |spec|
284
282
  case spec
285
283
  when EndpointSpecification, Gem::Specification, StubSpecification, LazySpecification
286
- names.concat(spec.runtime_dependencies)
284
+ names.concat(spec.runtime_dependencies.map(&:name))
287
285
  when RemoteSpecification # from the full index
288
286
  return nil
289
287
  else
290
288
  raise "unhandled spec type (#{spec.inspect})"
291
289
  end
292
290
  end
293
- names.map!(&:name) if names
294
291
  names
295
292
  end
296
293
 
297
- protected
294
+ def dependency_api_available?
295
+ api_fetchers.any?
296
+ end
297
+
298
+ protected
299
+
300
+ def remote_names
301
+ remotes.map(&:to_s).join(", ")
302
+ end
298
303
 
299
304
  def credless_remotes
300
- remotes.map(&method(:suppress_configured_credentials))
305
+ if Bundler.settings[:allow_deployment_source_credential_changes]
306
+ remotes.map(&method(:remove_auth))
307
+ else
308
+ remotes.map(&method(:suppress_configured_credentials))
309
+ end
301
310
  end
302
311
 
303
312
  def remotes_for_spec(spec)
@@ -307,26 +316,29 @@ module Bundler
307
316
  end
308
317
  end
309
318
 
310
- def loaded_from(spec)
311
- "#{rubygems_dir}/specifications/#{spec.full_name}.gemspec"
312
- end
313
-
314
319
  def cached_gem(spec)
315
- cached_gem = cached_path(spec)
316
- unless cached_gem
317
- raise Bundler::GemNotFound, "Could not find #{spec.file_name} for installation"
320
+ if spec.default_gem?
321
+ cached_built_in_gem(spec)
322
+ else
323
+ cached_path(spec)
318
324
  end
319
- cached_gem
320
325
  end
321
326
 
322
327
  def cached_path(spec)
323
- possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" }
328
+ global_cache_path = download_cache_path(spec)
329
+ @caches << global_cache_path if global_cache_path
330
+
331
+ possibilities = @caches.map {|p| package_path(p, spec) }
324
332
  possibilities.find {|p| File.exist?(p) }
325
333
  end
326
334
 
335
+ def package_path(cache_path, spec)
336
+ "#{cache_path}/#{spec.file_name}"
337
+ end
338
+
327
339
  def normalize_uri(uri)
328
340
  uri = uri.to_s
329
- uri = "#{uri}/" unless uri =~ %r{/$}
341
+ uri = "#{uri}/" unless %r{/$}.match?(uri)
330
342
  require_relative "../vendored_uri"
331
343
  uri = Bundler::URI(uri)
332
344
  raise ArgumentError, "The source must be an absolute URI. For example:\n" \
@@ -354,7 +366,6 @@ module Bundler
354
366
  def installed_specs
355
367
  @installed_specs ||= Index.build do |idx|
356
368
  Bundler.rubygems.all_specs.reverse_each do |spec|
357
- next if spec.name == "bundler"
358
369
  spec.source = self
359
370
  if Bundler.rubygems.spec_missing_extensions?(spec, false)
360
371
  Bundler.ui.debug "Source #{self} is ignoring #{spec} because it is missing extensions"
@@ -367,16 +378,12 @@ module Bundler
367
378
 
368
379
  def cached_specs
369
380
  @cached_specs ||= begin
370
- idx = installed_specs.dup
381
+ idx = @allow_local ? installed_specs.dup : Index.new
371
382
 
372
383
  Dir["#{cache_path}/*.gem"].each do |gemfile|
373
- next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
384
+ next if /^bundler\-[\d\.]+?\.gem/.match?(gemfile)
374
385
  s ||= Bundler.rubygems.spec_from_gem(gemfile)
375
386
  s.source = self
376
- if Bundler.rubygems.spec_missing_extensions?(s, false)
377
- Bundler.ui.debug "Source #{self} is ignoring #{s} because it is missing extensions"
378
- next
379
- end
380
387
  idx << s
381
388
  end
382
389
 
@@ -409,66 +416,56 @@ module Bundler
409
416
  def fetch_names(fetchers, dependency_names, index, override_dupes)
410
417
  fetchers.each do |f|
411
418
  if dependency_names
412
- Bundler.ui.info "Fetching gem metadata from #{f.uri}", Bundler.ui.debug?
419
+ Bundler.ui.info "Fetching gem metadata from #{URICredentialsFilter.credential_filtered_uri(f.uri)}", Bundler.ui.debug?
413
420
  index.use f.specs_with_retry(dependency_names, self), override_dupes
414
421
  Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
415
422
  else
416
- Bundler.ui.info "Fetching source index from #{f.uri}"
423
+ Bundler.ui.info "Fetching source index from #{URICredentialsFilter.credential_filtered_uri(f.uri)}"
417
424
  index.use f.specs_with_retry(nil, self), override_dupes
418
425
  end
419
426
  end
420
427
  end
421
428
 
422
- def fetch_gem(spec)
423
- return false unless spec.remote
429
+ def fetch_gem_if_possible(spec, previous_spec = nil)
430
+ if spec.remote
431
+ fetch_gem(spec, previous_spec)
432
+ else
433
+ cached_gem(spec)
434
+ end
435
+ end
424
436
 
437
+ def fetch_gem(spec, previous_spec = nil)
425
438
  spec.fetch_platform
426
439
 
427
- download_path = requires_sudo? ? Bundler.tmp(spec.full_name) : rubygems_dir
428
- gem_path = "#{rubygems_dir}/cache/#{spec.full_name}.gem"
440
+ cache_path = download_cache_path(spec) || default_cache_path_for(rubygems_dir)
441
+ gem_path = package_path(cache_path, spec)
442
+ return gem_path if File.exist?(gem_path)
429
443
 
430
- SharedHelpers.filesystem_access("#{download_path}/cache") do |p|
444
+ SharedHelpers.filesystem_access(cache_path) do |p|
431
445
  FileUtils.mkdir_p(p)
432
446
  end
433
- download_gem(spec, download_path)
434
-
435
- if requires_sudo?
436
- SharedHelpers.filesystem_access("#{rubygems_dir}/cache") do |p|
437
- Bundler.mkdir_p(p)
438
- end
439
- Bundler.sudo "mv #{download_path}/cache/#{spec.full_name}.gem #{gem_path}"
440
- end
447
+ download_gem(spec, cache_path, previous_spec)
441
448
 
442
449
  gem_path
443
- ensure
444
- Bundler.rm_rf(download_path) if requires_sudo?
445
- end
446
-
447
- def builtin_gem?(spec)
448
- # Ruby 2.1, where all included gems have this summary
449
- return true if spec.summary =~ /is bundled with Ruby/
450
-
451
- # Ruby 2.0, where gemspecs are stored in specifications/default/
452
- spec.loaded_from && spec.loaded_from.include?("specifications/default/")
453
450
  end
454
451
 
455
452
  def installed?(spec)
456
- installed_specs[spec].any?
453
+ installed_specs[spec].any? && !spec.deleted_gem?
457
454
  end
458
455
 
459
- def requires_sudo?
460
- Bundler.requires_sudo?
456
+ def rubygems_dir
457
+ Bundler.bundle_path
461
458
  end
462
459
 
463
- def rubygems_dir
464
- Bundler.rubygems.gem_dir
460
+ def default_cache_path_for(dir)
461
+ "#{dir}/cache"
465
462
  end
466
463
 
467
464
  def cache_path
468
465
  Bundler.app_cache
469
466
  end
470
467
 
471
- private
468
+ private
472
469
 
473
470
  # Checks if the requested spec exists in the global cache. If it does,
474
471
  # we copy it to the download path, and if it does not, we download it.
@@ -476,45 +473,16 @@ module Bundler
476
473
  # @param [Specification] spec
477
474
  # the spec we want to download or retrieve from the cache.
478
475
  #
479
- # @param [String] download_path
476
+ # @param [String] download_cache_path
480
477
  # the local directory the .gem will end up in.
481
478
  #
482
- def download_gem(spec, download_path)
483
- local_path = File.join(download_path, "cache/#{spec.full_name}.gem")
484
-
485
- if (cache_path = download_cache_path(spec)) && cache_path.file?
486
- SharedHelpers.filesystem_access(local_path) do
487
- FileUtils.cp(cache_path, local_path)
488
- end
489
- else
490
- uri = spec.remote.uri
491
- Bundler.ui.confirm("Fetching #{version_message(spec)}")
492
- rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path)
493
- if rubygems_local_path != local_path
494
- FileUtils.mv(rubygems_local_path, local_path)
495
- end
496
- cache_globally(spec, local_path)
497
- end
498
- end
499
-
500
- # Checks if the requested spec exists in the global cache. If it does
501
- # not, we create the relevant global cache subdirectory if it does not
502
- # exist and copy the spec from the local cache to the global cache.
503
- #
504
- # @param [Specification] spec
505
- # the spec we want to copy to the global cache.
506
- #
507
- # @param [String] local_cache_path
508
- # the local directory from which we want to copy the .gem.
479
+ # @param [Specification] previous_spec
480
+ # the spec previously locked
509
481
  #
510
- def cache_globally(spec, local_cache_path)
511
- return unless cache_path = download_cache_path(spec)
512
- return if cache_path.exist?
513
-
514
- SharedHelpers.filesystem_access(cache_path.dirname, &:mkpath)
515
- SharedHelpers.filesystem_access(cache_path) do
516
- FileUtils.cp(local_cache_path, cache_path)
517
- end
482
+ def download_gem(spec, download_cache_path, previous_spec = nil)
483
+ uri = spec.remote.uri
484
+ Bundler.ui.confirm("Fetching #{version_message(spec, previous_spec)}")
485
+ Bundler.rubygems.download_gem(spec, uri, download_cache_path)
518
486
  end
519
487
 
520
488
  # Returns the global cache path of the calling Rubygems::Source object.
@@ -533,7 +501,7 @@ module Bundler
533
501
  return unless remote = spec.remote
534
502
  return unless cache_slug = remote.cache_slug
535
503
 
536
- Bundler.user_cache.join("gems", cache_slug, spec.file_name)
504
+ Bundler.user_cache.join("gems", cache_slug)
537
505
  end
538
506
 
539
507
  def extension_cache_slug(spec)
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class Source
5
+ class RubygemsAggregate
6
+ attr_reader :source_map, :sources
7
+
8
+ def initialize(sources, source_map)
9
+ @sources = sources
10
+ @source_map = source_map
11
+
12
+ @index = build_index
13
+ end
14
+
15
+ def specs
16
+ @index
17
+ end
18
+
19
+ def identifier
20
+ to_s
21
+ end
22
+
23
+ def to_s
24
+ "any of the sources"
25
+ end
26
+
27
+ private
28
+
29
+ def build_index
30
+ Index.build do |idx|
31
+ dependency_names = source_map.pinned_spec_names
32
+
33
+ sources.all_sources.each do |source|
34
+ source.dependency_names = dependency_names - source_map.pinned_spec_names(source)
35
+ idx.add_source source.specs
36
+ dependency_names.concat(source.unmet_deps).uniq!
37
+ end
38
+
39
+ double_check_for_index(idx, dependency_names)
40
+ end
41
+ end
42
+
43
+ # Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both
44
+ # sources A and B. At this point, the API request will have found all the versions of Bar in source A,
45
+ # but will not have found any versions of Bar from source B, which is a problem if the requested version
46
+ # of Foo specifically depends on a version of Bar that is only found in source B. This ensures that for
47
+ # each spec we found, we add all possible versions from all sources to the index.
48
+ def double_check_for_index(idx, dependency_names)
49
+ pinned_names = source_map.pinned_spec_names
50
+
51
+ names = :names # do this so we only have to traverse to get dependency_names from the index once
52
+ unmet_dependency_names = lambda do
53
+ return names unless names == :names
54
+ new_names = sources.all_sources.map(&:dependency_names_to_double_check)
55
+ return names = nil if new_names.compact!
56
+ names = new_names.flatten(1).concat(dependency_names)
57
+ names.uniq!
58
+ names -= pinned_names
59
+ names
60
+ end
61
+
62
+ sources.all_sources.each do |source|
63
+ source.double_check_for(unmet_dependency_names)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end