rubygems-update 3.5.3 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (437) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1410 -686
  3. data/CODE_OF_CONDUCT.md +79 -28
  4. data/CONTRIBUTING.md +4 -226
  5. data/Manifest.txt +107 -83
  6. data/README.md +16 -11
  7. data/SECURITY.md +7 -0
  8. data/bundler/CHANGELOG.md +1525 -931
  9. data/bundler/README.md +9 -9
  10. data/bundler/bundler.gemspec +2 -2
  11. data/bundler/lib/bundler/build_metadata.rb +10 -11
  12. data/bundler/lib/bundler/checksum.rb +22 -12
  13. data/bundler/lib/bundler/cli/add.rb +3 -1
  14. data/bundler/lib/bundler/cli/binstubs.rb +1 -1
  15. data/bundler/lib/bundler/cli/check.rb +3 -3
  16. data/bundler/lib/bundler/cli/common.rb +1 -1
  17. data/bundler/lib/bundler/cli/config.rb +2 -2
  18. data/bundler/lib/bundler/cli/console.rb +8 -10
  19. data/bundler/lib/bundler/cli/doctor/diagnose.rb +167 -0
  20. data/bundler/lib/bundler/cli/doctor/ssl.rb +249 -0
  21. data/bundler/lib/bundler/cli/doctor.rb +27 -151
  22. data/bundler/lib/bundler/cli/exec.rb +1 -0
  23. data/bundler/lib/bundler/cli/fund.rb +1 -1
  24. data/bundler/lib/bundler/cli/gem.rb +74 -46
  25. data/bundler/lib/bundler/cli/info.rb +6 -6
  26. data/bundler/lib/bundler/cli/inject.rb +3 -3
  27. data/bundler/lib/bundler/cli/install.rb +19 -10
  28. data/bundler/lib/bundler/cli/issue.rb +3 -3
  29. data/bundler/lib/bundler/cli/lock.rb +32 -11
  30. data/bundler/lib/bundler/cli/outdated.rb +23 -23
  31. data/bundler/lib/bundler/cli/plugin.rb +3 -2
  32. data/bundler/lib/bundler/cli/pristine.rb +1 -1
  33. data/bundler/lib/bundler/cli/show.rb +3 -3
  34. data/bundler/lib/bundler/cli/update.rb +3 -3
  35. data/bundler/lib/bundler/cli.rb +75 -145
  36. data/bundler/lib/bundler/compact_index_client/cache.rb +48 -73
  37. data/bundler/lib/bundler/compact_index_client/cache_file.rb +0 -5
  38. data/bundler/lib/bundler/compact_index_client/parser.rb +84 -0
  39. data/bundler/lib/bundler/compact_index_client/updater.rb +6 -16
  40. data/bundler/lib/bundler/compact_index_client.rb +52 -85
  41. data/bundler/lib/bundler/constants.rb +8 -1
  42. data/bundler/lib/bundler/current_ruby.rb +48 -34
  43. data/bundler/lib/bundler/definition.rb +501 -328
  44. data/bundler/lib/bundler/dependency.rb +93 -47
  45. data/bundler/lib/bundler/dsl.rb +147 -103
  46. data/bundler/lib/bundler/endpoint_specification.rb +30 -3
  47. data/bundler/lib/bundler/env.rb +1 -1
  48. data/bundler/lib/bundler/environment_preserver.rb +5 -23
  49. data/bundler/lib/bundler/errors.rb +53 -5
  50. data/bundler/lib/bundler/feature_flag.rb +18 -18
  51. data/bundler/lib/bundler/fetcher/compact_index.rb +16 -25
  52. data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
  53. data/bundler/lib/bundler/fetcher/downloader.rb +34 -8
  54. data/bundler/lib/bundler/fetcher.rb +63 -26
  55. data/bundler/lib/bundler/force_platform.rb +0 -2
  56. data/bundler/lib/bundler/friendly_errors.rb +3 -2
  57. data/bundler/lib/bundler/gem_helper.rb +1 -1
  58. data/bundler/lib/bundler/gem_version_promoter.rb +42 -40
  59. data/bundler/lib/bundler/index.rb +7 -2
  60. data/bundler/lib/bundler/injector.rb +14 -16
  61. data/bundler/lib/bundler/inline.rb +42 -17
  62. data/bundler/lib/bundler/installer/gem_installer.rb +4 -3
  63. data/bundler/lib/bundler/installer/parallel_installer.rb +3 -2
  64. data/bundler/lib/bundler/installer/standalone.rb +2 -5
  65. data/bundler/lib/bundler/installer.rb +22 -45
  66. data/bundler/lib/bundler/lazy_specification.rb +121 -48
  67. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  68. data/bundler/lib/bundler/lockfile_parser.rb +36 -9
  69. data/bundler/lib/bundler/man/bundle-add.1 +44 -27
  70. data/bundler/lib/bundler/man/bundle-add.1.ronn +52 -23
  71. data/bundler/lib/bundler/man/bundle-binstubs.1 +9 -6
  72. data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
  73. data/bundler/lib/bundler/man/bundle-cache.1 +32 -4
  74. data/bundler/lib/bundler/man/bundle-cache.1.ronn +31 -2
  75. data/bundler/lib/bundler/man/bundle-check.1 +7 -5
  76. data/bundler/lib/bundler/man/bundle-check.1.ronn +7 -2
  77. data/bundler/lib/bundler/man/bundle-clean.1 +3 -3
  78. data/bundler/lib/bundler/man/bundle-config.1 +180 -138
  79. data/bundler/lib/bundler/man/bundle-config.1.ronn +96 -99
  80. data/bundler/lib/bundler/man/bundle-console.1 +4 -6
  81. data/bundler/lib/bundler/man/bundle-console.1.ronn +2 -7
  82. data/bundler/lib/bundler/man/bundle-doctor.1 +46 -7
  83. data/bundler/lib/bundler/man/bundle-doctor.1.ronn +49 -5
  84. data/bundler/lib/bundler/man/bundle-env.1 +9 -0
  85. data/bundler/lib/bundler/man/bundle-env.1.ronn +10 -0
  86. data/bundler/lib/bundler/man/bundle-exec.1 +9 -6
  87. data/bundler/lib/bundler/man/bundle-exec.1.ronn +6 -3
  88. data/bundler/lib/bundler/man/bundle-fund.1 +22 -0
  89. data/bundler/lib/bundler/man/bundle-fund.1.ronn +25 -0
  90. data/bundler/lib/bundler/man/bundle-gem.1 +69 -28
  91. data/bundler/lib/bundler/man/bundle-gem.1.ronn +42 -6
  92. data/bundler/lib/bundler/man/bundle-help.1 +3 -3
  93. data/bundler/lib/bundler/man/bundle-info.1 +7 -4
  94. data/bundler/lib/bundler/man/bundle-info.1.ronn +6 -2
  95. data/bundler/lib/bundler/man/bundle-init.1 +5 -5
  96. data/bundler/lib/bundler/man/bundle-init.1.ronn +3 -2
  97. data/bundler/lib/bundler/man/bundle-inject.1 +13 -5
  98. data/bundler/lib/bundler/man/bundle-inject.1.ronn +10 -2
  99. data/bundler/lib/bundler/man/bundle-install.1 +20 -17
  100. data/bundler/lib/bundler/man/bundle-install.1.ronn +26 -23
  101. data/bundler/lib/bundler/man/bundle-issue.1 +45 -0
  102. data/bundler/lib/bundler/man/bundle-issue.1.ronn +37 -0
  103. data/bundler/lib/bundler/man/bundle-licenses.1 +9 -0
  104. data/bundler/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  105. data/bundler/lib/bundler/man/bundle-list.1 +3 -3
  106. data/bundler/lib/bundler/man/bundle-list.1.ronn +4 -1
  107. data/bundler/lib/bundler/man/bundle-lock.1 +23 -8
  108. data/bundler/lib/bundler/man/bundle-lock.1.ronn +25 -4
  109. data/bundler/lib/bundler/man/bundle-open.1 +4 -4
  110. data/bundler/lib/bundler/man/bundle-open.1.ronn +2 -1
  111. data/bundler/lib/bundler/man/bundle-outdated.1 +10 -7
  112. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +8 -4
  113. data/bundler/lib/bundler/man/bundle-platform.1 +3 -3
  114. data/bundler/lib/bundler/man/bundle-plugin.1 +9 -6
  115. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +7 -3
  116. data/bundler/lib/bundler/man/bundle-pristine.1 +3 -3
  117. data/bundler/lib/bundler/man/bundle-pristine.1.ronn +1 -1
  118. data/bundler/lib/bundler/man/bundle-remove.1 +3 -3
  119. data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -1
  120. data/bundler/lib/bundler/man/bundle-show.1 +7 -4
  121. data/bundler/lib/bundler/man/bundle-show.1.ronn +4 -0
  122. data/bundler/lib/bundler/man/bundle-update.1 +17 -11
  123. data/bundler/lib/bundler/man/bundle-update.1.ronn +17 -9
  124. data/bundler/lib/bundler/man/bundle-version.1 +3 -3
  125. data/bundler/lib/bundler/man/bundle-viz.1 +6 -6
  126. data/bundler/lib/bundler/man/bundle-viz.1.ronn +7 -3
  127. data/bundler/lib/bundler/man/bundle.1 +3 -3
  128. data/bundler/lib/bundler/man/gemfile.5 +7 -5
  129. data/bundler/lib/bundler/man/gemfile.5.ronn +8 -2
  130. data/bundler/lib/bundler/man/index.txt +4 -0
  131. data/bundler/lib/bundler/match_metadata.rb +13 -0
  132. data/bundler/lib/bundler/match_platform.rb +31 -12
  133. data/bundler/lib/bundler/materialization.rb +59 -0
  134. data/bundler/lib/bundler/mirror.rb +3 -3
  135. data/bundler/lib/bundler/plugin/api/source.rb +5 -4
  136. data/bundler/lib/bundler/plugin/events.rb +24 -0
  137. data/bundler/lib/bundler/plugin/index.rb +5 -1
  138. data/bundler/lib/bundler/plugin/installer/path.rb +26 -0
  139. data/bundler/lib/bundler/plugin/installer.rb +37 -17
  140. data/bundler/lib/bundler/plugin/source_list.rb +4 -4
  141. data/bundler/lib/bundler/plugin.rb +21 -2
  142. data/bundler/lib/bundler/process_lock.rb +10 -14
  143. data/bundler/lib/bundler/remote_specification.rb +6 -1
  144. data/bundler/lib/bundler/resolver/base.rb +14 -3
  145. data/bundler/lib/bundler/resolver/candidate.rb +18 -27
  146. data/bundler/lib/bundler/resolver/package.rb +20 -3
  147. data/bundler/lib/bundler/resolver/spec_group.rb +22 -27
  148. data/bundler/lib/bundler/resolver/strategy.rb +40 -0
  149. data/bundler/lib/bundler/resolver.rb +114 -52
  150. data/bundler/lib/bundler/retry.rb +1 -1
  151. data/bundler/lib/bundler/ruby_dsl.rb +12 -3
  152. data/bundler/lib/bundler/ruby_version.rb +7 -1
  153. data/bundler/lib/bundler/rubygems_ext.rb +303 -150
  154. data/bundler/lib/bundler/rubygems_gem_installer.rb +40 -5
  155. data/bundler/lib/bundler/rubygems_integration.rb +40 -73
  156. data/bundler/lib/bundler/runtime.rb +48 -35
  157. data/bundler/lib/bundler/self_manager.rb +36 -26
  158. data/bundler/lib/bundler/settings/validator.rb +0 -23
  159. data/bundler/lib/bundler/settings.rb +36 -27
  160. data/bundler/lib/bundler/setup.rb +6 -0
  161. data/bundler/lib/bundler/shared_helpers.rb +45 -25
  162. data/bundler/lib/bundler/source/gemspec.rb +1 -4
  163. data/bundler/lib/bundler/source/git/git_proxy.rb +26 -9
  164. data/bundler/lib/bundler/source/git.rb +113 -41
  165. data/bundler/lib/bundler/source/metadata.rb +4 -3
  166. data/bundler/lib/bundler/source/path.rb +14 -18
  167. data/bundler/lib/bundler/source/rubygems/remote.rb +12 -4
  168. data/bundler/lib/bundler/source/rubygems.rb +54 -48
  169. data/bundler/lib/bundler/source.rb +2 -0
  170. data/bundler/lib/bundler/source_list.rb +54 -12
  171. data/bundler/lib/bundler/source_map.rb +1 -1
  172. data/bundler/lib/bundler/spec_set.rb +227 -103
  173. data/bundler/lib/bundler/stub_specification.rb +29 -2
  174. data/bundler/lib/bundler/templates/Executable +0 -11
  175. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
  176. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -3
  177. data/bundler/lib/bundler/templates/newgem/README.md.tt +7 -3
  178. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +17 -15
  179. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +14 -12
  180. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
  181. data/bundler/lib/bundler/ui/shell.rb +26 -4
  182. data/bundler/lib/bundler/ui/silent.rb +12 -1
  183. data/bundler/lib/bundler/uri_credentials_filter.rb +3 -3
  184. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +53 -3
  185. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  186. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +11 -0
  187. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
  188. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  189. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
  190. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +134 -57
  191. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +4 -24
  192. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +1 -0
  193. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
  194. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +20 -8
  195. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +17 -29
  196. data/bundler/lib/bundler/vendor/securerandom/COPYING +56 -0
  197. data/bundler/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
  198. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
  199. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
  200. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
  201. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
  202. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
  203. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
  204. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  205. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
  206. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  207. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  208. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +11 -0
  209. data/bundler/lib/bundler/vendor/uri/COPYING +56 -0
  210. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +43 -16
  211. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
  212. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
  213. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +28 -37
  214. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
  215. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +16 -9
  216. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  217. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  218. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +9 -9
  219. data/bundler/lib/bundler/vendored_net_http.rb +20 -5
  220. data/bundler/lib/bundler/vendored_securerandom.rb +12 -0
  221. data/bundler/lib/bundler/vendored_timeout.rb +7 -3
  222. data/bundler/lib/bundler/vendored_uri.rb +18 -1
  223. data/bundler/lib/bundler/version.rb +10 -2
  224. data/bundler/lib/bundler/worker.rb +1 -1
  225. data/bundler/lib/bundler/yaml_serializer.rb +12 -7
  226. data/bundler/lib/bundler.rb +101 -61
  227. data/{bundler → doc/bundler}/UPGRADING.md +132 -127
  228. data/doc/rubygems/CONTRIBUTING.md +227 -0
  229. data/{POLICIES.md → doc/rubygems/POLICIES.md} +86 -17
  230. data/exe/update_rubygems +1 -1
  231. data/lib/rubygems/basic_specification.rb +50 -10
  232. data/lib/rubygems/bundler_version_finder.rb +1 -1
  233. data/lib/rubygems/command.rb +1 -4
  234. data/lib/rubygems/command_manager.rb +5 -6
  235. data/lib/rubygems/commands/build_command.rb +2 -11
  236. data/lib/rubygems/commands/cleanup_command.rb +3 -13
  237. data/lib/rubygems/commands/contents_command.rb +17 -10
  238. data/lib/rubygems/commands/environment_command.rb +5 -0
  239. data/lib/rubygems/commands/exec_command.rb +18 -11
  240. data/lib/rubygems/commands/fetch_command.rb +14 -0
  241. data/lib/rubygems/commands/help_command.rb +2 -2
  242. data/lib/rubygems/commands/install_command.rb +0 -4
  243. data/lib/rubygems/commands/pristine_command.rb +29 -19
  244. data/lib/rubygems/commands/push_command.rb +31 -6
  245. data/lib/rubygems/commands/rdoc_command.rb +3 -10
  246. data/lib/rubygems/commands/rebuild_command.rb +262 -0
  247. data/lib/rubygems/commands/setup_command.rb +13 -18
  248. data/lib/rubygems/commands/sources_command.rb +2 -2
  249. data/lib/rubygems/commands/uninstall_command.rb +9 -4
  250. data/lib/rubygems/commands/unpack_command.rb +0 -6
  251. data/lib/rubygems/commands/update_command.rb +13 -22
  252. data/lib/rubygems/config_file.rb +45 -16
  253. data/lib/rubygems/core_ext/kernel_require.rb +15 -3
  254. data/lib/rubygems/core_ext/kernel_warn.rb +2 -6
  255. data/lib/rubygems/defaults.rb +7 -7
  256. data/lib/rubygems/dependency.rb +12 -16
  257. data/lib/rubygems/dependency_list.rb +1 -1
  258. data/lib/rubygems/deprecate.rb +79 -77
  259. data/lib/rubygems/errors.rb +2 -1
  260. data/lib/rubygems/exceptions.rb +2 -9
  261. data/lib/rubygems/ext/builder.rb +21 -8
  262. data/lib/rubygems/ext/cargo_builder.rb +16 -26
  263. data/lib/rubygems/ext/cmake_builder.rb +7 -2
  264. data/lib/rubygems/ext/configure_builder.rb +7 -2
  265. data/lib/rubygems/ext/ext_conf_builder.rb +9 -5
  266. data/lib/rubygems/ext/rake_builder.rb +7 -4
  267. data/lib/rubygems/gem_runner.rb +9 -0
  268. data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +11 -4
  269. data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +3 -1
  270. data/lib/rubygems/gemcutter_utilities.rb +52 -26
  271. data/lib/rubygems/gemspec_helpers.rb +19 -0
  272. data/lib/rubygems/install_update_options.rb +5 -0
  273. data/lib/rubygems/installer.rb +76 -90
  274. data/lib/rubygems/local_remote_options.rb +8 -8
  275. data/lib/rubygems/package/tar_header.rb +31 -4
  276. data/lib/rubygems/package/tar_reader/entry.rb +1 -5
  277. data/lib/rubygems/package/tar_writer.rb +5 -4
  278. data/lib/rubygems/package.rb +13 -8
  279. data/lib/rubygems/platform.rb +148 -43
  280. data/lib/rubygems/psych_tree.rb +4 -0
  281. data/lib/rubygems/query_utils.rb +2 -2
  282. data/lib/rubygems/rdoc.rb +16 -3
  283. data/lib/rubygems/remote_fetcher.rb +6 -7
  284. data/lib/rubygems/request.rb +5 -5
  285. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  286. data/lib/rubygems/request_set.rb +4 -7
  287. data/lib/rubygems/requirement.rb +16 -12
  288. data/lib/rubygems/resolver/activation_request.rb +1 -1
  289. data/lib/rubygems/resolver/api_set/gem_parser.rb +2 -5
  290. data/lib/rubygems/resolver/api_set.rb +13 -8
  291. data/lib/rubygems/resolver/best_set.rb +1 -29
  292. data/lib/rubygems/resolver/composed_set.rb +3 -3
  293. data/lib/rubygems/resolver/git_set.rb +0 -1
  294. data/lib/rubygems/resolver/index_set.rb +2 -2
  295. data/lib/rubygems/resolver/source_set.rb +1 -1
  296. data/lib/rubygems/resolver/spec_specification.rb +7 -0
  297. data/lib/rubygems/resolver.rb +8 -8
  298. data/lib/rubygems/s3_uri_signer.rb +8 -6
  299. data/lib/rubygems/safe_marshal/reader.rb +31 -14
  300. data/lib/rubygems/safe_marshal/visitors/to_ruby.rb +29 -16
  301. data/lib/rubygems/safe_yaml.rb +10 -1
  302. data/lib/rubygems/security.rb +1 -1
  303. data/lib/rubygems/source/git.rb +22 -17
  304. data/lib/rubygems/source/installed.rb +3 -1
  305. data/lib/rubygems/source/local.rb +8 -4
  306. data/lib/rubygems/source/specific_file.rb +5 -3
  307. data/lib/rubygems/source.rb +37 -29
  308. data/lib/rubygems/source_list.rb +1 -1
  309. data/lib/rubygems/spec_fetcher.rb +47 -15
  310. data/lib/rubygems/specification.rb +110 -183
  311. data/lib/rubygems/specification_policy.rb +33 -13
  312. data/lib/rubygems/specification_record.rb +212 -0
  313. data/lib/rubygems/stub_specification.rb +32 -10
  314. data/lib/rubygems/target_rbconfig.rb +50 -0
  315. data/lib/rubygems/uninstaller.rb +42 -22
  316. data/lib/rubygems/uri.rb +6 -6
  317. data/lib/rubygems/uri_formatter.rb +2 -1
  318. data/lib/rubygems/util/licenses.rb +118 -1
  319. data/lib/rubygems/util.rb +1 -1
  320. data/lib/rubygems/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
  321. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/delegates/specification_provider.rb +11 -11
  322. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
  323. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  324. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  325. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  326. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  327. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/log.rb +1 -1
  328. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  329. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
  330. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/vertex.rb +1 -1
  331. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  332. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/errors.rb +1 -1
  333. data/lib/rubygems/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
  334. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/specification_provider.rb +2 -2
  335. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/ui.rb +1 -1
  336. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolution.rb +4 -4
  337. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolver.rb +1 -1
  338. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/state.rb +1 -1
  339. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo.rb +2 -2
  340. data/lib/rubygems/vendor/net-http/COPYING +56 -0
  341. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/generic_request.rb +9 -9
  342. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/header.rb +3 -3
  343. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/request.rb +3 -3
  344. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/requests.rb +35 -30
  345. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/response.rb +2 -2
  346. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/responses.rb +6 -6
  347. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/status.rb +1 -1
  348. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http.rb +149 -70
  349. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/https.rb +1 -1
  350. data/lib/rubygems/vendor/optparse/COPYING +56 -0
  351. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/ac.rb +16 -0
  352. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/kwargs.rb +8 -3
  353. data/lib/rubygems/vendor/optparse/lib/optparse/uri.rb +7 -0
  354. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/version.rb +9 -0
  355. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse.rb +158 -62
  356. data/lib/rubygems/vendor/resolv/COPYING +56 -0
  357. data/lib/rubygems/{resolv → vendor/resolv}/lib/resolv.rb +165 -69
  358. data/lib/rubygems/vendor/securerandom/COPYING +56 -0
  359. data/lib/rubygems/vendor/securerandom/lib/securerandom.rb +102 -0
  360. data/lib/rubygems/vendor/timeout/COPYING +56 -0
  361. data/lib/rubygems/{timeout → vendor/timeout}/lib/timeout.rb +10 -11
  362. data/lib/rubygems/{tsort → vendor/tsort}/lib/tsort.rb +2 -2
  363. data/lib/rubygems/vendor/uri/COPYING +56 -0
  364. data/lib/rubygems/vendor/uri/lib/uri/common.rb +880 -0
  365. data/lib/rubygems/vendor/uri/lib/uri/file.rb +100 -0
  366. data/lib/rubygems/vendor/uri/lib/uri/ftp.rb +267 -0
  367. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +1579 -0
  368. data/lib/rubygems/vendor/uri/lib/uri/http.rb +125 -0
  369. data/lib/rubygems/vendor/uri/lib/uri/https.rb +23 -0
  370. data/lib/rubygems/vendor/uri/lib/uri/ldap.rb +261 -0
  371. data/lib/rubygems/vendor/uri/lib/uri/ldaps.rb +22 -0
  372. data/lib/rubygems/vendor/uri/lib/uri/mailto.rb +293 -0
  373. data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  374. data/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +206 -0
  375. data/lib/rubygems/vendor/uri/lib/uri/version.rb +6 -0
  376. data/lib/rubygems/vendor/uri/lib/uri/ws.rb +83 -0
  377. data/lib/rubygems/vendor/uri/lib/uri/wss.rb +23 -0
  378. data/lib/rubygems/vendor/uri/lib/uri.rb +104 -0
  379. data/lib/rubygems/vendored_molinillo.rb +3 -0
  380. data/lib/rubygems/vendored_net_http.rb +5 -0
  381. data/lib/rubygems/vendored_optparse.rb +3 -0
  382. data/lib/rubygems/vendored_securerandom.rb +3 -0
  383. data/lib/rubygems/vendored_timeout.rb +5 -0
  384. data/lib/rubygems/vendored_tsort.rb +3 -0
  385. data/lib/rubygems/version.rb +26 -9
  386. data/lib/rubygems/yaml_serializer.rb +12 -7
  387. data/lib/rubygems.rb +160 -53
  388. data/rubygems-update.gemspec +11 -6
  389. data/setup.rb +1 -1
  390. metadata +124 -96
  391. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +0 -32
  392. data/bundler/lib/bundler/gem_helpers.rb +0 -127
  393. data/bundler/lib/bundler/templates/Executable.bundler +0 -109
  394. data/bundler/lib/bundler/vendor/fileutils/.document +0 -1
  395. data/bundler/lib/bundler/vendor/net-http-persistent/.document +0 -1
  396. data/bundler/lib/bundler/vendor/pub_grub/.document +0 -1
  397. data/bundler/lib/bundler/vendor/thor/.document +0 -1
  398. data/bundler/lib/bundler/vendor/tsort/.document +0 -1
  399. data/bundler/lib/bundler/vendor/uri/.document +0 -1
  400. data/lib/rubygems/net/http.rb +0 -3
  401. data/lib/rubygems/net-http/.document +0 -1
  402. data/lib/rubygems/net-http/LICENSE.txt +0 -22
  403. data/lib/rubygems/net-http/lib/net/http/backward.rb +0 -40
  404. data/lib/rubygems/net-protocol/.document +0 -1
  405. data/lib/rubygems/net-protocol/LICENSE.txt +0 -22
  406. data/lib/rubygems/optparse/.document +0 -1
  407. data/lib/rubygems/optparse/lib/optparse/uri.rb +0 -7
  408. data/lib/rubygems/optparse.rb +0 -3
  409. data/lib/rubygems/resolv/.document +0 -1
  410. data/lib/rubygems/resolv/LICENSE.txt +0 -22
  411. data/lib/rubygems/resolver/molinillo/.document +0 -1
  412. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  413. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  414. data/lib/rubygems/resolver/molinillo.rb +0 -3
  415. data/lib/rubygems/shellwords.rb +0 -3
  416. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +0 -21
  417. data/lib/rubygems/timeout/.document +0 -1
  418. data/lib/rubygems/timeout/LICENSE.txt +0 -22
  419. data/lib/rubygems/timeout.rb +0 -3
  420. data/lib/rubygems/tsort/.document +0 -1
  421. data/lib/rubygems/tsort/LICENSE.txt +0 -22
  422. data/lib/rubygems/tsort.rb +0 -3
  423. /data/{lib/rubygems/optparse → bundler/lib/bundler/vendor/fileutils}/COPYING +0 -0
  424. /data/{MAINTAINERS.txt → doc/MAINTAINERS.txt} +0 -0
  425. /data/{UPGRADING.md → doc/rubygems/UPGRADING.md} +0 -0
  426. /data/lib/rubygems/ssl_certs/rubygems.org/{GlobalSignRootCA_R3.pem → GlobalSign.pem} +0 -0
  427. /data/{bundler/lib/bundler/vendor/connection_pool → lib/rubygems/vendor}/.document +0 -0
  428. /data/lib/rubygems/{resolver → vendor}/molinillo/LICENSE +0 -0
  429. /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/exceptions.rb +0 -0
  430. /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/proxy_delta.rb +0 -0
  431. /data/{bundler/lib/bundler/vendor/fileutils → lib/rubygems/vendor/net-protocol}/LICENSE.txt +0 -0
  432. /data/lib/rubygems/{net-protocol → vendor/net-protocol}/lib/net/protocol.rb +0 -0
  433. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optionparser.rb +0 -0
  434. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/date.rb +0 -0
  435. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/shellwords.rb +0 -0
  436. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/time.rb +0 -0
  437. /data/{bundler/lib/bundler/vendor/uri → lib/rubygems/vendor/tsort}/LICENSE.txt +0 -0
@@ -23,10 +23,7 @@ module Bundler
23
23
  # @param [Pathname] lockfile_path The lockfile in which to inject the new dependency.
24
24
  # @return [Array]
25
25
  def inject(gemfile_path, lockfile_path)
26
- if Bundler.frozen_bundle?
27
- # ensure the lock and Gemfile are synced
28
- Bundler.definition.ensure_equivalent_gemfile_and_lockfile(true)
29
- end
26
+ Bundler.definition.ensure_equivalent_gemfile_and_lockfile(true)
30
27
 
31
28
  # temporarily unfreeze
32
29
  Bundler.settings.temporary(deployment: false, frozen: false) do
@@ -44,13 +41,13 @@ module Bundler
44
41
 
45
42
  # resolve to see if the new deps broke anything
46
43
  @definition = builder.to_definition(lockfile_path, {})
47
- @definition.resolve_remotely!
44
+ @definition.remotely!
48
45
 
49
46
  # since nothing broke, we can add those gems to the gemfile
50
47
  append_to(gemfile_path, build_gem_lines(@options[:conservative_versioning])) if @deps.any?
51
48
 
52
49
  # since we resolved successfully, write out the lockfile
53
- @definition.lock(Bundler.default_lockfile)
50
+ @definition.lock
54
51
 
55
52
  # invalidate the cached Bundler.definition
56
53
  Bundler.reset_paths!
@@ -111,18 +108,19 @@ module Bundler
111
108
  end
112
109
 
113
110
  if d.groups != Array(:default)
114
- group = d.groups.size == 1 ? ", :group => #{d.groups.first.inspect}" : ", :groups => #{d.groups.inspect}"
111
+ group = d.groups.size == 1 ? ", group: #{d.groups.first.inspect}" : ", groups: #{d.groups.inspect}"
115
112
  end
116
113
 
117
- source = ", :source => \"#{d.source}\"" unless d.source.nil?
118
- path = ", :path => \"#{d.path}\"" unless d.path.nil?
119
- git = ", :git => \"#{d.git}\"" unless d.git.nil?
120
- github = ", :github => \"#{d.github}\"" unless d.github.nil?
121
- branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil?
122
- ref = ", :ref => \"#{d.ref}\"" unless d.ref.nil?
123
- require_path = ", :require => #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil?
114
+ source = ", source: \"#{d.source}\"" unless d.source.nil?
115
+ path = ", path: \"#{d.path}\"" unless d.path.nil?
116
+ git = ", git: \"#{d.git}\"" unless d.git.nil?
117
+ github = ", github: \"#{d.github}\"" unless d.github.nil?
118
+ branch = ", branch: \"#{d.branch}\"" unless d.branch.nil?
119
+ ref = ", ref: \"#{d.ref}\"" unless d.ref.nil?
120
+ glob = ", glob: \"#{d.glob}\"" unless d.glob.nil?
121
+ require_path = ", require: #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil?
124
122
 
125
- %(gem #{name}#{requirement}#{group}#{source}#{path}#{git}#{github}#{branch}#{ref}#{require_path})
123
+ %(gem #{name}#{requirement}#{group}#{source}#{path}#{git}#{github}#{branch}#{ref}#{glob}#{require_path})
126
124
  end.join("\n")
127
125
  end
128
126
 
@@ -186,7 +184,7 @@ module Bundler
186
184
  # @param [Array] gems Array of names of gems to be removed.
187
185
  # @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
188
186
  def remove_gems_from_gemfile(gems, gemfile_path)
189
- patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/
187
+ patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2.*\)/
190
188
  new_gemfile = []
191
189
  multiline_removal = false
192
190
  File.readlines(gemfile_path).each do |line|
@@ -1,16 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Allows for declaring a Gemfile inline in a ruby script, optionally installing
4
- # any gems that aren't already installed on the user's system.
3
+ # Allows for declaring a Gemfile inline in a ruby script, installing any gems
4
+ # that aren't already installed on the user's system.
5
5
  #
6
6
  # @note Every gem that is specified in this 'Gemfile' will be `require`d, as if
7
7
  # the user had manually called `Bundler.require`. To avoid a requested gem
8
8
  # being automatically required, add the `:require => false` option to the
9
9
  # `gem` dependency declaration.
10
10
  #
11
- # @param install [Boolean] whether gems that aren't already installed on the
12
- # user's system should be installed.
13
- # Defaults to `false`.
11
+ # @param force_latest_compatible [Boolean] Force installing the *latest*
12
+ # compatible versions of the gems,
13
+ # even if compatible versions are
14
+ # already installed locally.
15
+ # This also logs output if the
16
+ # `:quiet` option is not set.
17
+ # Defaults to `false`.
14
18
  #
15
19
  # @param gemfile [Proc] a block that is evaluated as a `Gemfile`.
16
20
  #
@@ -29,31 +33,33 @@
29
33
  #
30
34
  # puts Pod::VERSION # => "0.34.4"
31
35
  #
32
- def gemfile(install = false, options = {}, &gemfile)
36
+ def gemfile(force_latest_compatible = false, options = {}, &gemfile)
33
37
  require_relative "../bundler"
34
38
  Bundler.reset!
35
39
 
36
40
  opts = options.dup
37
41
  ui = opts.delete(:ui) { Bundler::UI::Shell.new }
38
- ui.level = "silent" if opts.delete(:quiet) || !install
42
+ ui.level = "silent" if opts.delete(:quiet) || !force_latest_compatible
39
43
  Bundler.ui = ui
40
44
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
41
45
 
42
- Bundler.with_unbundled_env do
46
+ old_gemfile = ENV["BUNDLE_GEMFILE"]
47
+
48
+ Bundler.unbundle_env!
49
+
50
+ begin
43
51
  Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
44
52
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
45
53
 
46
54
  Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
47
55
  builder = Bundler::Dsl.new
48
56
  builder.instance_eval(&gemfile)
49
- builder.check_primary_source_safety
50
57
 
51
58
  Bundler.settings.temporary(deployment: false, frozen: false) do
52
59
  definition = builder.to_definition(nil, true)
53
- def definition.lock(*); end
54
60
  definition.validate_runtime!
55
61
 
56
- if install || definition.missing_specs?
62
+ if force_latest_compatible || definition.missing_specs?
57
63
  Bundler.settings.temporary(inline: true, no_install: false) do
58
64
  installer = Bundler::Installer.install(Bundler.root, definition, system: true)
59
65
  installer.post_install_messages.each do |name, message|
@@ -62,12 +68,31 @@ def gemfile(install = false, options = {}, &gemfile)
62
68
  end
63
69
  end
64
70
 
65
- runtime = Bundler::Runtime.new(nil, definition)
66
- runtime.setup.require
67
- end
68
- end
71
+ begin
72
+ runtime = Bundler::Runtime.new(nil, definition).setup
73
+ rescue Gem::LoadError => e
74
+ name = e.name
75
+ version = e.requirement.requirements.first[1]
76
+ activated_version = Gem.loaded_specs[name].version
77
+
78
+ Bundler.ui.info \
79
+ "The #{name} gem was resolved to #{version}, but #{activated_version} was activated by Bundler while installing it, causing a conflict. " \
80
+ "Bundler will now retry resolving with #{activated_version} instead."
69
81
 
70
- if ENV["BUNDLE_GEMFILE"].nil?
71
- ENV["BUNDLE_GEMFILE"] = ""
82
+ builder.dependencies.delete_if {|d| d.name == name }
83
+ builder.instance_eval { gem name, activated_version }
84
+ definition = builder.to_definition(nil, true)
85
+
86
+ retry
87
+ end
88
+
89
+ runtime.require
90
+ end
91
+ ensure
92
+ if old_gemfile
93
+ ENV["BUNDLE_GEMFILE"] = old_gemfile
94
+ else
95
+ ENV["BUNDLE_GEMFILE"] = ""
96
+ end
72
97
  end
73
98
  end
@@ -2,14 +2,15 @@
2
2
 
3
3
  module Bundler
4
4
  class GemInstaller
5
- attr_reader :spec, :standalone, :worker, :force, :installer
5
+ attr_reader :spec, :standalone, :worker, :force, :local, :installer
6
6
 
7
- def initialize(spec, installer, standalone = false, worker = 0, force = false)
7
+ def initialize(spec, installer, standalone = false, worker = 0, force = false, local = false)
8
8
  @spec = spec
9
9
  @installer = installer
10
10
  @standalone = standalone
11
11
  @worker = worker
12
12
  @force = force
13
+ @local = local
13
14
  end
14
15
 
15
16
  def install_from_spec
@@ -54,7 +55,7 @@ module Bundler
54
55
  spec.source.install(
55
56
  spec,
56
57
  force: force,
57
- ensure_builtin_gems_cached: standalone,
58
+ local: local,
58
59
  build_args: Array(spec_settings),
59
60
  previous_spec: previous_spec,
60
61
  )
@@ -68,11 +68,12 @@ module Bundler
68
68
 
69
69
  attr_reader :size
70
70
 
71
- def initialize(installer, all_specs, size, standalone, force, skip: nil)
71
+ def initialize(installer, all_specs, size, standalone, force, local: false, skip: nil)
72
72
  @installer = installer
73
73
  @size = size
74
74
  @standalone = standalone
75
75
  @force = force
76
+ @local = local
76
77
  @specs = all_specs.map {|s| SpecInstallation.new(s) }
77
78
  @specs.each do |spec_install|
78
79
  spec_install.state = :installed if skip.include?(spec_install.name)
@@ -127,7 +128,7 @@ module Bundler
127
128
  def do_install(spec_install, worker_num)
128
129
  Plugin.hook(Plugin::Events::GEM_BEFORE_INSTALL, spec_install)
129
130
  gem_installer = Bundler::GemInstaller.new(
130
- spec_install.spec, @installer, @standalone, worker_num, @force
131
+ spec_install.spec, @installer, @standalone, worker_num, @force, @local
131
132
  )
132
133
  success, message = gem_installer.install_from_spec
133
134
  if success
@@ -28,7 +28,7 @@ module Bundler
28
28
  private
29
29
 
30
30
  def paths
31
- @specs.map do |spec|
31
+ @specs.flat_map do |spec|
32
32
  next if spec.name == "bundler"
33
33
  Array(spec.require_paths).map do |path|
34
34
  gem_path(path, spec).
@@ -36,7 +36,7 @@ module Bundler
36
36
  sub(extensions_dir, 'extensions/\k<platform>/#{Gem.extension_api_version}')
37
37
  # This is a static string intentionally. It's interpolated at a later time.
38
38
  end
39
- end.flatten.compact
39
+ end.compact
40
40
  end
41
41
 
42
42
  def version_dir
@@ -58,9 +58,6 @@ module Bundler
58
58
  else
59
59
  SharedHelpers.relative_path_to(full_path, from: Bundler.root.join(bundler_path))
60
60
  end
61
- rescue TypeError
62
- error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
63
- raise Gem::InvalidSpecificationException.new(error_message)
64
61
  end
65
62
 
66
63
  def prevent_gem_activation
@@ -69,9 +69,7 @@ module Bundler
69
69
  Bundler.create_bundle_path
70
70
 
71
71
  ProcessLock.lock do
72
- if Bundler.frozen_bundle?
73
- @definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
74
- end
72
+ @definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
75
73
 
76
74
  if @definition.dependencies.empty?
77
75
  Bundler.ui.warn "The Gemfile specifies no dependencies"
@@ -79,12 +77,9 @@ module Bundler
79
77
  return
80
78
  end
81
79
 
82
- if resolve_if_needed(options)
80
+ if @definition.setup_domain!(options)
83
81
  ensure_specs_are_compatible!
84
82
  load_plugins
85
- options.delete(:jobs)
86
- else
87
- options[:jobs] = 1 # to avoid the overhead of Bundler::Worker
88
83
  end
89
84
  install(options)
90
85
 
@@ -96,6 +91,11 @@ module Bundler
96
91
  end
97
92
 
98
93
  def generate_bundler_executable_stubs(spec, options = {})
94
+ if spec.name == "bundler"
95
+ Bundler.ui.warn "Bundler itself does not use binstubs because its version is selected by RubyGems"
96
+ return
97
+ end
98
+
99
99
  if options[:binstubs_cmd] && spec.executables.empty?
100
100
  options = {}
101
101
  spec.runtime_dependencies.each do |dep|
@@ -120,10 +120,6 @@ module Bundler
120
120
  ruby_command = Thor::Util.ruby_command
121
121
  ruby_command = ruby_command
122
122
  template_path = File.expand_path("templates/Executable", __dir__)
123
- if spec.name == "bundler"
124
- template_path += ".bundler"
125
- spec.executables = %(bundle)
126
- end
127
123
  template = File.read(template_path)
128
124
 
129
125
  exists = []
@@ -196,16 +192,17 @@ module Bundler
196
192
  # that said, it's a rare situation (other than rake), and parallel
197
193
  # installation is SO MUCH FASTER. so we let people opt in.
198
194
  def install(options)
199
- force = options["force"]
200
- jobs = installation_parallelization(options)
201
- install_in_parallel jobs, options[:standalone], force
202
- end
203
-
204
- def installation_parallelization(options)
205
- if jobs = options.delete(:jobs)
206
- return jobs
195
+ standalone = options[:standalone]
196
+ force = options[:force]
197
+ local = options[:local] || options[:"prefer-local"]
198
+ jobs = installation_parallelization
199
+ spec_installations = ParallelInstaller.call(self, @definition.specs, jobs, standalone, force, local: local)
200
+ spec_installations.each do |installation|
201
+ post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
207
202
  end
203
+ end
208
204
 
205
+ def installation_parallelization
209
206
  if jobs = Bundler.settings[:jobs]
210
207
  return jobs
211
208
  end
@@ -216,13 +213,13 @@ module Bundler
216
213
  def load_plugins
217
214
  Gem.load_plugins
218
215
 
219
- requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
220
- path_plugin_files = requested_path_gems.map do |spec|
221
- Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
216
+ requested_path_gems = @definition.specs.select {|s| s.source.is_a?(Source::Path) }
217
+ path_plugin_files = requested_path_gems.flat_map do |spec|
218
+ spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
222
219
  rescue TypeError
223
220
  error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
224
221
  raise Gem::InvalidSpecificationException, error_message
225
- end.flatten
222
+ end
226
223
  Gem.load_plugin_files(path_plugin_files)
227
224
  Gem.load_env_plugins
228
225
  end
@@ -240,28 +237,8 @@ module Bundler
240
237
  end
241
238
  end
242
239
 
243
- def install_in_parallel(size, standalone, force = false)
244
- spec_installations = ParallelInstaller.call(self, @definition.specs, size, standalone, force)
245
- spec_installations.each do |installation|
246
- post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
247
- end
248
- end
249
-
250
- # returns whether or not a re-resolve was needed
251
- def resolve_if_needed(options)
252
- @definition.resolution_mode = options
253
-
254
- if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
255
- return false if @definition.nothing_changed? && !@definition.missing_specs?
256
- end
257
-
258
- @definition.setup_sources_for_resolve
259
-
260
- true
261
- end
262
-
263
- def lock(opts = {})
264
- @definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
240
+ def lock
241
+ @definition.lock
265
242
  end
266
243
  end
267
244
  end
@@ -4,31 +4,62 @@ require_relative "force_platform"
4
4
 
5
5
  module Bundler
6
6
  class LazySpecification
7
+ include MatchMetadata
7
8
  include MatchPlatform
8
9
  include ForcePlatform
9
10
 
10
- attr_reader :name, :version, :platform
11
+ attr_reader :name, :version, :platform, :materialization
11
12
  attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version
12
13
 
14
+ #
15
+ # For backwards compatibility with existing lockfiles, if the most specific
16
+ # locked platform is not a specific platform like x86_64-linux or
17
+ # universal-java-11, then we keep the previous behaviour of resolving the
18
+ # best platform variant at materiliazation time. For previous bundler
19
+ # versions (before 2.2.0) this was always the case (except when the lockfile
20
+ # only included non-ruby platforms), but we're also keeping this behaviour
21
+ # on newer bundlers unless users generate the lockfile from scratch or
22
+ # explicitly add a more specific platform.
23
+ #
24
+ attr_accessor :most_specific_locked_platform
25
+
13
26
  alias_method :runtime_dependencies, :dependencies
14
27
 
15
28
  def self.from_spec(s)
16
29
  lazy_spec = new(s.name, s.version, s.platform, s.source)
17
- lazy_spec.dependencies = s.dependencies
30
+ lazy_spec.dependencies = s.runtime_dependencies
18
31
  lazy_spec.required_ruby_version = s.required_ruby_version
19
32
  lazy_spec.required_rubygems_version = s.required_rubygems_version
20
33
  lazy_spec
21
34
  end
22
35
 
23
- def initialize(name, version, platform, source = nil)
36
+ def initialize(name, version, platform, source = nil, **materialization_options)
24
37
  @name = name
25
38
  @version = version
26
39
  @dependencies = []
27
40
  @required_ruby_version = Gem::Requirement.default
28
41
  @required_rubygems_version = Gem::Requirement.default
29
- @platform = platform || Gem::Platform::RUBY
30
- @source = source
42
+ @platform = platform || Gem::Platform::RUBY
43
+
44
+ @original_source = source
45
+ @source = source
46
+ @materialization_options = materialization_options
47
+
31
48
  @force_ruby_platform = default_force_ruby_platform
49
+ @most_specific_locked_platform = nil
50
+ @materialization = nil
51
+ end
52
+
53
+ def missing?
54
+ @materialization == self
55
+ end
56
+
57
+ def incomplete?
58
+ @materialization.nil?
59
+ end
60
+
61
+ def source_changed?
62
+ @original_source != source
32
63
  end
33
64
 
34
65
  def full_name
@@ -91,47 +122,45 @@ module Bundler
91
122
  out
92
123
  end
93
124
 
125
+ def materialize_for_cache
126
+ source.remote!
127
+
128
+ materialize(self, &:first)
129
+ end
130
+
131
+ def materialized_for_installation
132
+ @materialization = materialize_for_installation
133
+
134
+ self unless incomplete?
135
+ end
136
+
94
137
  def materialize_for_installation
95
138
  source.local!
96
139
 
97
- matching_specs = source.specs.search(use_exact_resolved_specifications? ? self : [name, version])
98
- return self if matching_specs.empty?
99
-
100
- candidates = if use_exact_resolved_specifications?
101
- matching_specs
140
+ if use_exact_resolved_specifications?
141
+ materialize(self) do |matching_specs|
142
+ choose_compatible(matching_specs)
143
+ end
102
144
  else
103
- target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform
145
+ materialize([name, version]) do |matching_specs|
146
+ target_platform = source.is_a?(Source::Path) ? platform : Bundler.local_platform
104
147
 
105
- installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
148
+ installable_candidates = MatchPlatform.select_best_platform_match(matching_specs, target_platform)
106
149
 
107
- specification = __materialize__(installable_candidates, fallback_to_non_installable: false)
108
- return specification unless specification.nil?
150
+ specification = choose_compatible(installable_candidates, fallback_to_non_installable: false)
151
+ return specification unless specification.nil?
109
152
 
110
- if target_platform != platform
111
- installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
112
- end
153
+ if target_platform != platform
154
+ installable_candidates = MatchPlatform.select_best_platform_match(matching_specs, platform)
155
+ end
113
156
 
114
- installable_candidates
157
+ choose_compatible(installable_candidates)
158
+ end
115
159
  end
116
-
117
- __materialize__(candidates)
118
160
  end
119
161
 
120
- # If in frozen mode, we fallback to a non-installable candidate because by
121
- # doing this we avoid re-resolving and potentially end up changing the
122
- # lock file, which is not allowed. In that case, we will give a proper error
123
- # about the mismatch higher up the stack, right before trying to install the
124
- # bad gem.
125
- def __materialize__(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
126
- search = candidates.reverse.find do |spec|
127
- spec.is_a?(StubSpecification) || spec.matches_current_metadata?
128
- end
129
- if search.nil? && fallback_to_non_installable
130
- search = candidates.last
131
- else
132
- search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
133
- end
134
- search
162
+ def inspect
163
+ "#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>"
135
164
  end
136
165
 
137
166
  def to_s
@@ -147,26 +176,70 @@ module Bundler
147
176
  @force_ruby_platform = true
148
177
  end
149
178
 
179
+ def replace_source_with!(gemfile_source)
180
+ return unless gemfile_source.can_lock?(self)
181
+
182
+ @source = gemfile_source
183
+
184
+ true
185
+ end
186
+
150
187
  private
151
188
 
152
189
  def use_exact_resolved_specifications?
153
- @use_exact_resolved_specifications ||= !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
190
+ !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
154
191
  end
155
192
 
156
- #
157
- # For backwards compatibility with existing lockfiles, if the most specific
158
- # locked platform is not a specific platform like x86_64-linux or
159
- # universal-java-11, then we keep the previous behaviour of resolving the
160
- # best platform variant at materiliazation time. For previous bundler
161
- # versions (before 2.2.0) this was always the case (except when the lockfile
162
- # only included non-ruby platforms), but we're also keeping this behaviour
163
- # on newer bundlers unless users generate the lockfile from scratch or
164
- # explicitly add a more specific platform.
165
- #
166
193
  def ruby_platform_materializes_to_ruby_platform?
167
- generic_platform = generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
194
+ generic_platform = Bundler.generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
195
+
196
+ (most_specific_locked_platform != generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
197
+ end
198
+
199
+ def materialize(query)
200
+ matching_specs = source.specs.search(query)
201
+ return self if matching_specs.empty?
202
+
203
+ yield matching_specs
204
+ end
168
205
 
169
- !Bundler.most_specific_locked_platform?(generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
206
+ # If in frozen mode, we fallback to a non-installable candidate because by
207
+ # doing this we avoid re-resolving and potentially end up changing the
208
+ # lockfile, which is not allowed. In that case, we will give a proper error
209
+ # about the mismatch higher up the stack, right before trying to install the
210
+ # bad gem.
211
+ def choose_compatible(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
212
+ search = candidates.reverse.find do |spec|
213
+ spec.is_a?(StubSpecification) || spec.matches_current_metadata?
214
+ end
215
+ if search.nil? && fallback_to_non_installable
216
+ search = candidates.last
217
+ end
218
+
219
+ if search
220
+ validate_dependencies(search) if search.platform == platform
221
+
222
+ search.locked_platform = platform if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification)
223
+ end
224
+ search
225
+ end
226
+
227
+ # Validate dependencies of this locked spec are consistent with dependencies
228
+ # of the actual spec that was materialized.
229
+ #
230
+ # Note that unless we are in strict mode (which we set during installation)
231
+ # we don't validate dependencies of locally installed gems but
232
+ # accept what's in the lockfile instead for performance, since loading
233
+ # dependencies of locally installed gems would mean evaluating all gemspecs,
234
+ # which would affect `bundler/setup` performance.
235
+ def validate_dependencies(spec)
236
+ if !@materialization_options[:strict] && spec.is_a?(StubSpecification)
237
+ spec.dependencies = dependencies
238
+ else
239
+ if !source.is_a?(Source::Path) && spec.runtime_dependencies.sort != dependencies.sort
240
+ raise IncorrectLockfileDependencies.new(self)
241
+ end
242
+ end
170
243
  end
171
244
  end
172
245
  end
@@ -29,7 +29,7 @@ module Bundler
29
29
  private
30
30
 
31
31
  def add_sources
32
- definition.send(:sources).lock_sources.each_with_index do |source, idx|
32
+ definition.sources.lock_sources.each_with_index do |source, idx|
33
33
  out << "\n" unless idx.zero?
34
34
 
35
35
  # Add the source header