rubygems-update 3.5.5 → 3.6.9

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 (413) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +606 -1
  3. data/CODE_OF_CONDUCT.md +79 -28
  4. data/Manifest.txt +114 -73
  5. data/README.md +16 -11
  6. data/bundler/CHANGELOG.md +506 -6
  7. data/bundler/README.md +2 -2
  8. data/bundler/bundler.gemspec +2 -2
  9. data/bundler/lib/bundler/build_metadata.rb +2 -2
  10. data/bundler/lib/bundler/checksum.rb +22 -12
  11. data/bundler/lib/bundler/cli/add.rb +3 -1
  12. data/bundler/lib/bundler/cli/binstubs.rb +1 -1
  13. data/bundler/lib/bundler/cli/check.rb +3 -3
  14. data/bundler/lib/bundler/cli/console.rb +8 -10
  15. data/bundler/lib/bundler/cli/doctor/diagnose.rb +167 -0
  16. data/bundler/lib/bundler/cli/doctor/ssl.rb +249 -0
  17. data/bundler/lib/bundler/cli/doctor.rb +27 -151
  18. data/bundler/lib/bundler/cli/exec.rb +1 -0
  19. data/bundler/lib/bundler/cli/fund.rb +1 -1
  20. data/bundler/lib/bundler/cli/gem.rb +13 -17
  21. data/bundler/lib/bundler/cli/info.rb +6 -6
  22. data/bundler/lib/bundler/cli/inject.rb +3 -3
  23. data/bundler/lib/bundler/cli/install.rb +14 -5
  24. data/bundler/lib/bundler/cli/issue.rb +3 -3
  25. data/bundler/lib/bundler/cli/lock.rb +32 -11
  26. data/bundler/lib/bundler/cli/outdated.rb +22 -22
  27. data/bundler/lib/bundler/cli/plugin.rb +3 -2
  28. data/bundler/lib/bundler/cli/pristine.rb +1 -1
  29. data/bundler/lib/bundler/cli/show.rb +3 -3
  30. data/bundler/lib/bundler/cli.rb +51 -107
  31. data/bundler/lib/bundler/compact_index_client/cache.rb +48 -73
  32. data/bundler/lib/bundler/compact_index_client/cache_file.rb +0 -5
  33. data/bundler/lib/bundler/compact_index_client/parser.rb +84 -0
  34. data/bundler/lib/bundler/compact_index_client/updater.rb +2 -12
  35. data/bundler/lib/bundler/compact_index_client.rb +51 -80
  36. data/bundler/lib/bundler/constants.rb +8 -1
  37. data/bundler/lib/bundler/current_ruby.rb +23 -33
  38. data/bundler/lib/bundler/definition.rb +485 -313
  39. data/bundler/lib/bundler/dependency.rb +92 -46
  40. data/bundler/lib/bundler/dsl.rb +135 -101
  41. data/bundler/lib/bundler/endpoint_specification.rb +30 -3
  42. data/bundler/lib/bundler/env.rb +1 -1
  43. data/bundler/lib/bundler/environment_preserver.rb +5 -23
  44. data/bundler/lib/bundler/errors.rb +53 -5
  45. data/bundler/lib/bundler/feature_flag.rb +3 -6
  46. data/bundler/lib/bundler/fetcher/compact_index.rb +16 -25
  47. data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
  48. data/bundler/lib/bundler/fetcher.rb +14 -7
  49. data/bundler/lib/bundler/force_platform.rb +0 -2
  50. data/bundler/lib/bundler/friendly_errors.rb +1 -1
  51. data/bundler/lib/bundler/gem_helper.rb +1 -1
  52. data/bundler/lib/bundler/gem_helpers.rb +36 -19
  53. data/bundler/lib/bundler/gem_version_promoter.rb +42 -40
  54. data/bundler/lib/bundler/injector.rb +14 -16
  55. data/bundler/lib/bundler/inline.rb +42 -17
  56. data/bundler/lib/bundler/installer/gem_installer.rb +4 -3
  57. data/bundler/lib/bundler/installer/parallel_installer.rb +3 -2
  58. data/bundler/lib/bundler/installer/standalone.rb +2 -5
  59. data/bundler/lib/bundler/installer.rb +17 -41
  60. data/bundler/lib/bundler/lazy_specification.rb +117 -46
  61. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  62. data/bundler/lib/bundler/lockfile_parser.rb +18 -7
  63. data/bundler/lib/bundler/man/bundle-add.1 +44 -27
  64. data/bundler/lib/bundler/man/bundle-add.1.ronn +52 -23
  65. data/bundler/lib/bundler/man/bundle-binstubs.1 +9 -6
  66. data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
  67. data/bundler/lib/bundler/man/bundle-cache.1 +32 -4
  68. data/bundler/lib/bundler/man/bundle-cache.1.ronn +31 -2
  69. data/bundler/lib/bundler/man/bundle-check.1 +7 -5
  70. data/bundler/lib/bundler/man/bundle-check.1.ronn +7 -2
  71. data/bundler/lib/bundler/man/bundle-clean.1 +3 -3
  72. data/bundler/lib/bundler/man/bundle-config.1 +11 -15
  73. data/bundler/lib/bundler/man/bundle-config.1.ronn +12 -15
  74. data/bundler/lib/bundler/man/bundle-console.1 +4 -6
  75. data/bundler/lib/bundler/man/bundle-console.1.ronn +2 -7
  76. data/bundler/lib/bundler/man/bundle-doctor.1 +4 -4
  77. data/bundler/lib/bundler/man/bundle-doctor.1.ronn +1 -1
  78. data/bundler/lib/bundler/man/bundle-env.1 +9 -0
  79. data/bundler/lib/bundler/man/bundle-env.1.ronn +10 -0
  80. data/bundler/lib/bundler/man/bundle-exec.1 +9 -6
  81. data/bundler/lib/bundler/man/bundle-exec.1.ronn +6 -3
  82. data/bundler/lib/bundler/man/bundle-fund.1 +22 -0
  83. data/bundler/lib/bundler/man/bundle-fund.1.ronn +25 -0
  84. data/bundler/lib/bundler/man/bundle-gem.1 +25 -7
  85. data/bundler/lib/bundler/man/bundle-gem.1.ronn +38 -6
  86. data/bundler/lib/bundler/man/bundle-help.1 +3 -3
  87. data/bundler/lib/bundler/man/bundle-info.1 +7 -4
  88. data/bundler/lib/bundler/man/bundle-info.1.ronn +6 -2
  89. data/bundler/lib/bundler/man/bundle-init.1 +5 -5
  90. data/bundler/lib/bundler/man/bundle-init.1.ronn +3 -2
  91. data/bundler/lib/bundler/man/bundle-inject.1 +12 -4
  92. data/bundler/lib/bundler/man/bundle-inject.1.ronn +9 -1
  93. data/bundler/lib/bundler/man/bundle-install.1 +19 -16
  94. data/bundler/lib/bundler/man/bundle-install.1.ronn +24 -20
  95. data/bundler/lib/bundler/man/bundle-issue.1 +45 -0
  96. data/bundler/lib/bundler/man/bundle-issue.1.ronn +37 -0
  97. data/bundler/lib/bundler/man/bundle-licenses.1 +9 -0
  98. data/bundler/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  99. data/bundler/lib/bundler/man/bundle-list.1 +3 -3
  100. data/bundler/lib/bundler/man/bundle-list.1.ronn +4 -1
  101. data/bundler/lib/bundler/man/bundle-lock.1 +23 -8
  102. data/bundler/lib/bundler/man/bundle-lock.1.ronn +25 -4
  103. data/bundler/lib/bundler/man/bundle-open.1 +4 -4
  104. data/bundler/lib/bundler/man/bundle-open.1.ronn +2 -1
  105. data/bundler/lib/bundler/man/bundle-outdated.1 +10 -7
  106. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +8 -4
  107. data/bundler/lib/bundler/man/bundle-platform.1 +3 -3
  108. data/bundler/lib/bundler/man/bundle-plugin.1 +9 -6
  109. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +7 -3
  110. data/bundler/lib/bundler/man/bundle-pristine.1 +3 -3
  111. data/bundler/lib/bundler/man/bundle-pristine.1.ronn +1 -1
  112. data/bundler/lib/bundler/man/bundle-remove.1 +3 -3
  113. data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -1
  114. data/bundler/lib/bundler/man/bundle-show.1 +7 -4
  115. data/bundler/lib/bundler/man/bundle-show.1.ronn +4 -0
  116. data/bundler/lib/bundler/man/bundle-update.1 +15 -9
  117. data/bundler/lib/bundler/man/bundle-update.1.ronn +14 -6
  118. data/bundler/lib/bundler/man/bundle-version.1 +3 -3
  119. data/bundler/lib/bundler/man/bundle-viz.1 +6 -6
  120. data/bundler/lib/bundler/man/bundle-viz.1.ronn +7 -3
  121. data/bundler/lib/bundler/man/bundle.1 +3 -3
  122. data/bundler/lib/bundler/man/gemfile.5 +7 -5
  123. data/bundler/lib/bundler/man/gemfile.5.ronn +8 -2
  124. data/bundler/lib/bundler/man/index.txt +4 -0
  125. data/bundler/lib/bundler/match_metadata.rb +13 -0
  126. data/bundler/lib/bundler/materialization.rb +59 -0
  127. data/bundler/lib/bundler/mirror.rb +3 -3
  128. data/bundler/lib/bundler/plugin/api/source.rb +5 -4
  129. data/bundler/lib/bundler/plugin/events.rb +24 -0
  130. data/bundler/lib/bundler/plugin/index.rb +5 -1
  131. data/bundler/lib/bundler/plugin/installer/path.rb +26 -0
  132. data/bundler/lib/bundler/plugin/installer.rb +37 -17
  133. data/bundler/lib/bundler/plugin/source_list.rb +4 -4
  134. data/bundler/lib/bundler/plugin.rb +21 -2
  135. data/bundler/lib/bundler/process_lock.rb +10 -14
  136. data/bundler/lib/bundler/remote_specification.rb +6 -1
  137. data/bundler/lib/bundler/resolver/base.rb +14 -3
  138. data/bundler/lib/bundler/resolver/candidate.rb +18 -27
  139. data/bundler/lib/bundler/resolver/package.rb +20 -3
  140. data/bundler/lib/bundler/resolver/spec_group.rb +22 -27
  141. data/bundler/lib/bundler/resolver/strategy.rb +40 -0
  142. data/bundler/lib/bundler/resolver.rb +114 -50
  143. data/bundler/lib/bundler/retry.rb +1 -1
  144. data/bundler/lib/bundler/ruby_dsl.rb +12 -3
  145. data/bundler/lib/bundler/ruby_version.rb +7 -1
  146. data/bundler/lib/bundler/rubygems_ext.rb +282 -125
  147. data/bundler/lib/bundler/rubygems_gem_installer.rb +40 -5
  148. data/bundler/lib/bundler/rubygems_integration.rb +29 -67
  149. data/bundler/lib/bundler/runtime.rb +48 -35
  150. data/bundler/lib/bundler/self_manager.rb +27 -7
  151. data/bundler/lib/bundler/settings.rb +32 -21
  152. data/bundler/lib/bundler/setup.rb +6 -0
  153. data/bundler/lib/bundler/shared_helpers.rb +39 -21
  154. data/bundler/lib/bundler/source/gemspec.rb +1 -4
  155. data/bundler/lib/bundler/source/git/git_proxy.rb +23 -6
  156. data/bundler/lib/bundler/source/git.rb +113 -41
  157. data/bundler/lib/bundler/source/metadata.rb +4 -3
  158. data/bundler/lib/bundler/source/path.rb +7 -18
  159. data/bundler/lib/bundler/source/rubygems/remote.rb +12 -4
  160. data/bundler/lib/bundler/source/rubygems.rb +54 -48
  161. data/bundler/lib/bundler/source.rb +2 -0
  162. data/bundler/lib/bundler/source_list.rb +53 -7
  163. data/bundler/lib/bundler/spec_set.rb +187 -88
  164. data/bundler/lib/bundler/stub_specification.rb +29 -2
  165. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
  166. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -3
  167. data/bundler/lib/bundler/templates/newgem/README.md.tt +7 -3
  168. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -15
  169. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -7
  170. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
  171. data/bundler/lib/bundler/ui/shell.rb +24 -2
  172. data/bundler/lib/bundler/ui/silent.rb +12 -1
  173. data/bundler/lib/bundler/uri_credentials_filter.rb +3 -3
  174. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +53 -3
  175. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  176. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +11 -0
  177. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
  178. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +68 -30
  179. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +4 -24
  180. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +1 -0
  181. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
  182. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +20 -8
  183. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +17 -29
  184. data/bundler/lib/bundler/vendor/securerandom/COPYING +56 -0
  185. data/bundler/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
  186. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
  187. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
  188. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
  189. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
  190. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
  191. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
  192. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  193. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
  194. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  195. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  196. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +11 -0
  197. data/bundler/lib/bundler/vendor/uri/COPYING +56 -0
  198. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +43 -16
  199. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
  200. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
  201. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +28 -37
  202. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
  203. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +16 -9
  204. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  205. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  206. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +9 -9
  207. data/bundler/lib/bundler/vendored_net_http.rb +20 -5
  208. data/bundler/lib/bundler/vendored_securerandom.rb +12 -0
  209. data/bundler/lib/bundler/vendored_timeout.rb +7 -3
  210. data/bundler/lib/bundler/vendored_uri.rb +18 -1
  211. data/bundler/lib/bundler/version.rb +1 -1
  212. data/bundler/lib/bundler/yaml_serializer.rb +12 -7
  213. data/bundler/lib/bundler.rb +89 -51
  214. data/{CONTRIBUTING.md → doc/rubygems/CONTRIBUTING.md} +10 -14
  215. data/{POLICIES.md → doc/rubygems/POLICIES.md} +81 -12
  216. data/exe/update_rubygems +1 -1
  217. data/lib/rubygems/basic_specification.rb +43 -10
  218. data/lib/rubygems/bundler_version_finder.rb +1 -1
  219. data/lib/rubygems/command.rb +1 -4
  220. data/lib/rubygems/command_manager.rb +5 -6
  221. data/lib/rubygems/commands/build_command.rb +2 -11
  222. data/lib/rubygems/commands/cleanup_command.rb +3 -13
  223. data/lib/rubygems/commands/contents_command.rb +17 -10
  224. data/lib/rubygems/commands/environment_command.rb +5 -0
  225. data/lib/rubygems/commands/exec_command.rb +18 -11
  226. data/lib/rubygems/commands/fetch_command.rb +14 -0
  227. data/lib/rubygems/commands/help_command.rb +2 -2
  228. data/lib/rubygems/commands/install_command.rb +0 -4
  229. data/lib/rubygems/commands/pristine_command.rb +30 -17
  230. data/lib/rubygems/commands/push_command.rb +31 -6
  231. data/lib/rubygems/commands/rdoc_command.rb +3 -10
  232. data/lib/rubygems/commands/rebuild_command.rb +262 -0
  233. data/lib/rubygems/commands/setup_command.rb +11 -16
  234. data/lib/rubygems/commands/sources_command.rb +2 -2
  235. data/lib/rubygems/commands/uninstall_command.rb +9 -4
  236. data/lib/rubygems/commands/unpack_command.rb +0 -6
  237. data/lib/rubygems/commands/update_command.rb +10 -17
  238. data/lib/rubygems/config_file.rb +45 -16
  239. data/lib/rubygems/core_ext/kernel_warn.rb +2 -6
  240. data/lib/rubygems/defaults.rb +6 -6
  241. data/lib/rubygems/dependency.rb +12 -16
  242. data/lib/rubygems/dependency_list.rb +1 -1
  243. data/lib/rubygems/deprecate.rb +79 -77
  244. data/lib/rubygems/errors.rb +2 -1
  245. data/lib/rubygems/exceptions.rb +2 -9
  246. data/lib/rubygems/ext/builder.rb +21 -8
  247. data/lib/rubygems/ext/cargo_builder.rb +12 -26
  248. data/lib/rubygems/ext/cmake_builder.rb +7 -2
  249. data/lib/rubygems/ext/configure_builder.rb +7 -2
  250. data/lib/rubygems/ext/ext_conf_builder.rb +9 -5
  251. data/lib/rubygems/ext/rake_builder.rb +7 -4
  252. data/lib/rubygems/gem_runner.rb +9 -0
  253. data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +1 -1
  254. data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +3 -1
  255. data/lib/rubygems/gemcutter_utilities.rb +52 -26
  256. data/lib/rubygems/gemspec_helpers.rb +19 -0
  257. data/lib/rubygems/install_update_options.rb +5 -0
  258. data/lib/rubygems/installer.rb +31 -40
  259. data/lib/rubygems/local_remote_options.rb +8 -8
  260. data/lib/rubygems/package/tar_header.rb +31 -4
  261. data/lib/rubygems/package/tar_reader/entry.rb +1 -5
  262. data/lib/rubygems/package/tar_writer.rb +5 -4
  263. data/lib/rubygems/package.rb +13 -8
  264. data/lib/rubygems/platform.rb +7 -5
  265. data/lib/rubygems/psych_tree.rb +4 -0
  266. data/lib/rubygems/query_utils.rb +2 -2
  267. data/lib/rubygems/rdoc.rb +16 -3
  268. data/lib/rubygems/remote_fetcher.rb +3 -4
  269. data/lib/rubygems/request.rb +5 -5
  270. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  271. data/lib/rubygems/request_set.rb +1 -1
  272. data/lib/rubygems/requirement.rb +16 -12
  273. data/lib/rubygems/resolver/activation_request.rb +1 -1
  274. data/lib/rubygems/resolver/api_set/gem_parser.rb +2 -5
  275. data/lib/rubygems/resolver/api_set.rb +13 -8
  276. data/lib/rubygems/resolver/best_set.rb +0 -28
  277. data/lib/rubygems/resolver/composed_set.rb +3 -3
  278. data/lib/rubygems/resolver/git_set.rb +0 -1
  279. data/lib/rubygems/resolver/index_set.rb +2 -2
  280. data/lib/rubygems/resolver/spec_specification.rb +7 -0
  281. data/lib/rubygems/resolver.rb +7 -7
  282. data/lib/rubygems/s3_uri_signer.rb +3 -3
  283. data/lib/rubygems/safe_marshal/reader.rb +31 -14
  284. data/lib/rubygems/safe_marshal/visitors/to_ruby.rb +29 -16
  285. data/lib/rubygems/safe_yaml.rb +10 -1
  286. data/lib/rubygems/security.rb +1 -1
  287. data/lib/rubygems/source/git.rb +22 -17
  288. data/lib/rubygems/source/installed.rb +3 -1
  289. data/lib/rubygems/source/local.rb +8 -4
  290. data/lib/rubygems/source/specific_file.rb +5 -3
  291. data/lib/rubygems/source.rb +10 -8
  292. data/lib/rubygems/source_list.rb +1 -1
  293. data/lib/rubygems/spec_fetcher.rb +47 -15
  294. data/lib/rubygems/specification.rb +107 -180
  295. data/lib/rubygems/specification_policy.rb +33 -13
  296. data/lib/rubygems/specification_record.rb +212 -0
  297. data/lib/rubygems/stub_specification.rb +32 -10
  298. data/lib/rubygems/target_rbconfig.rb +50 -0
  299. data/lib/rubygems/uninstaller.rb +42 -22
  300. data/lib/rubygems/uri.rb +6 -6
  301. data/lib/rubygems/util/licenses.rb +97 -1
  302. data/lib/rubygems/util.rb +1 -1
  303. data/lib/rubygems/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
  304. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/delegates/specification_provider.rb +11 -11
  305. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
  306. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
  307. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
  308. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
  309. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  310. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/log.rb +1 -1
  311. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
  312. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
  313. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/vertex.rb +1 -1
  314. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph.rb +2 -2
  315. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/errors.rb +1 -1
  316. data/lib/rubygems/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
  317. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/specification_provider.rb +2 -2
  318. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/ui.rb +1 -1
  319. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolution.rb +4 -4
  320. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolver.rb +1 -1
  321. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/state.rb +1 -1
  322. data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo.rb +2 -2
  323. data/lib/rubygems/vendor/net-http/COPYING +56 -0
  324. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/generic_request.rb +9 -9
  325. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/header.rb +3 -3
  326. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/request.rb +3 -3
  327. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/requests.rb +35 -30
  328. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/response.rb +2 -2
  329. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/responses.rb +6 -6
  330. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/status.rb +1 -1
  331. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http.rb +135 -51
  332. data/lib/rubygems/{net-http → vendor/net-http}/lib/net/https.rb +1 -1
  333. data/lib/rubygems/vendor/optparse/COPYING +56 -0
  334. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/ac.rb +16 -0
  335. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/kwargs.rb +8 -3
  336. data/lib/rubygems/vendor/optparse/lib/optparse/uri.rb +7 -0
  337. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/version.rb +9 -0
  338. data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse.rb +158 -62
  339. data/lib/rubygems/vendor/resolv/COPYING +56 -0
  340. data/lib/rubygems/{resolv → vendor/resolv}/lib/resolv.rb +117 -49
  341. data/lib/rubygems/vendor/securerandom/COPYING +56 -0
  342. data/lib/rubygems/vendor/securerandom/lib/securerandom.rb +102 -0
  343. data/lib/rubygems/vendor/timeout/.document +1 -0
  344. data/lib/rubygems/vendor/timeout/COPYING +56 -0
  345. data/lib/rubygems/{timeout → vendor/timeout}/lib/timeout.rb +10 -11
  346. data/lib/rubygems/vendor/tsort/.document +1 -0
  347. data/lib/rubygems/{tsort → vendor/tsort}/lib/tsort.rb +2 -2
  348. data/lib/rubygems/vendor/uri/.document +1 -0
  349. data/lib/rubygems/vendor/uri/COPYING +56 -0
  350. data/lib/rubygems/vendor/uri/lib/uri/common.rb +880 -0
  351. data/lib/rubygems/vendor/uri/lib/uri/file.rb +100 -0
  352. data/lib/rubygems/vendor/uri/lib/uri/ftp.rb +267 -0
  353. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +1579 -0
  354. data/lib/rubygems/vendor/uri/lib/uri/http.rb +125 -0
  355. data/lib/rubygems/vendor/uri/lib/uri/https.rb +23 -0
  356. data/lib/rubygems/vendor/uri/lib/uri/ldap.rb +261 -0
  357. data/lib/rubygems/vendor/uri/lib/uri/ldaps.rb +22 -0
  358. data/lib/rubygems/vendor/uri/lib/uri/mailto.rb +293 -0
  359. data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
  360. data/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +206 -0
  361. data/lib/rubygems/vendor/uri/lib/uri/version.rb +6 -0
  362. data/lib/rubygems/vendor/uri/lib/uri/ws.rb +83 -0
  363. data/lib/rubygems/vendor/uri/lib/uri/wss.rb +23 -0
  364. data/lib/rubygems/vendor/uri/lib/uri.rb +104 -0
  365. data/lib/rubygems/vendored_molinillo.rb +3 -0
  366. data/lib/rubygems/vendored_net_http.rb +5 -0
  367. data/lib/rubygems/vendored_optparse.rb +3 -0
  368. data/lib/rubygems/vendored_securerandom.rb +3 -0
  369. data/lib/rubygems/vendored_timeout.rb +5 -0
  370. data/lib/rubygems/vendored_tsort.rb +3 -0
  371. data/lib/rubygems/version.rb +26 -9
  372. data/lib/rubygems/yaml_serializer.rb +12 -7
  373. data/lib/rubygems.rb +82 -47
  374. data/rubygems-update.gemspec +11 -6
  375. data/setup.rb +1 -1
  376. metadata +131 -86
  377. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +0 -32
  378. data/lib/rubygems/net/http.rb +0 -3
  379. data/lib/rubygems/net-http/LICENSE.txt +0 -22
  380. data/lib/rubygems/net-http/lib/net/http/backward.rb +0 -40
  381. data/lib/rubygems/net-protocol/LICENSE.txt +0 -22
  382. data/lib/rubygems/optparse/lib/optparse/uri.rb +0 -7
  383. data/lib/rubygems/optparse.rb +0 -3
  384. data/lib/rubygems/resolv/LICENSE.txt +0 -22
  385. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  386. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  387. data/lib/rubygems/resolver/molinillo.rb +0 -3
  388. data/lib/rubygems/shellwords.rb +0 -3
  389. data/lib/rubygems/timeout/LICENSE.txt +0 -22
  390. data/lib/rubygems/timeout.rb +0 -3
  391. data/lib/rubygems/tsort/LICENSE.txt +0 -22
  392. data/lib/rubygems/tsort.rb +0 -3
  393. /data/{lib/rubygems/optparse → bundler/lib/bundler/vendor/fileutils}/COPYING +0 -0
  394. /data/{lib/rubygems/net-http → bundler/lib/bundler/vendor/securerandom}/.document +0 -0
  395. /data/{MAINTAINERS.txt → doc/MAINTAINERS.txt} +0 -0
  396. /data/{bundler → doc/bundler}/UPGRADING.md +0 -0
  397. /data/{UPGRADING.md → doc/rubygems/UPGRADING.md} +0 -0
  398. /data/lib/rubygems/{net-protocol → vendor/molinillo}/.document +0 -0
  399. /data/lib/rubygems/{resolver → vendor}/molinillo/LICENSE +0 -0
  400. /data/lib/rubygems/{optparse → vendor/net-http}/.document +0 -0
  401. /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/exceptions.rb +0 -0
  402. /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/proxy_delta.rb +0 -0
  403. /data/lib/rubygems/{resolv → vendor/net-protocol}/.document +0 -0
  404. /data/{bundler/lib/bundler/vendor/fileutils → lib/rubygems/vendor/net-protocol}/LICENSE.txt +0 -0
  405. /data/lib/rubygems/{net-protocol → vendor/net-protocol}/lib/net/protocol.rb +0 -0
  406. /data/lib/rubygems/{resolver/molinillo → vendor/optparse}/.document +0 -0
  407. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optionparser.rb +0 -0
  408. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/date.rb +0 -0
  409. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/shellwords.rb +0 -0
  410. /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/time.rb +0 -0
  411. /data/lib/rubygems/{timeout → vendor/resolv}/.document +0 -0
  412. /data/lib/rubygems/{tsort → vendor/securerandom}/.document +0 -0
  413. /data/{bundler/lib/bundler/vendor/uri → lib/rubygems/vendor/tsort}/LICENSE.txt +0 -0
@@ -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
 
@@ -196,16 +191,17 @@ module Bundler
196
191
  # that said, it's a rare situation (other than rake), and parallel
197
192
  # installation is SO MUCH FASTER. so we let people opt in.
198
193
  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
194
+ standalone = options[:standalone]
195
+ force = options[:force]
196
+ local = options[:local] || options[:"prefer-local"]
197
+ jobs = installation_parallelization
198
+ spec_installations = ParallelInstaller.call(self, @definition.specs, jobs, standalone, force, local: local)
199
+ spec_installations.each do |installation|
200
+ post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
207
201
  end
202
+ end
208
203
 
204
+ def installation_parallelization
209
205
  if jobs = Bundler.settings[:jobs]
210
206
  return jobs
211
207
  end
@@ -216,13 +212,13 @@ module Bundler
216
212
  def load_plugins
217
213
  Gem.load_plugins
218
214
 
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}")
215
+ requested_path_gems = @definition.specs.select {|s| s.source.is_a?(Source::Path) }
216
+ path_plugin_files = requested_path_gems.flat_map do |spec|
217
+ spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
222
218
  rescue TypeError
223
219
  error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
224
220
  raise Gem::InvalidSpecificationException, error_message
225
- end.flatten
221
+ end
226
222
  Gem.load_plugin_files(path_plugin_files)
227
223
  Gem.load_env_plugins
228
224
  end
@@ -240,28 +236,8 @@ module Bundler
240
236
  end
241
237
  end
242
238
 
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])
239
+ def lock
240
+ @definition.lock
265
241
  end
266
242
  end
267
243
  end
@@ -4,17 +4,30 @@ 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
@@ -26,9 +39,26 @@ module Bundler
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
+
31
47
  @force_ruby_platform = default_force_ruby_platform
48
+ @most_specific_locked_platform = nil
49
+ @materialization = nil
50
+ end
51
+
52
+ def missing?
53
+ @materialization == self
54
+ end
55
+
56
+ def incomplete?
57
+ @materialization.nil?
58
+ end
59
+
60
+ def source_changed?
61
+ @original_source != source
32
62
  end
33
63
 
34
64
  def full_name
@@ -91,47 +121,45 @@ module Bundler
91
121
  out
92
122
  end
93
123
 
124
+ def materialize_for_cache
125
+ source.remote!
126
+
127
+ materialize(self, &:first)
128
+ end
129
+
130
+ def materialized_for_installation
131
+ @materialization = materialize_for_installation
132
+
133
+ self unless incomplete?
134
+ end
135
+
94
136
  def materialize_for_installation
95
137
  source.local!
96
138
 
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
139
+ if use_exact_resolved_specifications?
140
+ materialize(self) do |matching_specs|
141
+ choose_compatible(matching_specs)
142
+ end
102
143
  else
103
- target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform
144
+ materialize([name, version]) do |matching_specs|
145
+ target_platform = source.is_a?(Source::Path) ? platform : local_platform
104
146
 
105
- installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
147
+ installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
106
148
 
107
- specification = __materialize__(installable_candidates, fallback_to_non_installable: false)
108
- return specification unless specification.nil?
149
+ specification = choose_compatible(installable_candidates, fallback_to_non_installable: false)
150
+ return specification unless specification.nil?
109
151
 
110
- if target_platform != platform
111
- installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
112
- end
152
+ if target_platform != platform
153
+ installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
154
+ end
113
155
 
114
- installable_candidates
156
+ choose_compatible(installable_candidates)
157
+ end
115
158
  end
116
-
117
- __materialize__(candidates)
118
159
  end
119
160
 
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
161
+ def inspect
162
+ "#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>"
135
163
  end
136
164
 
137
165
  def to_s
@@ -147,26 +175,69 @@ module Bundler
147
175
  @force_ruby_platform = true
148
176
  end
149
177
 
178
+ def replace_source_with!(gemfile_source)
179
+ return unless gemfile_source.can_lock?(self)
180
+
181
+ @source = gemfile_source
182
+
183
+ true
184
+ end
185
+
150
186
  private
151
187
 
152
188
  def use_exact_resolved_specifications?
153
- @use_exact_resolved_specifications ||= !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
189
+ !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
154
190
  end
155
191
 
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
192
  def ruby_platform_materializes_to_ruby_platform?
167
193
  generic_platform = generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
168
194
 
169
- !Bundler.most_specific_locked_platform?(generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
195
+ (most_specific_locked_platform != generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
196
+ end
197
+
198
+ def materialize(query)
199
+ matching_specs = source.specs.search(query)
200
+ return self if matching_specs.empty?
201
+
202
+ yield matching_specs
203
+ end
204
+
205
+ # If in frozen mode, we fallback to a non-installable candidate because by
206
+ # doing this we avoid re-resolving and potentially end up changing the
207
+ # lockfile, which is not allowed. In that case, we will give a proper error
208
+ # about the mismatch higher up the stack, right before trying to install the
209
+ # bad gem.
210
+ def choose_compatible(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
211
+ search = candidates.reverse.find do |spec|
212
+ spec.is_a?(StubSpecification) || spec.matches_current_metadata?
213
+ end
214
+ if search.nil? && fallback_to_non_installable
215
+ search = candidates.last
216
+ end
217
+
218
+ if search
219
+ validate_dependencies(search) if search.platform == platform
220
+
221
+ search.locked_platform = platform if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification)
222
+ end
223
+ search
224
+ end
225
+
226
+ # Validate dependencies of this locked spec are consistent with dependencies
227
+ # of the actual spec that was materialized.
228
+ #
229
+ # Note that we don't validate dependencies of locally installed gems but
230
+ # accept what's in the lockfile instead for performance, since loading
231
+ # dependencies of locally installed gems would mean evaluating all gemspecs,
232
+ # which would affect `bundler/setup` performance.
233
+ def validate_dependencies(spec)
234
+ if spec.is_a?(StubSpecification)
235
+ spec.dependencies = dependencies
236
+ else
237
+ if !source.is_a?(Source::Path) && spec.runtime_dependencies.sort != dependencies.sort
238
+ raise IncorrectLockfileDependencies.new(self)
239
+ end
240
+ end
170
241
  end
171
242
  end
172
243
  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
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Bundler
4
4
  class LockfileParser
5
+ include GemHelpers
6
+
5
7
  class Position
6
8
  attr_reader :line, :column
7
9
  def initialize(line, column)
@@ -29,6 +31,7 @@ module Bundler
29
31
  :dependencies,
30
32
  :specs,
31
33
  :platforms,
34
+ :most_specific_locked_platform,
32
35
  :bundler_version,
33
36
  :ruby_version,
34
37
  :checksums,
@@ -136,7 +139,12 @@ module Bundler
136
139
  end
137
140
  @pos.advance!(line)
138
141
  end
139
- @specs = @specs.values.sort_by!(&:full_name)
142
+ @most_specific_locked_platform = @platforms.min_by do |bundle_platform|
143
+ platform_specificity_match(bundle_platform, local_platform)
144
+ end
145
+ @specs = @specs.values.sort_by!(&:full_name).each do |spec|
146
+ spec.most_specific_locked_platform = @most_specific_locked_platform
147
+ end
140
148
  rescue ArgumentError => e
141
149
  Bundler.ui.debug(e)
142
150
  raise LockfileError, "Your lockfile is unreadable. Run `rm #{@lockfile_path}` " \
@@ -231,7 +239,6 @@ module Bundler
231
239
  spaces = $1
232
240
  return unless spaces.size == 2
233
241
  checksums = $6
234
- return unless checksums
235
242
  name = $2
236
243
  version = $3
237
244
  platform = $4
@@ -241,10 +248,14 @@ module Bundler
241
248
  full_name = Gem::NameTuple.new(name, version, platform).full_name
242
249
  return unless spec = @specs[full_name]
243
250
 
244
- checksums.split(",") do |lock_checksum|
245
- column = line.index(lock_checksum) + 1
246
- checksum = Checksum.from_lock(lock_checksum, "#{@lockfile_path}:#{@pos.line}:#{column}")
247
- spec.source.checksum_store.register(spec, checksum)
251
+ if checksums
252
+ checksums.split(",") do |lock_checksum|
253
+ column = line.index(lock_checksum) + 1
254
+ checksum = Checksum.from_lock(lock_checksum, "#{@lockfile_path}:#{@pos.line}:#{column}")
255
+ spec.source.checksum_store.register(spec, checksum)
256
+ end
257
+ else
258
+ spec.source.checksum_store.register(spec, nil)
248
259
  end
249
260
  end
250
261
 
@@ -272,7 +283,7 @@ module Bundler
272
283
  end
273
284
 
274
285
  def parse_platform(line)
275
- @platforms << Gem::Platform.new($1) if line =~ /^ (.*)$/
286
+ @platforms << Gem::Platform.new($1.strip) if line =~ /^ (.*)$/
276
287
  end
277
288
 
278
289
  def parse_bundled_with(line)
@@ -1,53 +1,47 @@
1
- .\" generated with nRonn/v0.11.1
2
- .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-ADD" "1" "December 2023" ""
1
+ .\" generated with Ronn-NG/v0.10.1
2
+ .\" http://github.com/apjanke/ronn-ng/tree/0.10.1
3
+ .TH "BUNDLE\-ADD" "1" "March 2025" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
6
6
  .SH "SYNOPSIS"
7
- \fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-path=PATH] [\-\-git=GIT] [\-\-github=GITHUB] [\-\-branch=BRANCH] [\-\-ref=REF] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
7
+ \fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-path=PATH] [\-\-git=GIT|\-\-github=GITHUB] [\-\-branch=BRANCH] [\-\-ref=REF] [\-\-quiet] [\-\-skip\-install] [\-\-strict|\-\-optimistic]
8
8
  .SH "DESCRIPTION"
9
- Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
10
- .P
11
- Example:
12
- .P
13
- bundle add rails
14
- .P
15
- bundle add rails \-\-version "< 3\.0, > 1\.1"
16
- .P
17
- bundle add rails \-\-version "~> 5\.0\.0" \-\-source "https://gems\.example\.com" \-\-group "development"
18
- .P
19
- bundle add rails \-\-skip\-install
20
- .P
21
- bundle add rails \-\-group "development, test"
9
+ Adds the named gem to the [\fBGemfile(5)\fR][Gemfile(5)] and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
22
10
  .SH "OPTIONS"
23
11
  .TP
24
- \fB\-\-version\fR, \fB\-v\fR
12
+ \fB\-\-version=VERSION\fR, \fB\-v=VERSION\fR
25
13
  Specify version requirements(s) for the added gem\.
26
14
  .TP
27
- \fB\-\-group\fR, \fB\-g\fR
15
+ \fB\-\-group=GROUP\fR, \fB\-g=GROUP\fR
28
16
  Specify the group(s) for the added gem\. Multiple groups should be separated by commas\.
29
17
  .TP
30
- \fB\-\-source\fR, \fB\-s\fR
18
+ \fB\-\-source=SOURCE\fR, \fB\-s=SOURCE\fR
31
19
  Specify the source for the added gem\.
32
20
  .TP
33
- \fB\-\-require\fR, \fB\-r\fR
21
+ \fB\-\-require=REQUIRE\fR, \fB\-r=REQUIRE\fR
34
22
  Adds require path to gem\. Provide false, or a path as a string\.
35
23
  .TP
36
- \fB\-\-path\fR
24
+ \fB\-\-path=PATH\fR
37
25
  Specify the file system path for the added gem\.
38
26
  .TP
39
- \fB\-\-git\fR
27
+ \fB\-\-git=GIT\fR
40
28
  Specify the git source for the added gem\.
41
29
  .TP
42
- \fB\-\-github\fR
30
+ \fB\-\-github=GITHUB\fR
43
31
  Specify the github source for the added gem\.
44
32
  .TP
45
- \fB\-\-branch\fR
33
+ \fB\-\-branch=BRANCH\fR
46
34
  Specify the git branch for the added gem\.
47
35
  .TP
48
- \fB\-\-ref\fR
36
+ \fB\-\-ref=REF\fR
49
37
  Specify the git ref for the added gem\.
50
38
  .TP
39
+ \fB\-\-glob=GLOB\fR
40
+ Specify the location of a dependency's \.gemspec, expanded within Ruby (single quotes recommended)\.
41
+ .TP
42
+ \fB\-\-quiet\fR
43
+ Do not print progress information to the standard output\.
44
+ .TP
51
45
  \fB\-\-skip\-install\fR
52
46
  Adds the gem to the Gemfile but does not install it\.
53
47
  .TP
@@ -56,4 +50,27 @@ Adds optimistic declaration of version\.
56
50
  .TP
57
51
  \fB\-\-strict\fR
58
52
  Adds strict declaration of version\.
59
-
53
+ .SH "EXAMPLES"
54
+ .IP "1." 4
55
+ You can add the \fBrails\fR gem to the Gemfile without any version restriction\. The source of the gem will be the global source\.
56
+ .IP
57
+ \fBbundle add rails\fR
58
+ .IP "2." 4
59
+ You can add the \fBrails\fR gem with version greater than 1\.1 (not including 1\.1) and less than 3\.0\.
60
+ .IP
61
+ \fBbundle add rails \-\-version "> 1\.1, < 3\.0"\fR
62
+ .IP "3." 4
63
+ You can use the \fBhttps://gems\.example\.com\fR custom source and assign the gem to a group\.
64
+ .IP
65
+ \fBbundle add rails \-\-version "~> 5\.0\.0" \-\-source "https://gems\.example\.com" \-\-group "development"\fR
66
+ .IP "4." 4
67
+ The following adds the \fBgem\fR entry to the Gemfile without installing the gem\. You can install gems later via \fBbundle install\fR\.
68
+ .IP
69
+ \fBbundle add rails \-\-skip\-install\fR
70
+ .IP "5." 4
71
+ You can assign the gem to more than one group\.
72
+ .IP
73
+ \fBbundle add rails \-\-group "development, test"\fR
74
+ .IP "" 0
75
+ .SH "SEE ALSO"
76
+ Gemfile(5) \fIhttps://bundler\.io/man/gemfile\.5\.html\fR, bundle\-remove(1) \fIbundle\-remove\.1\.html\fR
@@ -1,53 +1,52 @@
1
1
  bundle-add(1) -- Add gem to the Gemfile and run bundle install
2
- ================================================================
2
+ ==============================================================
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--path=PATH] [--git=GIT] [--github=GITHUB] [--branch=BRANCH] [--ref=REF] [--skip-install] [--strict] [--optimistic]
6
+ `bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE]
7
+ [--path=PATH] [--git=GIT|--github=GITHUB] [--branch=BRANCH] [--ref=REF]
8
+ [--quiet] [--skip-install] [--strict|--optimistic]
7
9
 
8
10
  ## DESCRIPTION
9
- Adds the named gem to the Gemfile and run `bundle install`. `bundle install` can be avoided by using the flag `--skip-install`.
10
11
 
11
- Example:
12
-
13
- bundle add rails
14
-
15
- bundle add rails --version "< 3.0, > 1.1"
16
-
17
- bundle add rails --version "~> 5.0.0" --source "https://gems.example.com" --group "development"
18
-
19
- bundle add rails --skip-install
20
-
21
- bundle add rails --group "development, test"
12
+ Adds the named gem to the [`Gemfile(5)`][Gemfile(5)] and run `bundle install`.
13
+ `bundle install` can be avoided by using the flag `--skip-install`.
22
14
 
23
15
  ## OPTIONS
24
- * `--version`, `-v`:
16
+
17
+ * `--version=VERSION`, `-v=VERSION`:
25
18
  Specify version requirements(s) for the added gem.
26
19
 
27
- * `--group`, `-g`:
20
+ * `--group=GROUP`, `-g=GROUP`:
28
21
  Specify the group(s) for the added gem. Multiple groups should be separated by commas.
29
22
 
30
- * `--source`, `-s`:
23
+ * `--source=SOURCE`, `-s=SOURCE`:
31
24
  Specify the source for the added gem.
32
25
 
33
- * `--require`, `-r`:
26
+ * `--require=REQUIRE`, `-r=REQUIRE`:
34
27
  Adds require path to gem. Provide false, or a path as a string.
35
28
 
36
- * `--path`:
29
+ * `--path=PATH`:
37
30
  Specify the file system path for the added gem.
38
31
 
39
- * `--git`:
32
+ * `--git=GIT`:
40
33
  Specify the git source for the added gem.
41
34
 
42
- * `--github`:
35
+ * `--github=GITHUB`:
43
36
  Specify the github source for the added gem.
44
37
 
45
- * `--branch`:
38
+ * `--branch=BRANCH`:
46
39
  Specify the git branch for the added gem.
47
40
 
48
- * `--ref`:
41
+ * `--ref=REF`:
49
42
  Specify the git ref for the added gem.
50
43
 
44
+ * `--glob=GLOB`:
45
+ Specify the location of a dependency's .gemspec, expanded within Ruby (single quotes recommended).
46
+
47
+ * `--quiet`:
48
+ Do not print progress information to the standard output.
49
+
51
50
  * `--skip-install`:
52
51
  Adds the gem to the Gemfile but does not install it.
53
52
 
@@ -56,3 +55,33 @@ bundle add rails --group "development, test"
56
55
 
57
56
  * `--strict`:
58
57
  Adds strict declaration of version.
58
+
59
+ ## EXAMPLES
60
+
61
+ 1. You can add the `rails` gem to the Gemfile without any version restriction.
62
+ The source of the gem will be the global source.
63
+
64
+ `bundle add rails`
65
+
66
+ 2. You can add the `rails` gem with version greater than 1.1 (not including 1.1) and less than 3.0.
67
+
68
+ `bundle add rails --version "> 1.1, < 3.0"`
69
+
70
+ 3. You can use the `https://gems.example.com` custom source and assign the gem
71
+ to a group.
72
+
73
+ `bundle add rails --version "~> 5.0.0" --source "https://gems.example.com" --group "development"`
74
+
75
+ 4. The following adds the `gem` entry to the Gemfile without installing the
76
+ gem. You can install gems later via `bundle install`.
77
+
78
+ `bundle add rails --skip-install`
79
+
80
+ 5. You can assign the gem to more than one group.
81
+
82
+ `bundle add rails --group "development, test"`
83
+
84
+ ## SEE ALSO
85
+
86
+ [Gemfile(5)](https://bundler.io/man/gemfile.5.html),
87
+ [bundle-remove(1)](bundle-remove.1.html)