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
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "bundler/rubygems_ext"
3
4
  require_relative "bundler/vendored_fileutils"
4
5
  require "pathname"
5
6
  require "rbconfig"
@@ -7,10 +8,8 @@ require "rbconfig"
7
8
  require_relative "bundler/errors"
8
9
  require_relative "bundler/environment_preserver"
9
10
  require_relative "bundler/plugin"
10
- require_relative "bundler/rubygems_ext"
11
11
  require_relative "bundler/rubygems_integration"
12
12
  require_relative "bundler/version"
13
- require_relative "bundler/constants"
14
13
  require_relative "bundler/current_ruby"
15
14
  require_relative "bundler/build_metadata"
16
15
 
@@ -40,7 +39,9 @@ module Bundler
40
39
  SUDO_MUTEX = Thread::Mutex.new
41
40
 
42
41
  autoload :Checksum, File.expand_path("bundler/checksum", __dir__)
42
+ autoload :CLI, File.expand_path("bundler/cli", __dir__)
43
43
  autoload :CIDetector, File.expand_path("bundler/ci_detector", __dir__)
44
+ autoload :CompactIndexClient, File.expand_path("bundler/compact_index_client", __dir__)
44
45
  autoload :Definition, File.expand_path("bundler/definition", __dir__)
45
46
  autoload :Dependency, File.expand_path("bundler/dependency", __dir__)
46
47
  autoload :Deprecate, File.expand_path("bundler/deprecate", __dir__)
@@ -50,8 +51,8 @@ module Bundler
50
51
  autoload :Env, File.expand_path("bundler/env", __dir__)
51
52
  autoload :Fetcher, File.expand_path("bundler/fetcher", __dir__)
52
53
  autoload :FeatureFlag, File.expand_path("bundler/feature_flag", __dir__)
54
+ autoload :FREEBSD, File.expand_path("bundler/constants", __dir__)
53
55
  autoload :GemHelper, File.expand_path("bundler/gem_helper", __dir__)
54
- autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
55
56
  autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
56
57
  autoload :Graph, File.expand_path("bundler/graph", __dir__)
57
58
  autoload :Index, File.expand_path("bundler/index", __dir__)
@@ -60,6 +61,8 @@ module Bundler
60
61
  autoload :LazySpecification, File.expand_path("bundler/lazy_specification", __dir__)
61
62
  autoload :LockfileParser, File.expand_path("bundler/lockfile_parser", __dir__)
62
63
  autoload :MatchRemoteMetadata, File.expand_path("bundler/match_remote_metadata", __dir__)
64
+ autoload :Materialization, File.expand_path("bundler/materialization", __dir__)
65
+ autoload :NULL, File.expand_path("bundler/constants", __dir__)
63
66
  autoload :ProcessLock, File.expand_path("bundler/process_lock", __dir__)
64
67
  autoload :RemoteSpecification, File.expand_path("bundler/remote_specification", __dir__)
65
68
  autoload :Resolver, File.expand_path("bundler/resolver", __dir__)
@@ -78,6 +81,7 @@ module Bundler
78
81
  autoload :UI, File.expand_path("bundler/ui", __dir__)
79
82
  autoload :URICredentialsFilter, File.expand_path("bundler/uri_credentials_filter", __dir__)
80
83
  autoload :URINormalizer, File.expand_path("bundler/uri_normalizer", __dir__)
84
+ autoload :WINDOWS, File.expand_path("bundler/constants", __dir__)
81
85
  autoload :SafeMarshal, File.expand_path("bundler/safe_marshal", __dir__)
82
86
 
83
87
  class << self
@@ -109,13 +113,13 @@ module Bundler
109
113
  end
110
114
 
111
115
  def configured_bundle_path
112
- @configured_bundle_path ||= settings.path.tap(&:validate!)
116
+ @configured_bundle_path ||= Bundler.settings.path.tap(&:validate!)
113
117
  end
114
118
 
115
119
  # Returns absolute location of where binstubs are installed to.
116
120
  def bin_path
117
121
  @bin_path ||= begin
118
- path = settings[:bin] || "bin"
122
+ path = Bundler.settings[:bin] || "bin"
119
123
  path = Pathname.new(path).expand_path(root).expand_path
120
124
  mkdir_p(path)
121
125
  path
@@ -165,6 +169,29 @@ module Bundler
165
169
  end
166
170
  end
167
171
 
172
+ def auto_switch
173
+ self_manager.restart_with_locked_bundler_if_needed
174
+ end
175
+
176
+ # Automatically install dependencies if settings[:auto_install] exists.
177
+ # This is set through config cmd `bundle config set --global auto_install 1`.
178
+ #
179
+ # Note that this method `nil`s out the global Definition object, so it
180
+ # should be called first, before you instantiate anything like an
181
+ # `Installer` that'll keep a reference to the old one instead.
182
+ def auto_install
183
+ return unless Bundler.settings[:auto_install]
184
+
185
+ begin
186
+ definition.specs
187
+ rescue GemNotFound, GitError
188
+ ui.info "Automatically installing missing gems."
189
+ reset!
190
+ CLI::Install.new({}).run
191
+ reset!
192
+ end
193
+ end
194
+
168
195
  # Setups Bundler environment (see Bundler.setup) if it is not already set,
169
196
  # and loads all gems from groups specified. Unlike ::setup, can be called
170
197
  # multiple times with different groups (if they were allowed by setup).
@@ -200,20 +227,21 @@ module Bundler
200
227
  #
201
228
  # @param unlock [Hash, Boolean, nil] Gems that have been requested
202
229
  # to be updated or true if all gems should be updated
230
+ # @param lockfile [Pathname] Path to Gemfile.lock
203
231
  # @return [Bundler::Definition]
204
- def definition(unlock = nil)
232
+ def definition(unlock = nil, lockfile = default_lockfile)
205
233
  @definition = nil if unlock
206
234
  @definition ||= begin
207
235
  configure
208
- Definition.build(default_gemfile, default_lockfile, unlock)
236
+ Definition.build(default_gemfile, lockfile, unlock)
209
237
  end
210
238
  end
211
239
 
212
240
  def frozen_bundle?
213
- frozen = settings[:frozen]
241
+ frozen = Bundler.settings[:frozen]
214
242
  return frozen unless frozen.nil?
215
243
 
216
- settings[:deployment]
244
+ Bundler.settings[:deployment]
217
245
  end
218
246
 
219
247
  def locked_gems
@@ -226,12 +254,6 @@ module Bundler
226
254
  end
227
255
  end
228
256
 
229
- def most_specific_locked_platform?(platform)
230
- return false unless defined?(@definition) && @definition
231
-
232
- definition.most_specific_locked_platform == platform
233
- end
234
-
235
257
  def ruby_scope
236
258
  "#{Bundler.rubygems.ruby_engine}/#{RbConfig::CONFIG["ruby_version"]}"
237
259
  end
@@ -320,7 +342,7 @@ module Bundler
320
342
 
321
343
  def app_cache(custom_path = nil)
322
344
  path = custom_path || root
323
- Pathname.new(path).join(settings.app_cache_path)
345
+ Pathname.new(path).join(Bundler.settings.app_cache_path)
324
346
  end
325
347
 
326
348
  def tmp(name = Process.pid.to_s)
@@ -335,7 +357,7 @@ module Bundler
335
357
  def settings
336
358
  @settings ||= Settings.new(app_config_path)
337
359
  rescue GemfileNotFound
338
- @settings = Settings.new(Pathname.new(".bundle").expand_path)
360
+ @settings = Settings.new
339
361
  end
340
362
 
341
363
  # @return [Hash] Environment present before Bundler was activated
@@ -357,28 +379,12 @@ module Bundler
357
379
 
358
380
  # @return [Hash] Environment with all bundler-related variables removed
359
381
  def unbundled_env
360
- env = original_env
361
-
362
- if env.key?("BUNDLER_ORIG_MANPATH")
363
- env["MANPATH"] = env["BUNDLER_ORIG_MANPATH"]
364
- end
365
-
366
- env.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
367
-
368
- if env.key?("RUBYOPT")
369
- rubyopt = env["RUBYOPT"].split(" ")
370
- rubyopt.delete("-r#{File.expand_path("bundler/setup", __dir__)}")
371
- rubyopt.delete("-rbundler/setup")
372
- env["RUBYOPT"] = rubyopt.join(" ")
373
- end
374
-
375
- if env.key?("RUBYLIB")
376
- rubylib = env["RUBYLIB"].split(File::PATH_SEPARATOR)
377
- rubylib.delete(__dir__)
378
- env["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
379
- end
382
+ unbundle_env(original_env)
383
+ end
380
384
 
381
- env
385
+ # Remove all bundler-related variables from ENV
386
+ def unbundle_env!
387
+ ENV.replace(unbundle_env(ENV))
382
388
  end
383
389
 
384
390
  # Run block with environment present before Bundler was activated
@@ -448,10 +454,14 @@ module Bundler
448
454
  end
449
455
 
450
456
  def local_platform
451
- return Gem::Platform::RUBY if settings[:force_ruby_platform]
457
+ return Gem::Platform::RUBY if Bundler.settings[:force_ruby_platform]
452
458
  Gem::Platform.local
453
459
  end
454
460
 
461
+ def generic_local_platform
462
+ Gem::Platform.generic(local_platform)
463
+ end
464
+
455
465
  def default_gemfile
456
466
  SharedHelpers.default_gemfile
457
467
  end
@@ -482,24 +492,33 @@ module Bundler
482
492
  end
483
493
 
484
494
  def mkdir_p(path)
485
- SharedHelpers.filesystem_access(path, :write) do |p|
495
+ SharedHelpers.filesystem_access(path, :create) do |p|
486
496
  FileUtils.mkdir_p(p)
487
497
  end
488
498
  end
489
499
 
490
500
  def which(executable)
491
- if File.file?(executable) && File.executable?(executable)
492
- executable
493
- elsif paths = ENV["PATH"]
501
+ executable_path = find_executable(executable)
502
+ return executable_path if executable_path
503
+
504
+ if (paths = ENV["PATH"])
494
505
  quote = '"'
495
506
  paths.split(File::PATH_SEPARATOR).find do |path|
496
507
  path = path[1..-2] if path.start_with?(quote) && path.end_with?(quote)
497
- executable_path = File.expand_path(executable, path)
498
- return executable_path if File.file?(executable_path) && File.executable?(executable_path)
508
+ executable_path = find_executable(File.expand_path(executable, path))
509
+ return executable_path if executable_path
499
510
  end
500
511
  end
501
512
  end
502
513
 
514
+ def find_executable(path)
515
+ extensions = RbConfig::CONFIG["EXECUTABLE_EXTS"]&.split
516
+ extensions = [RbConfig::CONFIG["EXEEXT"]] unless extensions&.any?
517
+ candidates = extensions.map {|ext| "#{path}#{ext}" }
518
+
519
+ candidates.find {|candidate| File.file?(candidate) && File.executable?(candidate) }
520
+ end
521
+
503
522
  def read_file(file)
504
523
  SharedHelpers.filesystem_access(file, :read) do
505
524
  File.open(file, "r:UTF-8", &:read)
@@ -531,15 +550,7 @@ module Bundler
531
550
  def load_gemspec_uncached(file, validate = false)
532
551
  path = Pathname.new(file)
533
552
  contents = read_file(file)
534
- spec = if contents.start_with?("---") # YAML header
535
- eval_yaml_gemspec(path, contents)
536
- else
537
- # Eval the gemspec from its parent directory, because some gemspecs
538
- # depend on "./" relative paths.
539
- SharedHelpers.chdir(path.dirname.to_s) do
540
- eval_gemspec(path, contents)
541
- end
542
- end
553
+ spec = eval_gemspec(path, contents)
543
554
  return unless spec
544
555
  spec.loaded_from = path.expand_path.to_s
545
556
  Bundler.rubygems.validate(spec) if validate
@@ -552,11 +563,11 @@ module Bundler
552
563
 
553
564
  def git_present?
554
565
  return @git_present if defined?(@git_present)
555
- @git_present = Bundler.which("git#{RbConfig::CONFIG["EXEEXT"]}")
566
+ @git_present = Bundler.which("git")
556
567
  end
557
568
 
558
569
  def feature_flag
559
- @feature_flag ||= FeatureFlag.new(VERSION)
570
+ @feature_flag ||= FeatureFlag.new(Bundler.settings[:simulate_version] || VERSION)
560
571
  end
561
572
 
562
573
  def reset!
@@ -572,7 +583,6 @@ module Bundler
572
583
 
573
584
  def reset_paths!
574
585
  @bin_path = nil
575
- @bundler_major_version = nil
576
586
  @bundle_path = nil
577
587
  @configure = nil
578
588
  @configured_bundle_path = nil
@@ -607,6 +617,30 @@ module Bundler
607
617
 
608
618
  private
609
619
 
620
+ def unbundle_env(env)
621
+ if env.key?("BUNDLER_ORIG_MANPATH")
622
+ env["MANPATH"] = env["BUNDLER_ORIG_MANPATH"]
623
+ end
624
+
625
+ env.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
626
+ env.delete("BUNDLER_SETUP")
627
+
628
+ if env.key?("RUBYOPT")
629
+ rubyopt = env["RUBYOPT"].split(" ")
630
+ rubyopt.delete("-r#{File.expand_path("bundler/setup", __dir__)}")
631
+ rubyopt.delete("-rbundler/setup")
632
+ env["RUBYOPT"] = rubyopt.join(" ")
633
+ end
634
+
635
+ if env.key?("RUBYLIB")
636
+ rubylib = env["RUBYLIB"].split(File::PATH_SEPARATOR)
637
+ rubylib.delete(__dir__)
638
+ env["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
639
+ end
640
+
641
+ env
642
+ end
643
+
610
644
  def load_marshal(data, marshal_proc: nil)
611
645
  Marshal.load(data, marshal_proc)
612
646
  rescue TypeError => e
@@ -617,16 +651,22 @@ module Bundler
617
651
  Kernel.require "psych"
618
652
 
619
653
  Gem::Specification.from_yaml(contents)
620
- rescue ::Psych::SyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
621
- eval_gemspec(path, contents)
622
654
  end
623
655
 
624
656
  def eval_gemspec(path, contents)
625
- eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
657
+ if contents.start_with?("---") # YAML header
658
+ eval_yaml_gemspec(path, contents)
659
+ else
660
+ # Eval the gemspec from its parent directory, because some gemspecs
661
+ # depend on "./" relative paths.
662
+ SharedHelpers.chdir(path.dirname.to_s) do
663
+ eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
664
+ end
665
+ end
626
666
  rescue ScriptError, StandardError => e
627
667
  msg = "There was an error while loading `#{path.basename}`: #{e.message}"
628
668
 
629
- raise GemspecError, Dsl::DSLError.new(msg, path, e.backtrace, contents)
669
+ raise GemspecError, Dsl::DSLError.new(msg, path.to_s, e.backtrace, contents)
630
670
  end
631
671
 
632
672
  def configure_gem_path
@@ -1,150 +1,86 @@
1
1
  # Upgrading
2
2
 
3
- ## Bundler 3
3
+ ## Bundler 4
4
+
5
+ In order to prepare for Bundler 4, you can easily configure Bundler 2.7 to
6
+ behave exactly like Bundler 4 will behave. To do so, set the environment
7
+ variable `BUNDLE_SIMULATE_VERSION` to `4`. Alternatively, you can use `bundle
8
+ config` and enable "Bundler 4 mode" either globally through `bundle config set
9
+ --global simulate_version 4`, or locally through `bundle config set --local
10
+ simulate_version 4`. From now on in this document we will assume that all three
11
+ of these configuration options are available, but will only mention `bundle
12
+ config set <option> <value>`.
4
13
 
5
14
  The following is a summary of the changes that we plan to introduce in Bundler
6
- 3, why we will be making those changes, and what the deprecation process will
7
- look like. All these deprecations are printed by default in the Bundler 2.1 release.
8
-
9
- If you don't want to deal with deprecations right now and want to toggle them
10
- off, you can do it through configuration. Set the `BUNDLE_SILENCE_DEPRECATIONS`
11
- environment variable to "true", or configure it through `bundle config` either
12
- globally through `bundle config set --global silence_deprecations true` command, or
13
- locally through `bundle config set --local silence_deprecations true`. From now
14
- on in this document we will assume that all three of these configuration options
15
- are available, but will only mention `bundle config set <option> <value>`.
16
-
17
- As a general note, these changes are intended to improve the experience using
18
- bundler for _new_ users, who have no existing usage routines nor possibly biased
19
- opinions about how the tool should work based on how it has historically worked.
20
- We do understand that changing behaviour that have been existing for years can
21
- be annoying for old users, that's why we intend to make this process as smooth
22
- as possible for everyone.
23
-
24
- I'll be dividing the deprecations into four groups: CLI deprecations, Helper
25
- deprecations, DSL deprecations, and misc deprecations. Let's dive into each of
26
- them.
27
-
28
- ### CLI deprecations
29
-
30
- The CLI defines a set of commands and options that can be used by our users to
31
- create command lines that bundler can understand. There's a number of changes
32
- in the upcoming 3 version.
33
-
34
- * Flags passed to `bundle install` that relied on being remembered across invocations have been deprecated.
35
-
36
- In particular, the `--clean`, `--deployment`, `--frozen`,
37
- `--no-prune`, `--path`, `--shebang`, `--system`, `--without`, and `--with`
38
- options to `bundle install`.
39
-
40
- Remembering CLI options has been a source of historical confusion and bug
41
- reports, not only for beginners but also for experienced users. A CLI tool
42
- should not behave differently across exactly the same invocations _unless_
43
- explicitly configured to do so. This is what configuration is about after all,
44
- and things should never be silently configured without the user knowing about
45
- it.
46
-
47
- The problem with changing this behavior is that very common workflows are
48
- relying on it. For example, when you run `bundle install --without
49
- development:test` in production, those flags are persisted in the app's
50
- configuration file and further `bundle` invocations will happily ignore
51
- development and test gems. This magic will disappear from bundler 3, and
52
- you will explicitly need to configure it, either through environment
53
- variables, application configuration, or machine configuration. For example,
54
- with `bundle config set --local without development test`.
55
-
56
- The removal of this kind of flag also applies to analogous commands, for
57
- example, to `bundle check --path`.
58
-
59
- * The `--force` flag to `bundle install` and `bundle update` has been renamed to `--redownload`.
60
-
61
- This is just a simple rename of the flag, to make more apparent what it
62
- actually does. This flag forces redownloading every gem, it doesn't "force"
63
- anything else.
15
+ 4, and why we will be making those changes. Some of them should be well known
16
+ already by existing users, because we have been printing deprecation messages
17
+ for years, but some of them are defaults that will be switched in Bundler 4 and
18
+ needs some heads up.
64
19
 
65
- * `bundle viz` will be removed and extracted to a plugin.
20
+ ### Running just `bundle` will print help usage
66
21
 
67
- This is the only bundler command requiring external dependencies, both an OS
68
- dependency (the `graphviz` package) and a gem dependency (the `ruby-graphviz`
69
- gem). Removing these dependencies will make development easier and it was also
70
- seen by the bundler team as an opportunity to develop a bundler plugin that
71
- it's officially maintained by the bundler team, and that users can take as a
72
- reference to develop their own plugins. The plugin will contain the same code
73
- as the old core command, the only difference being that the command is now
74
- implemented as `bundle graph` which is much easier to understand. However, the
75
- details of the plugin are under discussion. See [#3333](https://github.com/rubygems/rubygems/issues/3333).
22
+ We're changing this default to make Bundler more friendly for new users. We do
23
+ understand that long time users already know how Bundler works and find useful
24
+ that just `bundle` defaults to `bundle install`. Those users can keep the
25
+ existing default by configuring
76
26
 
77
- * The `bundle console` will be removed and replaced with `bin/console`.
27
+ ```
28
+ bundle config default_cli_command install
29
+ ```
78
30
 
79
- Over time we found `bundle console` hard to maintain because every user would
80
- want to add her own specific tweaks to it. In order to ease maintenance and
81
- reduce bikeshedding discussions, we're removing the `bundle console` command
82
- in favor of a `bin/console` script created by `bundle gem` on gem generation
83
- that users can tweak to their needs.
31
+ ### Bundler will install to a `.bundle` folder relative to the Gemfile location by default
84
32
 
33
+ We're making this change to improve isolation. It will install gems to a
34
+ `.bundle` folder relative to the Gemfile location, instead of a global system folder.
85
35
 
86
- * The `bundle install` command will no longer accept a `--binstubs` flag.
36
+ The previous default of installing to system changes can be kept with `bundle
37
+ config path.system true`.
87
38
 
88
- The `--binstubs` option has been removed from `bundle install` and replaced
89
- with the `bundle binstubs` command. The `--binstubs` flag would create
90
- binstubs for all executables present inside the gems in the project. This was
91
- hardly useful since most users will only use a subset of all the binstubs
92
- available to them. Also, it would force the introduction of a bunch of most
93
- likely unused files into source control. Because of this, binstubs now must
94
- be created and checked into version control individually.
39
+ Related to this change, and to alleviate potential bad consequences from it,
40
+ we're also shipping some related changes:
95
41
 
42
+ * To keep disk usage under control, Bundler will cleanup unused gems when
43
+ installing gems per application using the new default. This new behavior can
44
+ be disabled by toggling back installing to system gems as explained before, or
45
+ by configuring `bundle config clean false`.
96
46
 
97
- * The `bundle inject` command is deprecated and replaced with `bundle add`.
47
+ * To avoid duplicate downloads of `.gem` packages and recompilation of
48
+ extensions, Bundler will keep a global cache of gem packages and compiled
49
+ extensions. This new behaviour can be disabled with `bundle config
50
+ global_gem_cache false`, or by toggling back installing to system gems as
51
+ explained before.
98
52
 
99
- We believe the new command fits the user's mental model better and it supports
100
- a wider set of use cases. The interface supported by `bundle inject` works
101
- exactly the same in `bundle add`, so it should be easy to migrate to the new
102
- command.
53
+ ### Flags passed to `bundle install` that relied on being remembered across invocations will be removed
103
54
 
104
- #### Cancelled CLI deprecations
55
+ In particular, the `--clean`, `--deployment`, `--frozen`, `--no-prune`,
56
+ `--path`, `--shebang`, `--system`, `--without`, and `--with` options to `bundle
57
+ install`.
105
58
 
106
- These deprecations have been initially announced before, but the deprecations
107
- were cancelled before the release of Bundler 2.1.0 in [rubygems/bundler#7475](https://github.com/rubygems/bundler/pull/7475).
59
+ Remembering CLI options has been a source of historical confusion and bug
60
+ reports, not only for beginners but also for experienced users. A CLI tool
61
+ should not behave differently across exactly the same invocations _unless_
62
+ explicitly configured to do so. This is what configuration is about after all,
63
+ and things should never be silently configured without the user knowing about
64
+ it.
108
65
 
109
- * ~The `bundle update` command will no longer update all gems, you'll need to pass `--all` to it.~ (postponed)
66
+ The problem with changing this behavior is that very common workflows are
67
+ relying on it. For example, when you run `bundle install --without
68
+ development:test` in production, those flags are persisted in the app's
69
+ configuration file and further `bundle` invocations will happily ignore
70
+ development and test gems. This magic will disappear from bundler 4, and you
71
+ will explicitly need to configure it, either through environment variables,
72
+ application configuration, or machine configuration. For example, with `bundle
73
+ config set --local without development test`.
110
74
 
111
- * ~The `bundle config` command will no longer accept old subcommand-based interface before Bundler 2.1.~ (postponed)
75
+ ### Bundler will include checksums in the lockfile by default
112
76
 
113
- ### Helper deprecations
77
+ We shipped this security feature recently and we believe it's time to turn it on
78
+ by default, so that everyone benefits from the extra security assurances by default.
114
79
 
115
- * `Bundler.clean_env`, `Bundler.with_clean_env`, `Bundler.clean_system`, and `Bundler.clean_exec` are deprecated.
80
+ ### Strict source pinning in Gemfile is enforced by default
116
81
 
117
- All of these helpers ultimately use `Bundler.clean_env` under the hood, which
118
- makes sure all bundler-related environment are removed inside the block it
119
- yields.
120
-
121
- After quite a lot user reports, we noticed that users don't usually want this
122
- but instead want the bundler environment as it was before the current process
123
- was started. Thus, `Bundler.with_original_env`, `Bundler.original_system`, and
124
- `Bundler.original_exec` were born. They all use the new `Bundler.original_env`
125
- under the hood.
126
-
127
- There's however some specific cases where the good old `Bundler.clean_env`
128
- behavior can be useful. For example, when testing Rails generators, you really
129
- want an environment where `bundler` is out of the picture. This is why we
130
- decided to keep the old behavior under a new more clear name, because we
131
- figured the word "clean" was too ambiguous. So we have introduced
132
- `Bundler.unbundled_env`, `Bundler.with_unbundled_env`,
133
- `Bundler.unbundled_system`, and `Bundler.unbundled_exec`.
134
-
135
- * `Bundler.environment` is deprecated in favor of `Bundler.load`.
136
-
137
- We're not sure how people might be using this directly but we have removed the
138
- `Bundler::Environment` class which was instantiated by `Bundler.environment`
139
- since we realized the `Bundler::Runtime` class was the same thing. During the
140
- transition `Bundler.environment` will delegate to `Bundler.load`, which holds
141
- the reference to the `Bundler::Environment`.
142
-
143
- #### DSL deprecations
144
-
145
- The following deprecations in bundler's DSL are meant to prepare for the strict
146
- source pinning in bundler 3, where the source for every dependency will be
147
- unambiguously defined.
82
+ In bundler 4, the source for every dependency will be unambiguously defined, and
83
+ Bundler will refuse to run otherwise.
148
84
 
149
85
  * Multiple global Gemfile sources will no longer be supported.
150
86
 
@@ -207,7 +143,76 @@ unambiguously defined.
207
143
  end
208
144
  ```
209
145
 
210
- #### Misc deprecations
146
+ #### Notable CLI changes
147
+
148
+ * `bundle viz` will be removed and extracted to a plugin.
149
+
150
+ This is the only bundler command requiring external dependencies, both an OS
151
+ dependency (the `graphviz` package) and a gem dependency (the `ruby-graphviz`
152
+ gem). Removing these dependencies will make development easier and it was also
153
+ seen by the bundler team as an opportunity to develop a bundler plugin that
154
+ it's officially maintained by the bundler team, and that users can take as a
155
+ reference to develop their own plugins. The plugin will contain the same code
156
+ as the old core command, the only difference being that the command is now
157
+ implemented as `bundle graph` which is much easier to understand. However, the
158
+ details of the plugin are under discussion. See [#3333](https://github.com/rubygems/rubygems/issues/3333).
159
+
160
+ * The `bundle install` command will no longer accept a `--binstubs` flag.
161
+
162
+ The `--binstubs` option has been removed from `bundle install` and replaced
163
+ with the `bundle binstubs` command. The `--binstubs` flag would create
164
+ binstubs for all executables present inside the gems in the project. This was
165
+ hardly useful since most users will only use a subset of all the binstubs
166
+ available to them. Also, it would force the introduction of a bunch of most
167
+ likely unused files into source control. Because of this, binstubs now must
168
+ be created and checked into version control individually.
169
+
170
+ * The `bundle inject` command will be replaced with `bundle add`
171
+
172
+ We believe the new command fits the user's mental model better and it supports
173
+ a wider set of use cases. The interface supported by `bundle inject` works
174
+ exactly the same in `bundle add`, so it should be easy to migrate to the new
175
+ command.
176
+
177
+ ### Other notable changes
178
+
179
+ * Git and Path gems will be included in `vendor/cache` by default
180
+
181
+ We're unsure why these gems were treated specially so we'll start caching them
182
+ normally.
183
+
184
+ * Bundler will use cached local data if available when network issues are found
185
+ during resolution.
186
+
187
+ Just trying to provide a more resilient behavior here.
188
+
189
+ * `Bundler.clean_env`, `Bundler.with_clean_env`, `Bundler.clean_system`, and `Bundler.clean_exec` will be removed
190
+
191
+ All of these helpers ultimately use `Bundler.clean_env` under the hood, which
192
+ makes sure all bundler-related environment are removed inside the block it
193
+ yields.
194
+
195
+ After quite a lot user reports, we noticed that users don't usually want this
196
+ but instead want the bundler environment as it was before the current process
197
+ was started. Thus, `Bundler.with_original_env`, `Bundler.original_system`, and
198
+ `Bundler.original_exec` were born. They all use the new `Bundler.original_env`
199
+ under the hood.
200
+
201
+ There's however some specific cases where the good old `Bundler.clean_env`
202
+ behavior can be useful. For example, when testing Rails generators, you really
203
+ want an environment where `bundler` is out of the picture. This is why we
204
+ decided to keep the old behavior under a new more clear name, because we
205
+ figured the word "clean" was too ambiguous. So we have introduced
206
+ `Bundler.unbundled_env`, `Bundler.with_unbundled_env`,
207
+ `Bundler.unbundled_system`, and `Bundler.unbundled_exec`.
208
+
209
+ * `Bundler.environment` is deprecated in favor of `Bundler.load`.
210
+
211
+ We're not sure how people might be using this directly but we have removed the
212
+ `Bundler::Environment` class which was instantiated by `Bundler.environment`
213
+ since we realized the `Bundler::Runtime` class was the same thing. During the
214
+ transition `Bundler.environment` will delegate to `Bundler.load`, which holds
215
+ the reference to the `Bundler::Environment`.
211
216
 
212
217
  * Deployment helpers for `vlad` and `capistrano` are being removed.
213
218