rubygems-update 3.5.23 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -0
  3. data/Manifest.txt +23 -16
  4. data/README.md +14 -9
  5. data/bundler/CHANGELOG.md +59 -0
  6. data/bundler/bundler.gemspec +2 -2
  7. data/bundler/lib/bundler/build_metadata.rb +2 -2
  8. data/bundler/lib/bundler/cli/console.rb +0 -4
  9. data/bundler/lib/bundler/cli/doctor.rb +4 -4
  10. data/bundler/lib/bundler/cli/exec.rb +1 -0
  11. data/bundler/lib/bundler/cli/gem.rb +1 -1
  12. data/bundler/lib/bundler/cli/info.rb +2 -2
  13. data/bundler/lib/bundler/cli/inject.rb +1 -1
  14. data/bundler/lib/bundler/cli/install.rb +4 -0
  15. data/bundler/lib/bundler/cli/lock.rb +20 -1
  16. data/bundler/lib/bundler/cli/pristine.rb +1 -1
  17. data/bundler/lib/bundler/cli/show.rb +2 -2
  18. data/bundler/lib/bundler/cli.rb +22 -53
  19. data/bundler/lib/bundler/compact_index_client/cache_file.rb +0 -5
  20. data/bundler/lib/bundler/compact_index_client/updater.rb +0 -11
  21. data/bundler/lib/bundler/definition.rb +134 -61
  22. data/bundler/lib/bundler/dependency.rb +1 -1
  23. data/bundler/lib/bundler/dsl.rb +2 -13
  24. data/bundler/lib/bundler/endpoint_specification.rb +10 -1
  25. data/bundler/lib/bundler/errors.rb +10 -0
  26. data/bundler/lib/bundler/feature_flag.rb +1 -0
  27. data/bundler/lib/bundler/fetcher/compact_index.rb +1 -1
  28. data/bundler/lib/bundler/fetcher.rb +10 -3
  29. data/bundler/lib/bundler/gem_helpers.rb +21 -5
  30. data/bundler/lib/bundler/injector.rb +2 -2
  31. data/bundler/lib/bundler/installer/standalone.rb +2 -2
  32. data/bundler/lib/bundler/installer.rb +4 -38
  33. data/bundler/lib/bundler/lazy_specification.rb +65 -24
  34. data/bundler/lib/bundler/lockfile_parser.rb +9 -1
  35. data/bundler/lib/bundler/man/bundle-add.1 +13 -10
  36. data/bundler/lib/bundler/man/bundle-add.1.ronn +12 -9
  37. data/bundler/lib/bundler/man/bundle-binstubs.1 +7 -4
  38. data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
  39. data/bundler/lib/bundler/man/bundle-cache.1 +30 -2
  40. data/bundler/lib/bundler/man/bundle-cache.1.ronn +31 -2
  41. data/bundler/lib/bundler/man/bundle-check.1 +3 -3
  42. data/bundler/lib/bundler/man/bundle-check.1.ronn +4 -2
  43. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  44. data/bundler/lib/bundler/man/bundle-config.1 +3 -1
  45. data/bundler/lib/bundler/man/bundle-config.1.ronn +2 -0
  46. data/bundler/lib/bundler/man/bundle-console.1 +2 -4
  47. data/bundler/lib/bundler/man/bundle-console.1.ronn +2 -7
  48. data/bundler/lib/bundler/man/bundle-doctor.1 +2 -2
  49. data/bundler/lib/bundler/man/bundle-doctor.1.ronn +1 -1
  50. data/bundler/lib/bundler/man/bundle-env.1 +9 -0
  51. data/bundler/lib/bundler/man/bundle-env.1.ronn +10 -0
  52. data/bundler/lib/bundler/man/bundle-exec.1 +5 -2
  53. data/bundler/lib/bundler/man/bundle-exec.1.ronn +4 -1
  54. data/bundler/lib/bundler/man/bundle-fund.1 +22 -0
  55. data/bundler/lib/bundler/man/bundle-fund.1.ronn +25 -0
  56. data/bundler/lib/bundler/man/bundle-gem.1 +17 -5
  57. data/bundler/lib/bundler/man/bundle-gem.1.ronn +27 -6
  58. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  59. data/bundler/lib/bundler/man/bundle-info.1 +5 -2
  60. data/bundler/lib/bundler/man/bundle-info.1.ronn +6 -2
  61. data/bundler/lib/bundler/man/bundle-init.1 +3 -3
  62. data/bundler/lib/bundler/man/bundle-init.1.ronn +3 -2
  63. data/bundler/lib/bundler/man/bundle-inject.1 +10 -2
  64. data/bundler/lib/bundler/man/bundle-inject.1.ronn +9 -1
  65. data/bundler/lib/bundler/man/bundle-install.1 +14 -11
  66. data/bundler/lib/bundler/man/bundle-install.1.ronn +21 -16
  67. data/bundler/lib/bundler/man/bundle-issue.1 +45 -0
  68. data/bundler/lib/bundler/man/bundle-issue.1.ronn +37 -0
  69. data/bundler/lib/bundler/man/bundle-licenses.1 +9 -0
  70. data/bundler/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  71. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  72. data/bundler/lib/bundler/man/bundle-list.1.ronn +4 -1
  73. data/bundler/lib/bundler/man/bundle-lock.1 +21 -6
  74. data/bundler/lib/bundler/man/bundle-lock.1.ronn +25 -4
  75. data/bundler/lib/bundler/man/bundle-open.1 +2 -2
  76. data/bundler/lib/bundler/man/bundle-open.1.ronn +2 -1
  77. data/bundler/lib/bundler/man/bundle-outdated.1 +8 -5
  78. data/bundler/lib/bundler/man/bundle-outdated.1.ronn +8 -4
  79. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  80. data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
  81. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  82. data/bundler/lib/bundler/man/bundle-pristine.1.ronn +1 -1
  83. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  84. data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -1
  85. data/bundler/lib/bundler/man/bundle-show.1 +5 -2
  86. data/bundler/lib/bundler/man/bundle-show.1.ronn +4 -0
  87. data/bundler/lib/bundler/man/bundle-update.1 +13 -7
  88. data/bundler/lib/bundler/man/bundle-update.1.ronn +14 -6
  89. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  90. data/bundler/lib/bundler/man/bundle-viz.1 +4 -4
  91. data/bundler/lib/bundler/man/bundle-viz.1.ronn +7 -3
  92. data/bundler/lib/bundler/man/bundle.1 +1 -1
  93. data/bundler/lib/bundler/man/gemfile.5 +1 -1
  94. data/bundler/lib/bundler/man/index.txt +4 -0
  95. data/bundler/lib/bundler/materialization.rb +59 -0
  96. data/bundler/lib/bundler/plugin/events.rb +24 -0
  97. data/bundler/lib/bundler/plugin/installer.rb +1 -1
  98. data/bundler/lib/bundler/process_lock.rb +1 -1
  99. data/bundler/lib/bundler/remote_specification.rb +6 -1
  100. data/bundler/lib/bundler/resolver/base.rb +2 -6
  101. data/bundler/lib/bundler/resolver/candidate.rb +2 -2
  102. data/bundler/lib/bundler/resolver/spec_group.rb +4 -3
  103. data/bundler/lib/bundler/resolver.rb +5 -5
  104. data/bundler/lib/bundler/rubygems_ext.rb +17 -28
  105. data/bundler/lib/bundler/rubygems_gem_installer.rb +0 -1
  106. data/bundler/lib/bundler/rubygems_integration.rb +21 -11
  107. data/bundler/lib/bundler/runtime.rb +27 -7
  108. data/bundler/lib/bundler/self_manager.rb +2 -3
  109. data/bundler/lib/bundler/settings.rb +1 -0
  110. data/bundler/lib/bundler/shared_helpers.rb +2 -2
  111. data/bundler/lib/bundler/source/git/git_proxy.rb +0 -6
  112. data/bundler/lib/bundler/source/git.rb +56 -31
  113. data/bundler/lib/bundler/source/path.rb +2 -2
  114. data/bundler/lib/bundler/source_list.rb +1 -1
  115. data/bundler/lib/bundler/spec_set.rb +81 -56
  116. data/bundler/lib/bundler/stub_specification.rb +8 -0
  117. data/bundler/lib/bundler/templates/newgem/README.md.tt +1 -1
  118. data/bundler/lib/bundler/uri_credentials_filter.rb +1 -1
  119. data/bundler/lib/bundler/vendor/fileutils/COPYING +56 -0
  120. data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
  121. data/bundler/lib/bundler/vendor/securerandom/COPYING +56 -0
  122. data/bundler/lib/bundler/vendor/securerandom/lib/securerandom.rb +5 -5
  123. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
  124. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
  125. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
  126. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
  127. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
  128. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
  129. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  130. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
  131. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  132. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  133. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +11 -0
  134. data/bundler/lib/bundler/vendor/uri/COPYING +56 -0
  135. data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +37 -16
  136. data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
  137. data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
  138. data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +16 -26
  139. data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
  140. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
  141. data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  142. data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  143. data/bundler/lib/bundler/vendor/uri/lib/uri.rb +9 -9
  144. data/bundler/lib/bundler/vendored_securerandom.rb +0 -2
  145. data/bundler/lib/bundler/version.rb +1 -1
  146. data/bundler/lib/bundler.rb +37 -13
  147. data/{CONTRIBUTING.md → doc/rubygems/CONTRIBUTING.md} +9 -9
  148. data/{POLICIES.md → doc/rubygems/POLICIES.md} +11 -11
  149. data/lib/rubygems/basic_specification.rb +5 -4
  150. data/lib/rubygems/commands/cleanup_command.rb +2 -2
  151. data/lib/rubygems/commands/contents_command.rb +4 -4
  152. data/lib/rubygems/commands/exec_command.rb +3 -0
  153. data/lib/rubygems/commands/pristine_command.rb +2 -2
  154. data/lib/rubygems/commands/push_command.rb +29 -5
  155. data/lib/rubygems/commands/rdoc_command.rb +2 -2
  156. data/lib/rubygems/commands/rebuild_command.rb +0 -2
  157. data/lib/rubygems/commands/setup_command.rb +1 -16
  158. data/lib/rubygems/commands/unpack_command.rb +0 -6
  159. data/lib/rubygems/commands/update_command.rb +2 -8
  160. data/lib/rubygems/config_file.rb +12 -0
  161. data/lib/rubygems/core_ext/kernel_warn.rb +2 -6
  162. data/lib/rubygems/defaults.rb +1 -1
  163. data/lib/rubygems/exceptions.rb +0 -6
  164. data/lib/rubygems/ext/builder.rb +6 -4
  165. data/lib/rubygems/ext/cargo_builder.rb +7 -4
  166. data/lib/rubygems/ext/cmake_builder.rb +7 -2
  167. data/lib/rubygems/ext/configure_builder.rb +7 -2
  168. data/lib/rubygems/ext/ext_conf_builder.rb +9 -5
  169. data/lib/rubygems/ext/rake_builder.rb +6 -1
  170. data/lib/rubygems/install_update_options.rb +5 -0
  171. data/lib/rubygems/installer.rb +2 -2
  172. data/lib/rubygems/platform.rb +4 -3
  173. data/lib/rubygems/psych_tree.rb +4 -0
  174. data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
  175. data/lib/rubygems/requirement.rb +0 -4
  176. data/lib/rubygems/resolver/composed_set.rb +3 -3
  177. data/lib/rubygems/resolver/git_set.rb +0 -1
  178. data/lib/rubygems/resolver/index_set.rb +2 -2
  179. data/lib/rubygems/resolver.rb +3 -3
  180. data/lib/rubygems/source/git.rb +13 -10
  181. data/lib/rubygems/spec_fetcher.rb +16 -5
  182. data/lib/rubygems/specification.rb +37 -31
  183. data/lib/rubygems/target_rbconfig.rb +50 -0
  184. data/lib/rubygems/uri.rb +1 -1
  185. data/lib/rubygems/util/licenses.rb +10 -1
  186. data/lib/rubygems/vendor/net-http/COPYING +56 -0
  187. data/lib/rubygems/vendor/net-http/lib/net/http/header.rb +1 -1
  188. data/lib/rubygems/vendor/net-http/lib/net/http/requests.rb +5 -0
  189. data/lib/rubygems/vendor/net-http/lib/net/http.rb +120 -36
  190. data/lib/rubygems/vendor/optparse/lib/optparse/ac.rb +16 -0
  191. data/lib/rubygems/vendor/optparse/lib/optparse/kwargs.rb +8 -3
  192. data/lib/rubygems/vendor/optparse/lib/optparse/version.rb +9 -0
  193. data/lib/rubygems/vendor/optparse/lib/optparse.rb +147 -51
  194. data/lib/rubygems/vendor/resolv/COPYING +56 -0
  195. data/lib/rubygems/vendor/resolv/lib/resolv.rb +50 -37
  196. data/lib/rubygems/vendor/securerandom/COPYING +56 -0
  197. data/lib/rubygems/vendor/securerandom/lib/securerandom.rb +5 -5
  198. data/lib/rubygems/vendor/timeout/COPYING +56 -0
  199. data/lib/rubygems/vendor/timeout/lib/timeout.rb +5 -8
  200. data/lib/rubygems/vendor/uri/COPYING +56 -0
  201. data/lib/rubygems/vendor/uri/lib/uri/common.rb +37 -16
  202. data/lib/rubygems/vendor/uri/lib/uri/file.rb +3 -3
  203. data/lib/rubygems/vendor/uri/lib/uri/ftp.rb +1 -1
  204. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +16 -26
  205. data/lib/rubygems/vendor/uri/lib/uri/http.rb +2 -2
  206. data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
  207. data/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  208. data/lib/rubygems/vendor/uri/lib/uri/version.rb +1 -1
  209. data/lib/rubygems/vendor/uri/lib/uri.rb +9 -9
  210. data/lib/rubygems/vendored_securerandom.rb +0 -1
  211. data/lib/rubygems/version.rb +0 -4
  212. data/lib/rubygems.rb +29 -20
  213. data/rubygems-update.gemspec +5 -5
  214. data/setup.rb +1 -1
  215. metadata +36 -27
  216. data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +0 -22
  217. data/bundler/lib/bundler/vendor/securerandom/LICENSE.txt +0 -22
  218. data/bundler/lib/bundler/vendor/securerandom/lib/random/formatter.rb +0 -373
  219. data/bundler/lib/bundler/vendor/uri/LICENSE.txt +0 -22
  220. data/lib/rubygems/vendor/net-http/LICENSE.txt +0 -22
  221. data/lib/rubygems/vendor/net-http/lib/net/http/backward.rb +0 -40
  222. data/lib/rubygems/vendor/resolv/LICENSE.txt +0 -22
  223. data/lib/rubygems/vendor/securerandom/LICENSE.txt +0 -22
  224. data/lib/rubygems/vendor/securerandom/lib/random/formatter.rb +0 -373
  225. data/lib/rubygems/vendor/timeout/LICENSE.txt +0 -22
  226. data/lib/rubygems/vendor/uri/LICENSE.txt +0 -22
  227. /data/{MAINTAINERS.txt → doc/MAINTAINERS.txt} +0 -0
  228. /data/{bundler → doc/bundler}/UPGRADING.md +0 -0
  229. /data/{UPGRADING.md → doc/rubygems/UPGRADING.md} +0 -0
@@ -246,4 +246,14 @@ module Bundler
246
246
  end
247
247
 
248
248
  class InvalidArgumentError < BundlerError; status_code(40); end
249
+
250
+ class IncorrectLockfileDependencies < BundlerError
251
+ attr_reader :spec
252
+
253
+ def initialize(spec)
254
+ @spec = spec
255
+ end
256
+
257
+ status_code(41)
258
+ end
249
259
  end
@@ -33,6 +33,7 @@ module Bundler
33
33
  settings_flag(:default_install_uses_path) { bundler_3_mode? }
34
34
  settings_flag(:forget_cli_options) { bundler_3_mode? }
35
35
  settings_flag(:global_gem_cache) { bundler_3_mode? }
36
+ settings_flag(:lockfile_checksums) { bundler_3_mode? }
36
37
  settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
37
38
  settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
38
39
  settings_flag(:print_only_version_number) { bundler_3_mode? }
@@ -10,7 +10,7 @@ module Bundler
10
10
  method = instance_method(method_name)
11
11
  undef_method(method_name)
12
12
  define_method(method_name) do |*args, &blk|
13
- method.bind(self).call(*args, &blk)
13
+ method.bind_call(self, *args, &blk)
14
14
  rescue NetworkDownError, CompactIndexClient::Updater::MismatchedChecksumError => e
15
15
  raise HTTPError, e.message
16
16
  rescue AuthenticationRequiredError, BadAuthenticationError
@@ -37,8 +37,9 @@ module Bundler
37
37
  # This is the error raised when a source is HTTPS and OpenSSL didn't load
38
38
  class SSLError < HTTPError
39
39
  def initialize(msg = nil)
40
- super msg || "Could not load OpenSSL.\n" \
41
- "You must recompile Ruby with OpenSSL support."
40
+ super "Could not load OpenSSL.\n" \
41
+ "You must recompile Ruby with OpenSSL support.\n" \
42
+ "original error: #{msg}\n"
42
43
  end
43
44
  end
44
45
 
@@ -251,7 +252,13 @@ module Bundler
251
252
  needs_ssl = remote_uri.scheme == "https" ||
252
253
  Bundler.settings[:ssl_verify_mode] ||
253
254
  Bundler.settings[:ssl_client_cert]
254
- raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
255
+ if needs_ssl
256
+ begin
257
+ require "openssl"
258
+ rescue StandardError, LoadError => e
259
+ raise SSLError.new(e.message)
260
+ end
261
+ end
255
262
 
256
263
  con = Gem::Net::HTTP::Persistent.new name: "bundler", proxy: :ENV
257
264
  if gem_proxy = Gem.configuration[:http_proxy]
@@ -46,7 +46,7 @@ module Bundler
46
46
  end
47
47
  module_function :platform_specificity_match
48
48
 
49
- def select_best_platform_match(specs, platform, force_ruby: false, prefer_locked: false)
49
+ def select_all_platform_match(specs, platform, force_ruby: false, prefer_locked: false)
50
50
  matching = if force_ruby
51
51
  specs.select {|spec| spec.match_platform(Gem::Platform::RUBY) && spec.force_ruby_platform! }
52
52
  else
@@ -58,24 +58,40 @@ module Bundler
58
58
  return locked_originally if locked_originally.any?
59
59
  end
60
60
 
61
- sort_best_platform_match(matching, platform)
61
+ matching
62
+ end
63
+ module_function :select_all_platform_match
64
+
65
+ def select_best_platform_match(specs, platform, force_ruby: false, prefer_locked: false)
66
+ matching = select_all_platform_match(specs, platform, force_ruby: force_ruby, prefer_locked: prefer_locked)
67
+
68
+ sort_and_filter_best_platform_match(matching, platform)
62
69
  end
63
70
  module_function :select_best_platform_match
64
71
 
65
72
  def select_best_local_platform_match(specs, force_ruby: false)
66
- select_best_platform_match(specs, local_platform, force_ruby: force_ruby).map(&:materialize_for_installation).compact
73
+ matching = select_all_platform_match(specs, local_platform, force_ruby: force_ruby).filter_map(&:materialized_for_installation)
74
+
75
+ sort_best_platform_match(matching, local_platform)
67
76
  end
68
77
  module_function :select_best_local_platform_match
69
78
 
70
- def sort_best_platform_match(matching, platform)
79
+ def sort_and_filter_best_platform_match(matching, platform)
80
+ return matching if matching.one?
81
+
71
82
  exact = matching.select {|spec| spec.platform == platform }
72
83
  return exact if exact.any?
73
84
 
74
- sorted_matching = matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) }
85
+ sorted_matching = sort_best_platform_match(matching, platform)
75
86
  exemplary_spec = sorted_matching.first
76
87
 
77
88
  sorted_matching.take_while {|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
78
89
  end
90
+ module_function :sort_and_filter_best_platform_match
91
+
92
+ def sort_best_platform_match(matching, platform)
93
+ matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) }
94
+ end
79
95
  module_function :sort_best_platform_match
80
96
 
81
97
  class PlatformMatch
@@ -41,7 +41,7 @@ module Bundler
41
41
 
42
42
  # resolve to see if the new deps broke anything
43
43
  @definition = builder.to_definition(lockfile_path, {})
44
- @definition.resolve_remotely!
44
+ @definition.remotely!
45
45
 
46
46
  # since nothing broke, we can add those gems to the gemfile
47
47
  append_to(gemfile_path, build_gem_lines(@options[:conservative_versioning])) if @deps.any?
@@ -184,7 +184,7 @@ module Bundler
184
184
  # @param [Array] gems Array of names of gems to be removed.
185
185
  # @param [Pathname] gemfile_path The Gemfile from which to remove dependencies.
186
186
  def remove_gems_from_gemfile(gems, gemfile_path)
187
- patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2\)/
187
+ patterns = /gem\s+(['"])#{Regexp.union(gems)}\1|gem\s*\((['"])#{Regexp.union(gems)}\2.*\)/
188
188
  new_gemfile = []
189
189
  multiline_removal = false
190
190
  File.readlines(gemfile_path).each do |line|
@@ -28,7 +28,7 @@ module Bundler
28
28
  private
29
29
 
30
30
  def paths
31
- @specs.map do |spec|
31
+ @specs.flat_map do |spec|
32
32
  next if spec.name == "bundler"
33
33
  Array(spec.require_paths).map do |path|
34
34
  gem_path(path, spec).
@@ -36,7 +36,7 @@ module Bundler
36
36
  sub(extensions_dir, 'extensions/\k<platform>/#{Gem.extension_api_version}')
37
37
  # This is a static string intentionally. It's interpolated at a later time.
38
38
  end
39
- end.flatten.compact
39
+ end.compact
40
40
  end
41
41
 
42
42
  def version_dir
@@ -77,12 +77,9 @@ module Bundler
77
77
  return
78
78
  end
79
79
 
80
- if resolve_if_needed(options)
80
+ if @definition.setup_domain!(options)
81
81
  ensure_specs_are_compatible!
82
- load_plugins
83
- options.delete(:jobs)
84
- else
85
- options[:jobs] = 1 # to avoid the overhead of Bundler::Worker
82
+ Bundler.load_plugins(@definition)
86
83
  end
87
84
  install(options)
88
85
 
@@ -197,18 +194,14 @@ module Bundler
197
194
  standalone = options[:standalone]
198
195
  force = options[:force]
199
196
  local = options[:local]
200
- jobs = installation_parallelization(options)
197
+ jobs = installation_parallelization
201
198
  spec_installations = ParallelInstaller.call(self, @definition.specs, jobs, standalone, force, local: local)
202
199
  spec_installations.each do |installation|
203
200
  post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
204
201
  end
205
202
  end
206
203
 
207
- def installation_parallelization(options)
208
- if jobs = options.delete(:jobs)
209
- return jobs
210
- end
211
-
204
+ def installation_parallelization
212
205
  if jobs = Bundler.settings[:jobs]
213
206
  return jobs
214
207
  end
@@ -216,20 +209,6 @@ module Bundler
216
209
  Bundler.settings.processor_count
217
210
  end
218
211
 
219
- def load_plugins
220
- Gem.load_plugins
221
-
222
- requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
223
- path_plugin_files = requested_path_gems.map do |spec|
224
- spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
225
- rescue TypeError
226
- error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
227
- raise Gem::InvalidSpecificationException, error_message
228
- end.flatten
229
- Gem.load_plugin_files(path_plugin_files)
230
- Gem.load_env_plugins
231
- end
232
-
233
212
  def ensure_specs_are_compatible!
234
213
  @definition.specs.each do |spec|
235
214
  unless spec.matches_current_ruby?
@@ -243,19 +222,6 @@ module Bundler
243
222
  end
244
223
  end
245
224
 
246
- # returns whether or not a re-resolve was needed
247
- def resolve_if_needed(options)
248
- @definition.prefer_local! if options[:"prefer-local"]
249
-
250
- if options[:local] || (@definition.no_resolve_needed? && !@definition.missing_specs?)
251
- @definition.resolve_with_cache!
252
- false
253
- else
254
- @definition.resolve_remotely!
255
- true
256
- end
257
- end
258
-
259
225
  def lock
260
226
  @definition.lock
261
227
  end
@@ -8,14 +8,26 @@ module Bundler
8
8
  include MatchPlatform
9
9
  include ForcePlatform
10
10
 
11
- attr_reader :name, :version, :platform
11
+ attr_reader :name, :version, :platform, :materialization
12
12
  attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version
13
13
 
14
+ #
15
+ # For backwards compatibility with existing lockfiles, if the most specific
16
+ # locked platform is not a specific platform like x86_64-linux or
17
+ # universal-java-11, then we keep the previous behaviour of resolving the
18
+ # best platform variant at materiliazation time. For previous bundler
19
+ # versions (before 2.2.0) this was always the case (except when the lockfile
20
+ # only included non-ruby platforms), but we're also keeping this behaviour
21
+ # on newer bundlers unless users generate the lockfile from scratch or
22
+ # explicitly add a more specific platform.
23
+ #
24
+ attr_accessor :most_specific_locked_platform
25
+
14
26
  alias_method :runtime_dependencies, :dependencies
15
27
 
16
28
  def self.from_spec(s)
17
29
  lazy_spec = new(s.name, s.version, s.platform, s.source)
18
- lazy_spec.dependencies = s.dependencies
30
+ lazy_spec.dependencies = s.runtime_dependencies
19
31
  lazy_spec.required_ruby_version = s.required_ruby_version
20
32
  lazy_spec.required_rubygems_version = s.required_rubygems_version
21
33
  lazy_spec
@@ -33,6 +45,16 @@ module Bundler
33
45
  @source = source
34
46
 
35
47
  @force_ruby_platform = default_force_ruby_platform
48
+ @most_specific_locked_platform = nil
49
+ @materialization = nil
50
+ end
51
+
52
+ def missing?
53
+ @materialization == self
54
+ end
55
+
56
+ def incomplete?
57
+ @materialization.nil?
36
58
  end
37
59
 
38
60
  def source_changed?
@@ -99,16 +121,31 @@ module Bundler
99
121
  out
100
122
  end
101
123
 
102
- def materialize_for_installation
124
+ def materialize_strictly
103
125
  source.local!
104
126
 
105
- matching_specs = source.specs.search(use_exact_resolved_specifications? ? self : [name, version])
127
+ matching_specs = source.specs.search(self)
106
128
  return self if matching_specs.empty?
107
129
 
108
- candidates = if use_exact_resolved_specifications?
109
- matching_specs
130
+ __materialize__(matching_specs)
131
+ end
132
+
133
+ def materialized_for_installation
134
+ @materialization = materialize_for_installation
135
+
136
+ self unless incomplete?
137
+ end
138
+
139
+ def materialize_for_installation
140
+ source.local!
141
+
142
+ if use_exact_resolved_specifications?
143
+ materialize_strictly
110
144
  else
111
- target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform
145
+ matching_specs = source.specs.search([name, version])
146
+ return self if matching_specs.empty?
147
+
148
+ target_platform = source.is_a?(Source::Path) ? platform : local_platform
112
149
 
113
150
  installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
114
151
 
@@ -119,10 +156,8 @@ module Bundler
119
156
  installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
120
157
  end
121
158
 
122
- installable_candidates
159
+ __materialize__(installable_candidates)
123
160
  end
124
-
125
- __materialize__(candidates)
126
161
  end
127
162
 
128
163
  # If in frozen mode, we fallback to a non-installable candidate because by
@@ -136,12 +171,28 @@ module Bundler
136
171
  end
137
172
  if search.nil? && fallback_to_non_installable
138
173
  search = candidates.last
139
- else
140
- search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
174
+ elsif search && search.full_name == full_name
175
+ # We don't validate locally installed dependencies but accept what's in
176
+ # the lockfile instead for performance, since loading locally installed
177
+ # dependencies would mean evaluating all gemspecs, which would affect
178
+ # `bundler/setup` performance
179
+ if search.is_a?(StubSpecification)
180
+ search.dependencies = dependencies
181
+ else
182
+ if !source.is_a?(Source::Path) && search.runtime_dependencies.sort != dependencies.sort
183
+ raise IncorrectLockfileDependencies.new(self)
184
+ end
185
+
186
+ search.locked_platform = platform if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification)
187
+ end
141
188
  end
142
189
  search
143
190
  end
144
191
 
192
+ def inspect
193
+ "#<#{self.class} @name=\"#{name}\" (#{full_name.delete_prefix("#{name}-")})>"
194
+ end
195
+
145
196
  def to_s
146
197
  lock_name
147
198
  end
@@ -158,23 +209,13 @@ module Bundler
158
209
  private
159
210
 
160
211
  def use_exact_resolved_specifications?
161
- @use_exact_resolved_specifications ||= !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
212
+ !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
162
213
  end
163
214
 
164
- #
165
- # For backwards compatibility with existing lockfiles, if the most specific
166
- # locked platform is not a specific platform like x86_64-linux or
167
- # universal-java-11, then we keep the previous behaviour of resolving the
168
- # best platform variant at materiliazation time. For previous bundler
169
- # versions (before 2.2.0) this was always the case (except when the lockfile
170
- # only included non-ruby platforms), but we're also keeping this behaviour
171
- # on newer bundlers unless users generate the lockfile from scratch or
172
- # explicitly add a more specific platform.
173
- #
174
215
  def ruby_platform_materializes_to_ruby_platform?
175
216
  generic_platform = generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
176
217
 
177
- !Bundler.most_specific_locked_platform?(generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
218
+ (most_specific_locked_platform != generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
178
219
  end
179
220
  end
180
221
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Bundler
4
4
  class LockfileParser
5
+ include GemHelpers
6
+
5
7
  class Position
6
8
  attr_reader :line, :column
7
9
  def initialize(line, column)
@@ -29,6 +31,7 @@ module Bundler
29
31
  :dependencies,
30
32
  :specs,
31
33
  :platforms,
34
+ :most_specific_locked_platform,
32
35
  :bundler_version,
33
36
  :ruby_version,
34
37
  :checksums,
@@ -136,7 +139,12 @@ module Bundler
136
139
  end
137
140
  @pos.advance!(line)
138
141
  end
139
- @specs = @specs.values.sort_by!(&:full_name)
142
+ @most_specific_locked_platform = @platforms.min_by do |bundle_platform|
143
+ platform_specificity_match(bundle_platform, local_platform)
144
+ end
145
+ @specs = @specs.values.sort_by!(&:full_name).each do |spec|
146
+ spec.most_specific_locked_platform = @most_specific_locked_platform
147
+ end
140
148
  rescue ArgumentError => e
141
149
  Bundler.ui.debug(e)
142
150
  raise LockfileError, "Your lockfile is unreadable. Run `rm #{@lockfile_path}` " \
@@ -1,6 +1,6 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-ADD" "1" "October 2024" ""
3
+ .TH "BUNDLE\-ADD" "1" "December 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
6
6
  .SH "SYNOPSIS"
@@ -9,33 +9,36 @@
9
9
  Adds the named gem to the [\fBGemfile(5)\fR][Gemfile(5)] and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
10
10
  .SH "OPTIONS"
11
11
  .TP
12
- \fB\-\-version\fR, \fB\-v\fR
12
+ \fB\-\-version=VERSION\fR, \fB\-v=VERSION\fR
13
13
  Specify version requirements(s) for the added gem\.
14
14
  .TP
15
- \fB\-\-group\fR, \fB\-g\fR
15
+ \fB\-\-group=GROUP\fR, \fB\-g=GROUP\fR
16
16
  Specify the group(s) for the added gem\. Multiple groups should be separated by commas\.
17
17
  .TP
18
- \fB\-\-source\fR, \fB\-s\fR
18
+ \fB\-\-source=SOURCE\fR, \fB\-s=SOURCE\fR
19
19
  Specify the source for the added gem\.
20
20
  .TP
21
- \fB\-\-require\fR, \fB\-r\fR
21
+ \fB\-\-require=REQUIRE\fR, \fB\-r=REQUIRE\fR
22
22
  Adds require path to gem\. Provide false, or a path as a string\.
23
23
  .TP
24
- \fB\-\-path\fR
24
+ \fB\-\-path=PATH\fR
25
25
  Specify the file system path for the added gem\.
26
26
  .TP
27
- \fB\-\-git\fR
27
+ \fB\-\-git=GIT\fR
28
28
  Specify the git source for the added gem\.
29
29
  .TP
30
- \fB\-\-github\fR
30
+ \fB\-\-github=GITHUB\fR
31
31
  Specify the github source for the added gem\.
32
32
  .TP
33
- \fB\-\-branch\fR
33
+ \fB\-\-branch=BRANCH\fR
34
34
  Specify the git branch for the added gem\.
35
35
  .TP
36
- \fB\-\-ref\fR
36
+ \fB\-\-ref=REF\fR
37
37
  Specify the git ref for the added gem\.
38
38
  .TP
39
+ \fB\-\-glob=GLOB\fR
40
+ Specify the location of a dependency's \.gemspec, expanded within Ruby (single quotes recommended)\.
41
+ .TP
39
42
  \fB\-\-quiet\fR
40
43
  Do not print progress information to the standard output\.
41
44
  .TP
@@ -14,33 +14,36 @@ Adds the named gem to the [`Gemfile(5)`][Gemfile(5)] and run `bundle install`.
14
14
 
15
15
  ## OPTIONS
16
16
 
17
- * `--version`, `-v`:
17
+ * `--version=VERSION`, `-v=VERSION`:
18
18
  Specify version requirements(s) for the added gem.
19
19
 
20
- * `--group`, `-g`:
20
+ * `--group=GROUP`, `-g=GROUP`:
21
21
  Specify the group(s) for the added gem. Multiple groups should be separated by commas.
22
22
 
23
- * `--source`, `-s`:
23
+ * `--source=SOURCE`, `-s=SOURCE`:
24
24
  Specify the source for the added gem.
25
25
 
26
- * `--require`, `-r`:
26
+ * `--require=REQUIRE`, `-r=REQUIRE`:
27
27
  Adds require path to gem. Provide false, or a path as a string.
28
28
 
29
- * `--path`:
29
+ * `--path=PATH`:
30
30
  Specify the file system path for the added gem.
31
31
 
32
- * `--git`:
32
+ * `--git=GIT`:
33
33
  Specify the git source for the added gem.
34
34
 
35
- * `--github`:
35
+ * `--github=GITHUB`:
36
36
  Specify the github source for the added gem.
37
37
 
38
- * `--branch`:
38
+ * `--branch=BRANCH`:
39
39
  Specify the git branch for the added gem.
40
40
 
41
- * `--ref`:
41
+ * `--ref=REF`:
42
42
  Specify the git ref for the added gem.
43
43
 
44
+ * `--glob=GLOB`:
45
+ Specify the location of a dependency's .gemspec, expanded within Ruby (single quotes recommended).
46
+
44
47
  * `--quiet`:
45
48
  Do not print progress information to the standard output.
46
49
 
@@ -1,10 +1,10 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-BINSTUBS" "1" "October 2024" ""
3
+ .TH "BUNDLE\-BINSTUBS" "1" "December 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
6
6
  .SH "SYNOPSIS"
7
- \fBbundle binstubs\fR \fIGEM_NAME\fR [\-\-force] [\-\-path PATH] [\-\-standalone]
7
+ \fBbundle binstubs\fR \fIGEM_NAME\fR [\-\-force] [\-\-path PATH] [\-\-standalone] [\-\-all\-platforms]
8
8
  .SH "DESCRIPTION"
9
9
  Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it into \fBbin/\fR\. Binstubs are a shortcut\-or alternative\- to always using \fBbundle exec\fR\. This gives you a file that can be run directly, and one that will always run the correct gem version used by the application\.
10
10
  .P
@@ -16,15 +16,18 @@ This command generates binstubs for executables in \fBGEM_NAME\fR\. Binstubs are
16
16
  \fB\-\-force\fR
17
17
  Overwrite existing binstubs if they exist\.
18
18
  .TP
19
- \fB\-\-path\fR
19
+ \fB\-\-path[=PATH]\fR
20
20
  The location to install the specified binstubs to\. This defaults to \fBbin\fR\.
21
21
  .TP
22
22
  \fB\-\-standalone\fR
23
23
  Makes binstubs that can work without depending on Rubygems or Bundler at runtime\.
24
24
  .TP
25
- \fB\-\-shebang\fR
25
+ \fB\-\-shebang=SHEBANG\fR
26
26
  Specify a different shebang executable name than the default (default 'ruby')
27
27
  .TP
28
28
  \fB\-\-all\fR
29
29
  Create binstubs for all gems in the bundle\.
30
+ .TP
31
+ \fB\-\-all\-platforms\fR
32
+ Install binstubs for all platforms\.
30
33
 
@@ -3,7 +3,7 @@ bundle-binstubs(1) -- Install the binstubs of the listed gems
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `bundle binstubs` <GEM_NAME> [--force] [--path PATH] [--standalone]
6
+ `bundle binstubs` <GEM_NAME> [--force] [--path PATH] [--standalone] [--all-platforms]
7
7
 
8
8
  ## DESCRIPTION
9
9
 
@@ -27,15 +27,18 @@ Calling binstubs with [GEM [GEM]] will create binstubs for all given gems.
27
27
  * `--force`:
28
28
  Overwrite existing binstubs if they exist.
29
29
 
30
- * `--path`:
30
+ * `--path[=PATH]`:
31
31
  The location to install the specified binstubs to. This defaults to `bin`.
32
32
 
33
33
  * `--standalone`:
34
34
  Makes binstubs that can work without depending on Rubygems or Bundler at
35
35
  runtime.
36
36
 
37
- * `--shebang`:
37
+ * `--shebang=SHEBANG`:
38
38
  Specify a different shebang executable name than the default (default 'ruby')
39
39
 
40
40
  * `--all`:
41
41
  Create binstubs for all gems in the bundle.
42
+
43
+ * `--all-platforms`:
44
+ Install binstubs for all platforms.
@@ -1,14 +1,42 @@
1
1
  .\" generated with nRonn/v0.11.1
2
2
  .\" https://github.com/n-ronn/nronn/tree/0.11.1
3
- .TH "BUNDLE\-CACHE" "1" "October 2024" ""
3
+ .TH "BUNDLE\-CACHE" "1" "December 2024" ""
4
4
  .SH "NAME"
5
5
  \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
6
6
  .SH "SYNOPSIS"
7
- \fBbundle cache\fR
7
+ \fBbundle cache\fR [\fIOPTIONS\fR]
8
8
  .P
9
9
  alias: \fBpackage\fR, \fBpack\fR
10
10
  .SH "DESCRIPTION"
11
11
  Copy all of the \fB\.gem\fR files needed to run the application into the \fBvendor/cache\fR directory\. In the future, when running \fBbundle install(1)\fR \fIbundle\-install\.1\.html\fR, use the gems in the cache in preference to the ones on \fBrubygems\.org\fR\.
12
+ .SH "OPTIONS"
13
+ .TP
14
+ \fB\-\-all\fR
15
+ Include all sources (including path and git)\.
16
+ .TP
17
+ \fB\-\-all\-platforms\fR
18
+ Include gems for all platforms present in the lockfile, not only the current one\.
19
+ .TP
20
+ \fB\-\-cache\-path=CACHE\-PATH\fR
21
+ Specify a different cache path than the default (vendor/cache)\.
22
+ .TP
23
+ \fB\-\-gemfile=GEMFILE\fR
24
+ Use the specified gemfile instead of Gemfile\.
25
+ .TP
26
+ \fB\-\-no\-install\fR
27
+ Don't install the gems, only update the cache\.
28
+ .TP
29
+ \fB\-\-no\-prune\fR
30
+ Don't remove stale gems from the cache\.
31
+ .TP
32
+ \fB\-\-path=PATH\fR
33
+ Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME)\.
34
+ .TP
35
+ \fB\-\-quiet\fR
36
+ Only output warnings and errors\.
37
+ .TP
38
+ \fB\-\-frozen\fR
39
+ Do not allow the Gemfile\.lock to be updated after this bundle cache operation's install\.
12
40
  .SH "GIT AND PATH GEMS"
13
41
  The \fBbundle cache\fR command can also package \fB:git\fR and \fB:path\fR dependencies besides \.gem files\. This needs to be explicitly enabled via the \fB\-\-all\fR option\. Once used, the \fB\-\-all\fR option will be remembered\.
14
42
  .SH "SUPPORT FOR MULTIPLE PLATFORMS"
@@ -1,9 +1,9 @@
1
1
  bundle-cache(1) -- Package your needed `.gem` files into your application
2
- ===========================================================================
2
+ =========================================================================
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `bundle cache`
6
+ `bundle cache` [*OPTIONS*]
7
7
 
8
8
  alias: `package`, `pack`
9
9
 
@@ -13,6 +13,35 @@ Copy all of the `.gem` files needed to run the application into the
13
13
  `vendor/cache` directory. In the future, when running [`bundle install(1)`](bundle-install.1.html),
14
14
  use the gems in the cache in preference to the ones on `rubygems.org`.
15
15
 
16
+ ## OPTIONS
17
+
18
+ * `--all`:
19
+ Include all sources (including path and git).
20
+
21
+ * `--all-platforms`:
22
+ Include gems for all platforms present in the lockfile, not only the current one.
23
+
24
+ * `--cache-path=CACHE-PATH`:
25
+ Specify a different cache path than the default (vendor/cache).
26
+
27
+ * `--gemfile=GEMFILE`:
28
+ Use the specified gemfile instead of Gemfile.
29
+
30
+ * `--no-install`:
31
+ Don't install the gems, only update the cache.
32
+
33
+ * `--no-prune`:
34
+ Don't remove stale gems from the cache.
35
+
36
+ * `--path=PATH`:
37
+ Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).
38
+
39
+ * `--quiet`:
40
+ Only output warnings and errors.
41
+
42
+ * `--frozen`:
43
+ Do not allow the Gemfile.lock to be updated after this bundle cache operation's install.
44
+
16
45
  ## GIT AND PATH GEMS
17
46
 
18
47
  The `bundle cache` command can also package `:git` and `:path` dependencies