rubygems-update 3.3.27 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (272) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/CONTRIBUTING.md +24 -1
  4. data/Manifest.txt +30 -27
  5. data/POLICIES.md +10 -8
  6. data/README.md +2 -2
  7. data/bin/gem +1 -4
  8. data/bin/update_rubygems +1 -1
  9. data/bundler/CHANGELOG.md +48 -0
  10. data/bundler/README.md +2 -2
  11. data/bundler/bundler.gemspec +2 -2
  12. data/bundler/exe/bundle +1 -4
  13. data/bundler/lib/bundler/build_metadata.rb +2 -2
  14. data/bundler/lib/bundler/cli/add.rb +1 -1
  15. data/bundler/lib/bundler/cli/check.rb +1 -1
  16. data/bundler/lib/bundler/cli/common.rb +1 -0
  17. data/bundler/lib/bundler/cli/console.rb +2 -2
  18. data/bundler/lib/bundler/cli/doctor.rb +4 -6
  19. data/bundler/lib/bundler/cli/gem.rb +62 -40
  20. data/bundler/lib/bundler/cli/install.rb +2 -3
  21. data/bundler/lib/bundler/cli/lock.rb +8 -5
  22. data/bundler/lib/bundler/cli/outdated.rb +1 -3
  23. data/bundler/lib/bundler/cli/viz.rb +1 -1
  24. data/bundler/lib/bundler/cli.rb +43 -2
  25. data/bundler/lib/bundler/compact_index_client/cache.rb +1 -1
  26. data/bundler/lib/bundler/compact_index_client/updater.rb +40 -39
  27. data/bundler/lib/bundler/constants.rb +1 -1
  28. data/bundler/lib/bundler/definition.rb +61 -31
  29. data/bundler/lib/bundler/dependency.rb +12 -11
  30. data/bundler/lib/bundler/digest.rb +1 -1
  31. data/bundler/lib/bundler/dsl.rb +1 -1
  32. data/bundler/lib/bundler/env.rb +1 -1
  33. data/bundler/lib/bundler/environment_preserver.rb +1 -0
  34. data/bundler/lib/bundler/errors.rb +1 -11
  35. data/bundler/lib/bundler/fetcher/compact_index.rb +9 -11
  36. data/bundler/lib/bundler/fetcher/dependency.rb +1 -1
  37. data/bundler/lib/bundler/fetcher/downloader.rb +2 -5
  38. data/bundler/lib/bundler/fetcher.rb +2 -6
  39. data/bundler/lib/bundler/force_platform.rb +18 -0
  40. data/bundler/lib/bundler/friendly_errors.rb +0 -3
  41. data/bundler/lib/bundler/gem_version_promoter.rb +52 -86
  42. data/bundler/lib/bundler/graph.rb +3 -3
  43. data/bundler/lib/bundler/index.rb +5 -18
  44. data/bundler/lib/bundler/injector.rb +1 -1
  45. data/bundler/lib/bundler/inline.rb +2 -2
  46. data/bundler/lib/bundler/installer/parallel_installer.rb +0 -31
  47. data/bundler/lib/bundler/installer.rb +6 -16
  48. data/bundler/lib/bundler/lazy_specification.rb +37 -33
  49. data/bundler/lib/bundler/lockfile_parser.rb +5 -5
  50. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  51. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  52. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  53. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  54. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  55. data/bundler/lib/bundler/man/bundle-config.1 +1 -1
  56. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  57. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  58. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  59. data/bundler/lib/bundler/man/bundle-gem.1 +27 -37
  60. data/bundler/lib/bundler/man/bundle-gem.1.ronn +5 -5
  61. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  62. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  63. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  64. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  65. data/bundler/lib/bundler/man/bundle-install.1 +1 -30
  66. data/bundler/lib/bundler/man/bundle-install.1.ronn +0 -29
  67. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  68. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  69. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  70. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  71. data/bundler/lib/bundler/man/bundle-platform.1 +2 -2
  72. data/bundler/lib/bundler/man/bundle-platform.1.ronn +1 -1
  73. data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
  74. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  75. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  76. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  77. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  78. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  79. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  80. data/bundler/lib/bundler/man/bundle.1 +1 -1
  81. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  82. data/bundler/lib/bundler/mirror.rb +5 -7
  83. data/bundler/lib/bundler/plugin/index.rb +4 -4
  84. data/bundler/lib/bundler/plugin/installer/rubygems.rb +0 -4
  85. data/bundler/lib/bundler/resolver/base.rb +7 -11
  86. data/bundler/lib/bundler/resolver/candidate.rb +92 -0
  87. data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
  88. data/bundler/lib/bundler/resolver/package.rb +63 -0
  89. data/bundler/lib/bundler/resolver/root.rb +25 -0
  90. data/bundler/lib/bundler/resolver/spec_group.rb +26 -36
  91. data/bundler/lib/bundler/resolver.rb +285 -277
  92. data/bundler/lib/bundler/rubygems_ext.rb +11 -6
  93. data/bundler/lib/bundler/rubygems_gem_installer.rb +4 -2
  94. data/bundler/lib/bundler/rubygems_integration.rb +1 -9
  95. data/bundler/lib/bundler/runtime.rb +1 -5
  96. data/bundler/lib/bundler/settings.rb +0 -6
  97. data/bundler/lib/bundler/shared_helpers.rb +1 -0
  98. data/bundler/lib/bundler/source/git/git_proxy.rb +190 -67
  99. data/bundler/lib/bundler/source/git.rb +15 -17
  100. data/bundler/lib/bundler/source/metadata.rb +0 -1
  101. data/bundler/lib/bundler/source/path/installer.rb +1 -22
  102. data/bundler/lib/bundler/source/path.rb +5 -5
  103. data/bundler/lib/bundler/source/rubygems.rb +13 -67
  104. data/bundler/lib/bundler/source_list.rb +8 -2
  105. data/bundler/lib/bundler/spec_set.rb +7 -9
  106. data/bundler/lib/bundler/templates/Executable +1 -1
  107. data/bundler/lib/bundler/templates/Executable.bundler +4 -9
  108. data/bundler/lib/bundler/templates/Executable.standalone +2 -0
  109. data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  110. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +3 -0
  111. data/bundler/lib/bundler/templates/newgem/README.md.tt +6 -4
  112. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +2 -1
  113. data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  114. data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  115. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  116. data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  117. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +10 -0
  118. data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
  119. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +8 -0
  120. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
  121. data/bundler/lib/bundler/ui/shell.rb +35 -12
  122. data/bundler/lib/bundler/ui/silent.rb +21 -5
  123. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +3 -3
  124. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -1
  125. data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -1
  126. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
  127. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  128. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
  129. data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  130. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  131. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  132. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  133. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +151 -0
  134. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  135. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  136. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  137. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  138. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +53 -0
  139. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  140. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  141. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +124 -0
  142. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +409 -0
  143. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +240 -0
  144. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  145. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  146. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +1 -1
  147. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +64 -16
  148. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
  149. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -1
  150. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +27 -7
  151. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +40 -2
  152. data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +2 -1
  153. data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  154. data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  155. data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -2
  156. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +13 -7
  157. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +10 -5
  158. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  159. data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +1 -2
  160. data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +2 -1
  161. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +3 -2
  162. data/bundler/lib/bundler/vendored_persistent.rb +1 -33
  163. data/bundler/lib/bundler/{vendored_tmpdir.rb → vendored_pub_grub.rb} +1 -1
  164. data/bundler/lib/bundler/version.rb +5 -1
  165. data/bundler/lib/bundler/worker.rb +5 -7
  166. data/bundler/lib/bundler.rb +20 -64
  167. data/lib/rubygems/command_manager.rb +2 -2
  168. data/lib/rubygems/commands/fetch_command.rb +1 -1
  169. data/lib/rubygems/commands/install_command.rb +7 -3
  170. data/lib/rubygems/commands/rdoc_command.rb +3 -2
  171. data/lib/rubygems/commands/setup_command.rb +2 -2
  172. data/lib/rubygems/commands/unpack_command.rb +1 -1
  173. data/lib/rubygems/commands/update_command.rb +1 -7
  174. data/lib/rubygems/config_file.rb +33 -0
  175. data/lib/rubygems/core_ext/kernel_warn.rb +1 -2
  176. data/lib/rubygems/defaults.rb +15 -1
  177. data/lib/rubygems/dependency.rb +4 -1
  178. data/lib/rubygems/dependency_installer.rb +24 -24
  179. data/lib/rubygems/exceptions.rb +1 -3
  180. data/lib/rubygems/ext/builder.rb +3 -3
  181. data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +9 -5
  182. data/lib/rubygems/ext/cargo_builder.rb +15 -20
  183. data/lib/rubygems/ext/ext_conf_builder.rb +2 -0
  184. data/lib/rubygems/indexer.rb +1 -1
  185. data/lib/rubygems/installer.rb +5 -5
  186. data/lib/rubygems/optparse/lib/optparse.rb +20 -15
  187. data/lib/rubygems/package/tar_header.rb +11 -11
  188. data/lib/rubygems/platform.rb +0 -2
  189. data/lib/rubygems/request_set/gem_dependency_api.rb +104 -104
  190. data/lib/rubygems/requirement.rb +7 -7
  191. data/lib/rubygems/resolver/installer_set.rb +1 -1
  192. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +1 -1
  193. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +32 -26
  194. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  195. data/lib/rubygems/security/policies.rb +40 -40
  196. data/lib/rubygems/security/trust_dir.rb +1 -1
  197. data/lib/rubygems/security.rb +3 -16
  198. data/lib/rubygems/source.rb +2 -2
  199. data/lib/rubygems/specification.rb +37 -49
  200. data/lib/rubygems/specification_policy.rb +14 -0
  201. data/lib/rubygems/stub_specification.rb +2 -2
  202. data/lib/rubygems/text.rb +1 -1
  203. data/lib/rubygems/tsort/lib/tsort.rb +308 -310
  204. data/lib/rubygems/update_suggestion.rb +69 -0
  205. data/lib/rubygems/util.rb +1 -5
  206. data/lib/rubygems/validator.rb +1 -1
  207. data/lib/rubygems.rb +8 -3
  208. data/rubygems-update.gemspec +2 -2
  209. data/test/rubygems/helper.rb +7 -3
  210. data/test/rubygems/test_bundled_ca.rb +1 -1
  211. data/test/rubygems/test_exit.rb +6 -0
  212. data/test/rubygems/test_gem.rb +4 -9
  213. data/test/rubygems/test_gem_bundler_version_finder.rb +2 -1
  214. data/test/rubygems/test_gem_command_manager.rb +1 -1
  215. data/test/rubygems/test_gem_commands_install_command.rb +19 -0
  216. data/test/rubygems/test_gem_commands_setup_command.rb +1 -8
  217. data/test/rubygems/test_gem_commands_update_command.rb +6 -6
  218. data/test/rubygems/test_gem_config_file.rb +1 -1
  219. data/test/rubygems/test_gem_dependency.rb +2 -0
  220. data/test/rubygems/test_gem_ext_builder.rb +3 -3
  221. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +22 -32
  222. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
  223. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +22 -32
  224. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
  225. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +12 -0
  226. data/test/rubygems/test_gem_ext_cargo_builder.rb +22 -28
  227. data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +16 -16
  228. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +0 -10
  229. data/test/rubygems/test_gem_indexer.rb +39 -20
  230. data/test/rubygems/test_gem_installer.rb +68 -2
  231. data/test/rubygems/test_gem_package_tar_header.rb +13 -13
  232. data/test/rubygems/test_gem_platform.rb +59 -60
  233. data/test/rubygems/test_gem_remote_fetcher.rb +4 -4
  234. data/test/rubygems/test_gem_request_set.rb +2 -2
  235. data/test/rubygems/test_gem_requirement.rb +1 -1
  236. data/test/rubygems/test_gem_resolver_api_set.rb +12 -12
  237. data/test/rubygems/test_gem_resolver_api_specification.rb +19 -19
  238. data/test/rubygems/test_gem_resolver_git_specification.rb +1 -1
  239. data/test/rubygems/test_gem_security_policy.rb +10 -10
  240. data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
  241. data/test/rubygems/test_gem_specification.rb +50 -37
  242. data/test/rubygems/test_gem_uninstaller.rb +1 -1
  243. data/test/rubygems/test_gem_update_suggestion.rb +208 -0
  244. data/test/rubygems/test_kernel.rb +10 -8
  245. data/test/rubygems/test_require.rb +70 -55
  246. metadata +34 -31
  247. data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  248. data/bundler/lib/bundler/vendor/molinillo/LICENSE +0 -9
  249. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  250. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
  251. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  252. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  253. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  254. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  255. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  256. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  257. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  258. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  259. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
  260. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
  261. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -149
  262. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  263. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
  264. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  265. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
  266. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  267. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  268. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
  269. data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
  270. data/bundler/lib/bundler/vendored_molinillo.rb +0 -4
  271. data/bundler/lib/bundler/version_ranges.rb +0 -122
  272. /data/bundler/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +0 -0
@@ -145,7 +145,7 @@ module Bundler
145
145
  end
146
146
 
147
147
  if installed?(spec) && !force
148
- print_using_message "Using #{version_message(spec)}"
148
+ print_using_message "Using #{version_message(spec, options[:previous_spec])}"
149
149
  return nil # no post-install message
150
150
  end
151
151
 
@@ -160,27 +160,20 @@ module Bundler
160
160
 
161
161
  return if Bundler.settings[:no_install]
162
162
 
163
- if requires_sudo?
164
- install_path = Bundler.tmp(spec.full_name)
165
- bin_path = install_path.join("bin")
166
- else
167
- install_path = rubygems_dir
168
- bin_path = Bundler.system_bindir
169
- end
170
-
171
- Bundler.mkdir_p bin_path, :no_sudo => true unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5")
163
+ install_path = rubygems_dir
164
+ bin_path = Bundler.system_bindir
172
165
 
173
166
  require_relative "../rubygems_gem_installer"
174
167
 
175
168
  installer = Bundler::RubyGemsGemInstaller.at(
176
169
  path,
177
- :security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
178
- :install_dir => install_path.to_s,
179
- :bin_dir => bin_path.to_s,
170
+ :security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
171
+ :install_dir => install_path.to_s,
172
+ :bin_dir => bin_path.to_s,
180
173
  :ignore_dependencies => true,
181
- :wrappers => true,
182
- :env_shebang => true,
183
- :build_args => options[:build_args],
174
+ :wrappers => true,
175
+ :env_shebang => true,
176
+ :build_args => options[:build_args],
184
177
  :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
185
178
  :bundler_extension_cache_path => extension_cache_path(spec)
186
179
  )
@@ -209,34 +202,7 @@ module Bundler
209
202
  spec.full_gem_path = installed_spec.full_gem_path
210
203
  spec.loaded_from = installed_spec.loaded_from
211
204
 
212
- # SUDO HAX
213
- if requires_sudo?
214
- Bundler.rubygems.repository_subdirectories.each do |name|
215
- src = File.join(install_path, name, "*")
216
- dst = File.join(rubygems_dir, name)
217
- if name == "extensions" && Dir.glob(src).any?
218
- src = File.join(src, "*/*")
219
- ext_src = Dir.glob(src).first
220
- ext_src.gsub!(src[0..-6], "")
221
- dst = File.dirname(File.join(dst, ext_src))
222
- end
223
- SharedHelpers.filesystem_access(dst) do |p|
224
- Bundler.mkdir_p(p)
225
- end
226
- Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
227
- end
228
-
229
- spec.executables.each do |exe|
230
- SharedHelpers.filesystem_access(Bundler.system_bindir) do |p|
231
- Bundler.mkdir_p(p)
232
- end
233
- Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
234
- end
235
- end
236
-
237
205
  spec.post_install_message
238
- ensure
239
- Bundler.rm_rf(install_path) if requires_sudo?
240
206
  end
241
207
 
242
208
  def cache(spec, custom_path = nil)
@@ -372,7 +338,7 @@ module Bundler
372
338
 
373
339
  def normalize_uri(uri)
374
340
  uri = uri.to_s
375
- uri = "#{uri}/" unless uri =~ %r{/$}
341
+ uri = "#{uri}/" unless %r{/$}.match?(uri)
376
342
  require_relative "../vendored_uri"
377
343
  uri = Bundler::URI(uri)
378
344
  raise ArgumentError, "The source must be an absolute URI. For example:\n" \
@@ -415,7 +381,7 @@ module Bundler
415
381
  idx = @allow_local ? installed_specs.dup : Index.new
416
382
 
417
383
  Dir["#{cache_path}/*.gem"].each do |gemfile|
418
- next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
384
+ next if /^bundler\-[\d\.]+?\.gem/.match?(gemfile)
419
385
  s ||= Bundler.rubygems.spec_from_gem(gemfile)
420
386
  s.source = self
421
387
  idx << s
@@ -475,38 +441,18 @@ module Bundler
475
441
  gem_path = package_path(cache_path, spec)
476
442
  return gem_path if File.exist?(gem_path)
477
443
 
478
- if requires_sudo?
479
- download_path = Bundler.tmp(spec.full_name)
480
- download_cache_path = default_cache_path_for(download_path)
481
- else
482
- download_cache_path = cache_path
483
- end
484
-
485
- SharedHelpers.filesystem_access(download_cache_path) do |p|
444
+ SharedHelpers.filesystem_access(cache_path) do |p|
486
445
  FileUtils.mkdir_p(p)
487
446
  end
488
- download_gem(spec, download_cache_path, previous_spec)
489
-
490
- if requires_sudo?
491
- SharedHelpers.filesystem_access(cache_path) do |p|
492
- Bundler.mkdir_p(p)
493
- end
494
- Bundler.sudo "mv #{package_path(download_cache_path, spec)} #{gem_path}"
495
- end
447
+ download_gem(spec, cache_path, previous_spec)
496
448
 
497
449
  gem_path
498
- ensure
499
- Bundler.rm_rf(download_path) if requires_sudo?
500
450
  end
501
451
 
502
452
  def installed?(spec)
503
453
  installed_specs[spec].any? && !spec.deleted_gem?
504
454
  end
505
455
 
506
- def requires_sudo?
507
- Bundler.requires_sudo?
508
- end
509
-
510
456
  def rubygems_dir
511
457
  Bundler.bundle_path
512
458
  end
@@ -161,11 +161,17 @@ module Bundler
161
161
  end
162
162
 
163
163
  def map_sources(replacement_sources)
164
- [@rubygems_sources, @path_sources, @git_sources, @plugin_sources].map do |sources|
164
+ rubygems, git, plugin = [@rubygems_sources, @git_sources, @plugin_sources].map do |sources|
165
165
  sources.map do |source|
166
166
  replacement_sources.find {|s| s == source } || source
167
167
  end
168
168
  end
169
+
170
+ path = @path_sources.map do |source|
171
+ replacement_sources.find {|s| s == (source.is_a?(Source::Gemspec) ? source.as_path_source : source) } || source
172
+ end
173
+
174
+ [rubygems, path, git, plugin]
169
175
  end
170
176
 
171
177
  def global_replacement_source(replacement_sources)
@@ -206,7 +212,7 @@ module Bundler
206
212
  def warn_on_git_protocol(source)
207
213
  return if Bundler.settings["git.allow_insecure"]
208
214
 
209
- if source.uri =~ /^git\:/
215
+ if /^git\:/.match?(source.uri)
210
216
  Bundler.ui.warn "The git source `#{source.uri}` uses the `git` protocol, " \
211
217
  "which transmits data without encryption. Disable this warning with " \
212
218
  "`bundle config set --local git.allow_insecure true`, or switch to the `https` " \
@@ -122,8 +122,8 @@ module Bundler
122
122
  @specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
123
123
  end
124
124
 
125
- def delete_by_name_and_version(name, version)
126
- @specs.reject! {|spec| spec.name == name && spec.version == version }
125
+ def delete_by_name(name)
126
+ @specs.reject! {|spec| spec.name == name }
127
127
  @lookup = nil
128
128
  @sorted = nil
129
129
  end
@@ -165,7 +165,7 @@ module Bundler
165
165
  cgems = extract_circular_gems(error)
166
166
  raise CyclicDependencyError, "Your bundle requires gems that depend" \
167
167
  " on each other, creating an infinite loop. Please remove either" \
168
- " gem '#{cgems[1]}' or gem '#{cgems[0]}' and try again."
168
+ " gem '#{cgems[0]}' or gem '#{cgems[1]}' and try again."
169
169
  end
170
170
  end
171
171
 
@@ -190,12 +190,10 @@ module Bundler
190
190
 
191
191
  def specs_for_dependency(dep, platform)
192
192
  specs_for_name = lookup[dep.name]
193
- if platform.nil?
194
- matching_specs = specs_for_name.map {|s| s.materialize_for_installation if Gem::Platform.match_spec?(s) }.compact
195
- GemHelpers.sort_best_platform_match(matching_specs, Bundler.local_platform)
196
- else
197
- GemHelpers.select_best_platform_match(specs_for_name, dep.force_ruby_platform ? Gem::Platform::RUBY : platform)
198
- end
193
+ target_platform = dep.force_ruby_platform ? Gem::Platform::RUBY : (platform || Bundler.local_platform)
194
+ matching_specs = GemHelpers.select_best_platform_match(specs_for_name, target_platform)
195
+ matching_specs.map!(&:materialize_for_installation).compact! if platform.nil?
196
+ matching_specs
199
197
  end
200
198
 
201
199
  def tsort_each_child(s)
@@ -13,7 +13,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("<%= relative_gemfile_path %>", __dir
13
13
  bundle_binstub = File.expand_path("bundle", __dir__)
14
14
 
15
15
  if File.file?(bundle_binstub)
16
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
16
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17
17
  load(bundle_binstub)
18
18
  else
19
19
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
@@ -62,8 +62,9 @@ m = Module.new do
62
62
 
63
63
  def bundler_requirement
64
64
  @bundler_requirement ||=
65
- env_var_version || cli_arg_version ||
66
- bundler_requirement_for(lockfile_version)
65
+ env_var_version ||
66
+ cli_arg_version ||
67
+ bundler_requirement_for(lockfile_version)
67
68
  end
68
69
 
69
70
  def bundler_requirement_for(version)
@@ -71,13 +72,7 @@ m = Module.new do
71
72
 
72
73
  bundler_gem_version = Gem::Version.new(version)
73
74
 
74
- requirement = bundler_gem_version.approximate_recommendation
75
-
76
- return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
77
-
78
- requirement += ".a" if bundler_gem_version.prerelease?
79
-
80
- requirement
75
+ bundler_gem_version.approximate_recommendation
81
76
  end
82
77
 
83
78
  def load_bundler!
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>
2
+ # frozen_string_literal: true
3
+
2
4
  #
3
5
  # This file was generated by Bundler.
4
6
  #
@@ -0,0 +1,7 @@
1
+ # This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
2
+ # a Rust project. Your extensions depedencies should be added to the Cargo.toml
3
+ # in the ext/ directory.
4
+
5
+ [workspace]
6
+ members = ["./ext/<%= config[:name] %>"]
7
+ resolver = "2"
@@ -9,6 +9,9 @@ gem "rake", "~> 13.0"
9
9
  <%- if config[:ext] -%>
10
10
 
11
11
  gem "rake-compiler"
12
+ <%- if config[:ext] == 'rust' -%>
13
+ gem "rb_sys"
14
+ <%- end -%>
12
15
  <%- end -%>
13
16
  <%- if config[:test] -%>
14
17
 
@@ -1,18 +1,20 @@
1
1
  # <%= config[:constant_name] %>
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/<%= config[:namespaced_path] %>`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ TODO: Delete this and the text below, and describe your gem
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/<%= config[:namespaced_path] %>`. To experiment with that code, run `bin/console` for an interactive prompt.
6
6
 
7
7
  ## Installation
8
8
 
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
9
11
  Install the gem and add to the application's Gemfile by executing:
10
12
 
11
- $ bundle add <%= config[:name] %>
13
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
12
14
 
13
15
  If bundler is not being used to manage dependencies, install the gem by executing:
14
16
 
15
- $ gem install <%= config[:name] %>
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
16
18
 
17
19
  ## Usage
18
20
 
@@ -39,7 +39,8 @@ require "standard/rake"
39
39
 
40
40
  <% end -%>
41
41
  <% if config[:ext] -%>
42
- <% default_task_names.unshift(:clobber, :compile) -%>
42
+ <% default_task_names.unshift(:compile) -%>
43
+ <% default_task_names.unshift(:clobber) unless config[:ext] == 'rust' -%>
43
44
  require "rake/extensiontask"
44
45
 
45
46
  task build: :compile
@@ -3,8 +3,20 @@ jobs:
3
3
  build:
4
4
  docker:
5
5
  - image: ruby:<%= RUBY_VERSION %>
6
+ <%- if config[:ext] == 'rust' -%>
7
+ environment:
8
+ RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN: 'true'
9
+ <%- end -%>
6
10
  steps:
7
11
  - checkout
12
+ <%- if config[:ext] == 'rust' -%>
13
+ - run:
14
+ name: Install Rust/Cargo dependencies
15
+ command: apt-get update && apt-get install -y clang
16
+ - run:
17
+ name: Install a RubyGems version that can compile rust extensions
18
+ command: gem update --system '<%= ::Gem.rubygems_version %>'
19
+ <%- end -%>
8
20
  - run:
9
21
  name: Run the default task
10
22
  command: |
@@ -0,0 +1,15 @@
1
+ [package]
2
+ name = <%= config[:name].inspect %>
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ authors = ["<%= config[:author] %> <<%= config[:email] %>>"]
6
+ <%- if config[:mit] -%>
7
+ license = "MIT"
8
+ <%- end -%>
9
+ publish = false
10
+
11
+ [lib]
12
+ crate-type = ["cdylib"]
13
+
14
+ [dependencies]
15
+ magnus = { version = "0.4" }
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "mkmf"
4
+ require "rb_sys/mkmf"
5
+
6
+ create_rust_makefile(<%= config[:makefile_path].inspect %>)
@@ -0,0 +1,12 @@
1
+ use magnus::{define_module, function, prelude::*, Error};
2
+
3
+ fn hello(subject: String) -> String {
4
+ format!("Hello from Rust, {}!", subject)
5
+ }
6
+
7
+ #[magnus::init]
8
+ fn init() -> Result<(), Error> {
9
+ let module = <%= config[:constant_array].map {|c| "define_module(#{c.dump})?"}.join(".") %>;
10
+ module.define_singleton_method("hello", function!(hello, 1))?;
11
+ Ok(())
12
+ }
@@ -18,10 +18,20 @@ jobs:
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v3
21
+ <%- if config[:ext] == 'rust' -%>
22
+ - name: Set up Ruby & Rust
23
+ uses: oxidize-rb/actions/setup-ruby-and-rust@main
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler-cache: true
27
+ cargo-cache: true
28
+ rubygems: '<%= ::Gem.rubygems_version %>'
29
+ <%- else -%>
21
30
  - name: Set up Ruby
22
31
  uses: ruby/setup-ruby@v1
23
32
  with:
24
33
  ruby-version: ${{ matrix.ruby }}
25
34
  bundler-cache: true
35
+ <%- end -%>
26
36
  - name: Run the default task
27
37
  run: bundle exec rake
@@ -12,6 +12,9 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ <%- if config[:ext] == 'rust' -%>
16
+ target/
17
+ <%- end -%>
15
18
  <%- end -%>
16
19
  <%- if config[:test] == "rspec" -%>
17
20
 
@@ -2,9 +2,17 @@ default:
2
2
  image: ruby:<%= RUBY_VERSION %>
3
3
 
4
4
  before_script:
5
+ <%- if config[:ext] == 'rust' -%>
6
+ - apt-get update && apt-get install -y clang
7
+ - gem update --system '<%= ::Gem.rubygems_version %>'
8
+ <%- end -%>
5
9
  - gem install bundler -v <%= Bundler::VERSION %>
6
10
  - bundle install
7
11
 
8
12
  example_job:
13
+ <%- if config[:ext] == 'rust' -%>
14
+ variables:
15
+ RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN: 'true'
16
+ <%- end -%>
9
17
  script:
10
18
  - bundle exec rake
@@ -15,6 +15,9 @@ Gem::Specification.new do |spec|
15
15
  spec.license = "MIT"
16
16
  <%- end -%>
17
17
  spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
18
+ <%- if config[:ext] == 'rust' -%>
19
+ spec.required_rubygems_version = ">= <%= config[:rust_builder_required_rubygems_version] %>"
20
+ <%- end -%>
18
21
 
19
22
  spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
20
23
 
@@ -26,15 +29,18 @@ Gem::Specification.new do |spec|
26
29
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
30
  spec.files = Dir.chdir(__dir__) do
28
31
  `git ls-files -z`.split("\x0").reject do |f|
29
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
32
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
30
33
  end
31
34
  end
32
35
  spec.bindir = "exe"
33
36
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
37
  spec.require_paths = ["lib"]
35
- <%- if config[:ext] -%>
38
+ <%- if config[:ext] == 'c' -%>
36
39
  spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
37
40
  <%- end -%>
41
+ <%- if config[:ext] == 'rust' -%>
42
+ spec.extensions = ["ext/<%= config[:underscored_name] %>/Cargo.toml"]
43
+ <%- end -%>
38
44
 
39
45
  # Uncomment to register a new dependency of your gem
40
46
  # spec.add_dependency "example-gem", "~> 1.0"
@@ -20,29 +20,52 @@ module Bundler
20
20
  @shell.set_color(string, *color)
21
21
  end
22
22
 
23
- def info(msg, newline = nil)
24
- tell_me(msg, nil, newline) if level("info")
23
+ def info(msg = nil, newline = nil)
24
+ return unless info?
25
+
26
+ tell_me(msg || yield, nil, newline)
25
27
  end
26
28
 
27
- def confirm(msg, newline = nil)
28
- tell_me(msg, :green, newline) if level("confirm")
29
+ def confirm(msg = nil, newline = nil)
30
+ return unless confirm?
31
+
32
+ tell_me(msg || yield, :green, newline)
29
33
  end
30
34
 
31
- def warn(msg, newline = nil, color = :yellow)
32
- return unless level("warn")
35
+ def warn(msg = nil, newline = nil, color = :yellow)
36
+ return unless warn?
33
37
  return if @warning_history.include? msg
34
38
  @warning_history << msg
35
39
 
36
- tell_err(msg, color, newline)
40
+ tell_err(msg || yield, color, newline)
41
+ end
42
+
43
+ def error(msg = nil, newline = nil, color = :red)
44
+ return unless error?
45
+
46
+ tell_err(msg || yield, color, newline)
47
+ end
48
+
49
+ def debug(msg = nil, newline = nil)
50
+ return unless debug?
51
+
52
+ tell_me(msg || yield, nil, newline)
53
+ end
54
+
55
+ def info?
56
+ level("info")
57
+ end
58
+
59
+ def confirm?
60
+ level("confirm")
37
61
  end
38
62
 
39
- def error(msg, newline = nil, color = :red)
40
- return unless level("error")
41
- tell_err(msg, color, newline)
63
+ def warn?
64
+ level("warn")
42
65
  end
43
66
 
44
- def debug(msg, newline = nil)
45
- tell_me(msg, nil, newline) if debug?
67
+ def error?
68
+ level("error")
46
69
  end
47
70
 
48
71
  def debug?
@@ -13,30 +13,46 @@ module Bundler
13
13
  string
14
14
  end
15
15
 
16
- def info(message, newline = nil)
16
+ def info(message = nil, newline = nil)
17
17
  end
18
18
 
19
- def confirm(message, newline = nil)
19
+ def confirm(message = nil, newline = nil)
20
20
  end
21
21
 
22
- def warn(message, newline = nil)
22
+ def warn(message = nil, newline = nil)
23
23
  @warnings |= [message]
24
24
  end
25
25
 
26
- def error(message, newline = nil)
26
+ def error(message = nil, newline = nil)
27
27
  end
28
28
 
29
- def debug(message, newline = nil)
29
+ def debug(message = nil, newline = nil)
30
+ end
31
+
32
+ def confirm?
33
+ false
34
+ end
35
+
36
+ def error?
37
+ false
30
38
  end
31
39
 
32
40
  def debug?
33
41
  false
34
42
  end
35
43
 
44
+ def info?
45
+ false
46
+ end
47
+
36
48
  def quiet?
37
49
  false
38
50
  end
39
51
 
52
+ def warn?
53
+ false
54
+ end
55
+
40
56
  def ask(message)
41
57
  end
42
58
 
@@ -49,7 +49,7 @@ class Bundler::ConnectionPool::TimedStack
49
49
  @resource.broadcast
50
50
  end
51
51
  end
52
- alias << push
52
+ alias_method :<<, :push
53
53
 
54
54
  ##
55
55
  # Retrieves a connection from the stack. If a connection is available it is
@@ -74,7 +74,7 @@ class Bundler::ConnectionPool::TimedStack
74
74
  return connection if connection
75
75
 
76
76
  to_wait = deadline - current_time
77
- raise Bundler::ConnectionPool::TimeoutError, "Waited #{timeout} sec" if to_wait <= 0
77
+ raise Bundler::ConnectionPool::TimeoutError, "Waited #{timeout} sec, #{length}/#{@max} available" if to_wait <= 0
78
78
  @resource.wait(@mutex, to_wait)
79
79
  end
80
80
  end
@@ -87,7 +87,7 @@ class Bundler::ConnectionPool::TimedStack
87
87
  # +:reload+ is +true+.
88
88
 
89
89
  def shutdown(reload: false, &block)
90
- raise ArgumentError, "shutdown must receive a block" unless block_given?
90
+ raise ArgumentError, "shutdown must receive a block" unless block
91
91
 
92
92
  @mutex.synchronize do
93
93
  @shutdown_block = block
@@ -30,7 +30,6 @@ class Bundler::ConnectionPool
30
30
  METHODS.include?(id) || with { |c| c.respond_to?(id, *args) }
31
31
  end
32
32
 
33
- # rubocop:disable Style/MethodMissingSuper
34
33
  # rubocop:disable Style/MissingRespondToMissing
35
34
  if ::RUBY_VERSION >= "3.0.0"
36
35
  def method_missing(name, *args, **kwargs, &block)
@@ -3,7 +3,9 @@ require_relative "connection_pool/version"
3
3
 
4
4
  class Bundler::ConnectionPool
5
5
  class Error < ::RuntimeError; end
6
+
6
7
  class PoolShuttingDownError < ::Bundler::ConnectionPool::Error; end
8
+
7
9
  class TimeoutError < ::Timeout::Error; end
8
10
  end
9
11
 
@@ -67,7 +69,7 @@ class Bundler::ConnectionPool
67
69
  end
68
70
  end
69
71
  end
70
- alias then with
72
+ alias_method :then, :with
71
73
 
72
74
  def checkout(options = {})
73
75
  if ::Thread.current[@key]