bundler 2.3.12 → 2.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +367 -1
  3. data/README.md +2 -2
  4. data/bundler.gemspec +8 -10
  5. data/exe/bundle +1 -4
  6. data/lib/bundler/build_metadata.rb +2 -2
  7. data/lib/bundler/cli/add.rb +1 -1
  8. data/lib/bundler/cli/binstubs.rb +5 -1
  9. data/lib/bundler/cli/check.rb +1 -1
  10. data/lib/bundler/cli/common.rb +3 -1
  11. data/lib/bundler/cli/console.rb +2 -2
  12. data/lib/bundler/cli/doctor.rb +4 -6
  13. data/lib/bundler/cli/gem.rb +62 -40
  14. data/lib/bundler/cli/init.rb +5 -1
  15. data/lib/bundler/cli/install.rb +7 -5
  16. data/lib/bundler/cli/lock.rb +8 -5
  17. data/lib/bundler/cli/open.rb +6 -4
  18. data/lib/bundler/cli/outdated.rb +13 -6
  19. data/lib/bundler/cli/platform.rb +1 -1
  20. data/lib/bundler/cli/viz.rb +1 -1
  21. data/lib/bundler/cli.rb +52 -7
  22. data/lib/bundler/compact_index_client/cache.rb +1 -1
  23. data/lib/bundler/compact_index_client/updater.rb +53 -39
  24. data/lib/bundler/constants.rb +1 -1
  25. data/lib/bundler/current_ruby.rb +15 -6
  26. data/lib/bundler/definition.rb +203 -110
  27. data/lib/bundler/dependency.rb +21 -84
  28. data/lib/bundler/digest.rb +1 -1
  29. data/lib/bundler/dsl.rb +13 -18
  30. data/lib/bundler/endpoint_specification.rb +6 -10
  31. data/lib/bundler/env.rb +1 -1
  32. data/lib/bundler/environment_preserver.rb +1 -0
  33. data/lib/bundler/errors.rb +15 -15
  34. data/lib/bundler/feature_flag.rb +0 -1
  35. data/lib/bundler/fetcher/base.rb +6 -8
  36. data/lib/bundler/fetcher/compact_index.rb +9 -11
  37. data/lib/bundler/fetcher/dependency.rb +1 -1
  38. data/lib/bundler/fetcher/downloader.rb +2 -5
  39. data/lib/bundler/fetcher.rb +12 -12
  40. data/lib/bundler/force_platform.rb +18 -0
  41. data/lib/bundler/friendly_errors.rb +21 -7
  42. data/lib/bundler/gem_helpers.rb +9 -2
  43. data/lib/bundler/gem_version_promoter.rb +53 -98
  44. data/lib/bundler/graph.rb +3 -3
  45. data/lib/bundler/index.rb +11 -49
  46. data/lib/bundler/injector.rb +8 -3
  47. data/lib/bundler/inline.rb +9 -21
  48. data/lib/bundler/installer/gem_installer.rb +14 -1
  49. data/lib/bundler/installer/parallel_installer.rb +0 -31
  50. data/lib/bundler/installer/standalone.rb +41 -10
  51. data/lib/bundler/installer.rb +18 -39
  52. data/lib/bundler/lazy_specification.rb +53 -48
  53. data/lib/bundler/lockfile_generator.rb +1 -1
  54. data/lib/bundler/lockfile_parser.rb +9 -5
  55. data/lib/bundler/man/bundle-add.1 +13 -5
  56. data/lib/bundler/man/bundle-add.1.ronn +10 -4
  57. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  58. data/lib/bundler/man/bundle-cache.1 +7 -1
  59. data/lib/bundler/man/bundle-cache.1.ronn +7 -0
  60. data/lib/bundler/man/bundle-check.1 +1 -1
  61. data/lib/bundler/man/bundle-clean.1 +2 -2
  62. data/lib/bundler/man/bundle-clean.1.ronn +1 -1
  63. data/lib/bundler/man/bundle-config.1 +26 -7
  64. data/lib/bundler/man/bundle-config.1.ronn +17 -7
  65. data/lib/bundler/man/bundle-console.1 +53 -0
  66. data/lib/bundler/man/bundle-console.1.ronn +44 -0
  67. data/lib/bundler/man/bundle-doctor.1 +1 -1
  68. data/lib/bundler/man/bundle-exec.1 +6 -6
  69. data/lib/bundler/man/bundle-exec.1.ronn +6 -6
  70. data/lib/bundler/man/bundle-gem.1 +27 -37
  71. data/lib/bundler/man/bundle-gem.1.ronn +5 -5
  72. data/lib/bundler/man/bundle-help.1 +13 -0
  73. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  74. data/lib/bundler/man/bundle-info.1 +1 -1
  75. data/lib/bundler/man/bundle-init.1 +1 -1
  76. data/lib/bundler/man/bundle-inject.1 +5 -2
  77. data/lib/bundler/man/bundle-inject.1.ronn +3 -1
  78. data/lib/bundler/man/bundle-install.1 +5 -30
  79. data/lib/bundler/man/bundle-install.1.ronn +6 -29
  80. data/lib/bundler/man/bundle-list.1 +1 -1
  81. data/lib/bundler/man/bundle-lock.1 +1 -1
  82. data/lib/bundler/man/bundle-open.1 +22 -2
  83. data/lib/bundler/man/bundle-open.1.ronn +9 -1
  84. data/lib/bundler/man/bundle-outdated.1 +1 -1
  85. data/lib/bundler/man/bundle-platform.1 +16 -6
  86. data/lib/bundler/man/bundle-platform.1.ronn +14 -7
  87. data/lib/bundler/man/bundle-plugin.1 +81 -0
  88. data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  89. data/lib/bundler/man/bundle-pristine.1 +1 -1
  90. data/lib/bundler/man/bundle-remove.1 +1 -1
  91. data/lib/bundler/man/bundle-show.1 +1 -1
  92. data/lib/bundler/man/bundle-update.1 +1 -1
  93. data/lib/bundler/man/bundle-version.1 +35 -0
  94. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  95. data/lib/bundler/man/bundle-viz.1 +4 -1
  96. data/lib/bundler/man/bundle-viz.1.ronn +2 -0
  97. data/lib/bundler/man/bundle.1 +15 -10
  98. data/lib/bundler/man/bundle.1.ronn +12 -7
  99. data/lib/bundler/man/gemfile.5 +92 -81
  100. data/lib/bundler/man/gemfile.5.ronn +98 -85
  101. data/lib/bundler/man/index.txt +4 -0
  102. data/lib/bundler/match_metadata.rb +13 -0
  103. data/lib/bundler/match_platform.rb +0 -1
  104. data/lib/bundler/match_remote_metadata.rb +29 -0
  105. data/lib/bundler/mirror.rb +5 -7
  106. data/lib/bundler/plugin/api/source.rb +3 -3
  107. data/lib/bundler/plugin/index.rb +4 -4
  108. data/lib/bundler/plugin/installer/git.rb +0 -4
  109. data/lib/bundler/plugin/installer/rubygems.rb +0 -8
  110. data/lib/bundler/plugin.rb +2 -0
  111. data/lib/bundler/process_lock.rb +1 -1
  112. data/lib/bundler/remote_specification.rb +8 -9
  113. data/lib/bundler/resolver/base.rb +77 -0
  114. data/lib/bundler/resolver/candidate.rb +94 -0
  115. data/lib/bundler/resolver/incompatibility.rb +15 -0
  116. data/lib/bundler/resolver/package.rb +72 -0
  117. data/lib/bundler/resolver/root.rb +25 -0
  118. data/lib/bundler/resolver/spec_group.rb +42 -70
  119. data/lib/bundler/resolver.rb +322 -326
  120. data/lib/bundler/ruby_dsl.rb +1 -1
  121. data/lib/bundler/ruby_version.rb +5 -5
  122. data/lib/bundler/rubygems_ext.rb +102 -12
  123. data/lib/bundler/rubygems_gem_installer.rb +32 -20
  124. data/lib/bundler/rubygems_integration.rb +12 -34
  125. data/lib/bundler/runtime.rb +1 -6
  126. data/lib/bundler/settings.rb +2 -8
  127. data/lib/bundler/shared_helpers.rb +7 -7
  128. data/lib/bundler/source/git/git_proxy.rb +193 -67
  129. data/lib/bundler/source/git.rb +21 -25
  130. data/lib/bundler/source/metadata.rb +1 -2
  131. data/lib/bundler/source/path/installer.rb +1 -22
  132. data/lib/bundler/source/path.rb +6 -6
  133. data/lib/bundler/source/rubygems.rb +75 -117
  134. data/lib/bundler/source.rb +3 -4
  135. data/lib/bundler/source_list.rb +12 -2
  136. data/lib/bundler/spec_set.rb +52 -34
  137. data/lib/bundler/stub_specification.rb +5 -3
  138. data/lib/bundler/templates/Executable +1 -1
  139. data/lib/bundler/templates/Executable.bundler +4 -9
  140. data/lib/bundler/templates/Executable.standalone +2 -0
  141. data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
  142. data/lib/bundler/templates/newgem/Gemfile.tt +3 -0
  143. data/lib/bundler/templates/newgem/README.md.tt +6 -4
  144. data/lib/bundler/templates/newgem/Rakefile.tt +2 -1
  145. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  146. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
  147. data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
  148. data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
  149. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +10 -0
  150. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  151. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
  152. data/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
  153. data/lib/bundler/ui/shell.rb +35 -12
  154. data/lib/bundler/ui/silent.rb +21 -5
  155. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +3 -3
  156. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -1
  157. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -1
  158. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
  159. data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  160. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
  161. data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
  162. data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
  163. data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
  164. data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
  165. data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +151 -0
  166. data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
  167. data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
  168. data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
  169. data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
  170. data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +53 -0
  171. data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
  172. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
  173. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +128 -0
  174. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +409 -0
  175. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +240 -0
  176. data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
  177. data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
  178. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +1 -1
  179. data/lib/bundler/vendor/uri/lib/uri/common.rb +64 -16
  180. data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
  181. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -1
  182. data/lib/bundler/vendor/uri/lib/uri/generic.rb +27 -7
  183. data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -2
  184. data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -1
  185. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  186. data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
  187. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -2
  188. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +13 -7
  189. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +10 -5
  190. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  191. data/lib/bundler/vendor/uri/lib/uri/ws.rb +1 -2
  192. data/lib/bundler/vendor/uri/lib/uri/wss.rb +2 -1
  193. data/lib/bundler/vendor/uri/lib/uri.rb +3 -2
  194. data/lib/bundler/vendored_persistent.rb +1 -33
  195. data/lib/bundler/{vendored_tmpdir.rb → vendored_pub_grub.rb} +1 -1
  196. data/lib/bundler/version.rb +5 -1
  197. data/lib/bundler/worker.rb +5 -7
  198. data/lib/bundler.rb +35 -69
  199. metadata +45 -34
  200. data/lib/bundler/dep_proxy.rb +0 -55
  201. data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
  202. data/lib/bundler/vendor/molinillo/LICENSE +0 -9
  203. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
  204. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
  205. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
  206. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
  207. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
  208. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
  209. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
  210. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
  211. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
  212. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
  213. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
  214. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
  215. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -149
  216. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
  217. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
  218. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
  219. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
  220. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
  221. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
  222. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
  223. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
  224. data/lib/bundler/vendored_molinillo.rb +0 -4
  225. data/lib/bundler/version_ranges.rb +0 -122
  226. /data/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +0 -0
@@ -13,7 +13,7 @@ module Bundler
13
13
  Installer.ambiguous_gems = []
14
14
  end
15
15
 
16
- attr_reader :post_install_messages
16
+ attr_reader :post_install_messages, :definition
17
17
 
18
18
  # Begins the installation process for Bundler.
19
19
  # For more information see the #run method on this class.
@@ -66,7 +66,7 @@ module Bundler
66
66
  # require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
67
67
  # information.
68
68
  def run(options)
69
- create_bundle_path
69
+ Bundler.create_bundle_path
70
70
 
71
71
  ProcessLock.lock do
72
72
  if Bundler.frozen_bundle?
@@ -136,11 +136,7 @@ module Bundler
136
136
 
137
137
  mode = Gem.win_platform? ? "wb:UTF-8" : "w"
138
138
  require "erb"
139
- content = if RUBY_VERSION >= "2.6"
140
- ERB.new(template, :trim_mode => "-").result(binding)
141
- else
142
- ERB.new(template, nil, "-").result(binding)
143
- end
139
+ content = ERB.new(template, :trim_mode => "-").result(binding)
144
140
 
145
141
  File.write(binstub_path, content, :mode => mode, :perm => 0o777 & ~File.umask)
146
142
  if Gem.win_platform? || options[:all_platforms]
@@ -183,11 +179,7 @@ module Bundler
183
179
 
184
180
  mode = Gem.win_platform? ? "wb:UTF-8" : "w"
185
181
  require "erb"
186
- content = if RUBY_VERSION >= "2.6"
187
- ERB.new(template, :trim_mode => "-").result(binding)
188
- else
189
- ERB.new(template, nil, "-").result(binding)
190
- end
182
+ content = ERB.new(template, :trim_mode => "-").result(binding)
191
183
 
192
184
  File.write("#{bin_path}/#{executable}", content, :mode => mode, :perm => 0o755)
193
185
  if Gem.win_platform? || options[:all_platforms]
@@ -226,31 +218,24 @@ module Bundler
226
218
 
227
219
  requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
228
220
  path_plugin_files = requested_path_gems.map do |spec|
229
- begin
230
- Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
231
- rescue TypeError
232
- error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
233
- raise Gem::InvalidSpecificationException, error_message
234
- end
221
+ Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
222
+ rescue TypeError
223
+ error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
224
+ raise Gem::InvalidSpecificationException, error_message
235
225
  end.flatten
236
226
  Bundler.rubygems.load_plugin_files(path_plugin_files)
237
227
  Bundler.rubygems.load_env_plugins
238
228
  end
239
229
 
240
230
  def ensure_specs_are_compatible!
241
- system_ruby = Bundler::RubyVersion.system
242
- rubygems_version = Bundler.rubygems.version
243
231
  @definition.specs.each do |spec|
244
- if required_ruby_version = spec.required_ruby_version
245
- unless required_ruby_version.satisfied_by?(system_ruby.gem_version)
246
- raise InstallError, "#{spec.full_name} requires ruby version #{required_ruby_version}, " \
247
- "which is incompatible with the current version, #{system_ruby}"
248
- end
232
+ unless spec.matches_current_ruby?
233
+ raise InstallError, "#{spec.full_name} requires ruby version #{spec.required_ruby_version}, " \
234
+ "which is incompatible with the current version, #{Gem.ruby_version}"
249
235
  end
250
- next unless required_rubygems_version = spec.required_rubygems_version
251
- unless required_rubygems_version.satisfied_by?(rubygems_version)
252
- raise InstallError, "#{spec.full_name} requires rubygems version #{required_rubygems_version}, " \
253
- "which is incompatible with the current version, #{rubygems_version}"
236
+ unless spec.matches_current_rubygems?
237
+ raise InstallError, "#{spec.full_name} requires rubygems version #{spec.required_rubygems_version}, " \
238
+ "which is incompatible with the current version, #{Gem.rubygems_version}"
254
239
  end
255
240
  end
256
241
  end
@@ -262,22 +247,16 @@ module Bundler
262
247
  end
263
248
  end
264
249
 
265
- def create_bundle_path
266
- SharedHelpers.filesystem_access(Bundler.bundle_path.to_s) do |p|
267
- Bundler.mkdir_p(p)
268
- end unless Bundler.bundle_path.exist?
269
- rescue Errno::EEXIST
270
- raise PathError, "Could not install to path `#{Bundler.bundle_path}` " \
271
- "because a file already exists at that path. Either remove or rename the file so the directory can be created."
272
- end
273
-
274
250
  # returns whether or not a re-resolve was needed
275
251
  def resolve_if_needed(options)
252
+ @definition.resolution_mode = options
253
+
276
254
  if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
277
255
  return false if @definition.nothing_changed? && !@definition.missing_specs?
278
256
  end
279
257
 
280
- options["local"] ? @definition.resolve_with_cache! : @definition.resolve_remotely!
258
+ @definition.setup_sources_for_resolve
259
+
281
260
  true
282
261
  end
283
262
 
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "match_platform"
3
+ require_relative "force_platform"
4
4
 
5
5
  module Bundler
6
6
  class LazySpecification
7
7
  include MatchPlatform
8
+ include ForcePlatform
8
9
 
9
10
  attr_reader :name, :version, :dependencies, :platform
10
- attr_accessor :source, :remote
11
+ attr_accessor :source, :remote, :force_ruby_platform
11
12
 
12
13
  def initialize(name, version, platform, source = nil)
13
14
  @name = name
@@ -15,11 +16,11 @@ module Bundler
15
16
  @dependencies = []
16
17
  @platform = platform || Gem::Platform::RUBY
17
18
  @source = source
18
- @specification = nil
19
+ @force_ruby_platform = default_force_ruby_platform
19
20
  end
20
21
 
21
22
  def full_name
22
- if platform == Gem::Platform::RUBY || platform.nil?
23
+ if platform == Gem::Platform::RUBY
23
24
  "#{@name}-#{@version}"
24
25
  else
25
26
  "#{@name}-#{@version}-#{platform}"
@@ -61,7 +62,7 @@ module Bundler
61
62
  def to_lock
62
63
  out = String.new
63
64
 
64
- if platform == Gem::Platform::RUBY || platform.nil?
65
+ if platform == Gem::Platform::RUBY
65
66
  out << " #{name} (#{version})\n"
66
67
  else
67
68
  out << " #{name} (#{version}-#{platform})\n"
@@ -75,37 +76,53 @@ module Bundler
75
76
  out
76
77
  end
77
78
 
78
- def __materialize__
79
- @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
80
- source.gemspec.tap {|s| s.source = source }
79
+ def materialize_for_installation
80
+ source.local!
81
+
82
+ matching_specs = source.specs.search(use_exact_resolved_specifications? ? self : [name, version])
83
+ return self if matching_specs.empty?
84
+
85
+ candidates = if use_exact_resolved_specifications?
86
+ matching_specs
81
87
  else
82
- search_object = if source.is_a?(Source::Path)
83
- Dependency.new(name, version)
84
- else
85
- ruby_platform_materializes_to_ruby_platform? ? self : Dependency.new(name, version)
86
- end
87
- platform_object = Gem::Platform.new(platform)
88
- candidates = source.specs.search(search_object)
89
- same_platform_candidates = candidates.select do |spec|
90
- MatchPlatform.platforms_match?(spec.platform, platform_object)
91
- end
92
- installable_candidates = same_platform_candidates.select do |spec|
93
- spec.is_a?(StubSpecification) ||
94
- (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
95
- spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
88
+ target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform
89
+
90
+ installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
91
+
92
+ specification = __materialize__(installable_candidates, :fallback_to_non_installable => false)
93
+ return specification unless specification.nil?
94
+
95
+ if target_platform != platform
96
+ installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
96
97
  end
97
- search = installable_candidates.last
98
- search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
99
- search
98
+
99
+ installable_candidates
100
100
  end
101
+
102
+ __materialize__(candidates)
101
103
  end
102
104
 
103
- def respond_to?(*args)
104
- super || @specification ? @specification.respond_to?(*args) : nil
105
+ # If in frozen mode, we fallback to a non-installable candidate because by
106
+ # doing this we avoid re-resolving and potentially end up changing the
107
+ # lock file, which is not allowed. In that case, we will give a proper error
108
+ # about the mismatch higher up the stack, right before trying to install the
109
+ # bad gem.
110
+ def __materialize__(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
111
+ search = candidates.reverse.find do |spec|
112
+ spec.is_a?(StubSpecification) ||
113
+ (spec.matches_current_ruby? &&
114
+ spec.matches_current_rubygems?)
115
+ end
116
+ if search.nil? && fallback_to_non_installable
117
+ search = candidates.last
118
+ else
119
+ search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
120
+ end
121
+ search
105
122
  end
106
123
 
107
124
  def to_s
108
- @__to_s ||= if platform == Gem::Platform::RUBY || platform.nil?
125
+ @__to_s ||= if platform == Gem::Platform::RUBY
109
126
  "#{name} (#{version})"
110
127
  else
111
128
  "#{name} (#{version}-#{platform})"
@@ -113,7 +130,7 @@ module Bundler
113
130
  end
114
131
 
115
132
  def identifier
116
- @__identifier ||= [name, version, platform_string]
133
+ @__identifier ||= [name, version, platform.to_s]
117
134
  end
118
135
 
119
136
  def git_version
@@ -121,30 +138,16 @@ module Bundler
121
138
  " #{source.revision[0..6]}"
122
139
  end
123
140
 
124
- protected
125
-
126
- def platform_string
127
- platform_string = platform.to_s
128
- platform_string == Index::RUBY ? Index::NULL : platform_string
129
- end
130
-
131
141
  private
132
142
 
133
- def to_ary
134
- nil
135
- end
136
-
137
- def method_missing(method, *args, &blk)
138
- raise "LazySpecification has not been materialized yet (calling :#{method} #{args.inspect})" unless @specification
139
-
140
- return super unless respond_to?(method)
141
-
142
- @specification.send(method, *args, &blk)
143
+ def use_exact_resolved_specifications?
144
+ @use_exact_resolved_specifications ||= !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
143
145
  end
144
146
 
145
147
  #
146
148
  # For backwards compatibility with existing lockfiles, if the most specific
147
- # locked platform is RUBY, we keep the previous behaviour of resolving the
149
+ # locked platform is not a specific platform like x86_64-linux or
150
+ # universal-java-11, then we keep the previous behaviour of resolving the
148
151
  # best platform variant at materiliazation time. For previous bundler
149
152
  # versions (before 2.2.0) this was always the case (except when the lockfile
150
153
  # only included non-ruby platforms), but we're also keeping this behaviour
@@ -152,7 +155,9 @@ module Bundler
152
155
  # explicitly add a more specific platform.
153
156
  #
154
157
  def ruby_platform_materializes_to_ruby_platform?
155
- !Bundler.most_specific_locked_platform?(Gem::Platform::RUBY) || Bundler.settings[:force_ruby_platform]
158
+ generic_platform = generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
159
+
160
+ !Bundler.most_specific_locked_platform?(generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
156
161
  end
157
162
  end
158
163
  end
@@ -60,7 +60,7 @@ module Bundler
60
60
  handled = []
61
61
  definition.dependencies.sort_by(&:to_s).each do |dep|
62
62
  next if handled.include?(dep.name)
63
- out << dep.to_lock
63
+ out << dep.to_lock << "\n"
64
64
  handled << dep.name
65
65
  end
66
66
  end
@@ -63,7 +63,7 @@ module Bundler
63
63
  @state = nil
64
64
  @specs = {}
65
65
 
66
- if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
66
+ if lockfile.match?(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
67
67
  raise LockfileError, "Your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} contains merge conflicts.\n" \
68
68
  "Run `git checkout HEAD -- #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` first to get a clean lock."
69
69
  end
@@ -80,7 +80,7 @@ module Bundler
80
80
  @state = :ruby
81
81
  elsif line == BUNDLED
82
82
  @state = :bundled_with
83
- elsif line =~ /^[^\s]/
83
+ elsif /^[^\s]/.match?(line)
84
84
  @state = nil
85
85
  elsif @state
86
86
  send("parse_#{@state}", line)
@@ -93,12 +93,16 @@ module Bundler
93
93
  "and then `bundle install` to generate a new lockfile."
94
94
  end
95
95
 
96
+ def may_include_redundant_platform_specific_gems?
97
+ bundler_version.nil? || bundler_version < Gem::Version.new("1.16.2")
98
+ end
99
+
96
100
  private
97
101
 
98
102
  TYPES = {
99
- GIT => Bundler::Source::Git,
100
- GEM => Bundler::Source::Rubygems,
101
- PATH => Bundler::Source::Path,
103
+ GIT => Bundler::Source::Git,
104
+ GEM => Bundler::Source::Rubygems,
105
+ PATH => Bundler::Source::Path,
102
106
  PLUGIN => Bundler::Plugin,
103
107
  }.freeze
104
108
 
@@ -1,13 +1,13 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-ADD" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-ADD" "1" "January 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
8
8
  .
9
9
  .SH "SYNOPSIS"
10
- \fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-git=GIT] [\-\-github=GITHUB] [\-\-branch=BRANCH] [\-\-ref=REF] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
10
+ \fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-path=PATH] [\-\-git=GIT] [\-\-github=GITHUB] [\-\-branch=BRANCH] [\-\-ref=REF] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
11
11
  .
12
12
  .SH "DESCRIPTION"
13
13
  Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
@@ -41,10 +41,18 @@ Specify version requirements(s) for the added gem\.
41
41
  Specify the group(s) for the added gem\. Multiple groups should be separated by commas\.
42
42
  .
43
43
  .TP
44
- \fB\-\-source\fR, , \fB\-s\fR
44
+ \fB\-\-source\fR, \fB\-s\fR
45
45
  Specify the source for the added gem\.
46
46
  .
47
47
  .TP
48
+ \fB\-\-require\fR, \fB\-r\fR
49
+ Adds require path to gem\. Provide false, or a path as a string\.
50
+ .
51
+ .TP
52
+ \fB\-\-path\fR
53
+ Specify the file system path for the added gem\.
54
+ .
55
+ .TP
48
56
  \fB\-\-git\fR
49
57
  Specify the git source for the added gem\.
50
58
  .
@@ -66,9 +74,9 @@ Adds the gem to the Gemfile but does not install it\.
66
74
  .
67
75
  .TP
68
76
  \fB\-\-optimistic\fR
69
- Adds optimistic declaration of version
77
+ Adds optimistic declaration of version\.
70
78
  .
71
79
  .TP
72
80
  \fB\-\-strict\fR
73
- Adds strict declaration of version
81
+ Adds strict declaration of version\.
74
82
 
@@ -3,7 +3,7 @@ bundle-add(1) -- Add gem to the Gemfile and run bundle install
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--git=GIT] [--github=GITHUB] [--branch=BRANCH] [--ref=REF] [--skip-install] [--strict] [--optimistic]
6
+ `bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--path=PATH] [--git=GIT] [--github=GITHUB] [--branch=BRANCH] [--ref=REF] [--skip-install] [--strict] [--optimistic]
7
7
 
8
8
  ## DESCRIPTION
9
9
  Adds the named gem to the Gemfile and run `bundle install`. `bundle install` can be avoided by using the flag `--skip-install`.
@@ -27,9 +27,15 @@ bundle add rails --group "development, test"
27
27
  * `--group`, `-g`:
28
28
  Specify the group(s) for the added gem. Multiple groups should be separated by commas.
29
29
 
30
- * `--source`, , `-s`:
30
+ * `--source`, `-s`:
31
31
  Specify the source for the added gem.
32
32
 
33
+ * `--require`, `-r`:
34
+ Adds require path to gem. Provide false, or a path as a string.
35
+
36
+ * `--path`:
37
+ Specify the file system path for the added gem.
38
+
33
39
  * `--git`:
34
40
  Specify the git source for the added gem.
35
41
 
@@ -46,7 +52,7 @@ bundle add rails --group "development, test"
46
52
  Adds the gem to the Gemfile but does not install it.
47
53
 
48
54
  * `--optimistic`:
49
- Adds optimistic declaration of version
55
+ Adds optimistic declaration of version.
50
56
 
51
57
  * `--strict`:
52
- Adds strict declaration of version
58
+ Adds strict declaration of version.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-BINSTUBS" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-BINSTUBS" "1" "January 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CACHE" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-CACHE" "1" "January 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
@@ -9,6 +9,9 @@
9
9
  .SH "SYNOPSIS"
10
10
  \fBbundle cache\fR
11
11
  .
12
+ .P
13
+ alias: \fBpackage\fR, \fBpack\fR
14
+ .
12
15
  .SH "DESCRIPTION"
13
16
  Copy all of the \fB\.gem\fR files needed to run the application into the \fBvendor/cache\fR directory\. In the future, when running [bundle install(1)][bundle\-install], use the gems in the cache in preference to the ones on \fBrubygems\.org\fR\.
14
17
  .
@@ -53,3 +56,6 @@ One way to be sure that you have the right platformed versions of all your gems
53
56
  .
54
57
  .P
55
58
  By default, bundle cache(1) \fIbundle\-cache\.1\.html\fR fetches and also installs the gems to the default location\. To package the dependencies to \fBvendor/cache\fR without installing them to the local install location, you can run \fBbundle cache \-\-no\-install\fR\.
59
+ .
60
+ .SH "HISTORY"
61
+ In Bundler 2\.1, \fBcache\fR took in the functionalities of \fBpackage\fR and now \fBpackage\fR and \fBpack\fR are aliases of \fBcache\fR\.
@@ -5,6 +5,8 @@ bundle-cache(1) -- Package your needed `.gem` files into your application
5
5
 
6
6
  `bundle cache`
7
7
 
8
+ alias: `package`, `pack`
9
+
8
10
  ## DESCRIPTION
9
11
 
10
12
  Copy all of the `.gem` files needed to run the application into the
@@ -70,3 +72,8 @@ By default, [bundle cache(1)](bundle-cache.1.html) fetches and also
70
72
  installs the gems to the default location. To package the
71
73
  dependencies to `vendor/cache` without installing them to the
72
74
  local install location, you can run `bundle cache --no-install`.
75
+
76
+ ## HISTORY
77
+
78
+ In Bundler 2.1, `cache` took in the functionalities of `package` and now
79
+ `package` and `pack` are aliases of `cache`.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CHECK" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-CHECK" "1" "January 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CLEAN" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-CLEAN" "1" "January 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
@@ -20,5 +20,5 @@ Print the changes, but do not clean the unused gems\.
20
20
  .
21
21
  .TP
22
22
  \fB\-\-force\fR
23
- Force a clean even if \fB\-\-path\fR is not set\.
23
+ Forces cleaning up unused gems even if Bundler is configured to use globally installed gems\. As a consequence, removes all system gems except for the ones in the current application\.
24
24
 
@@ -15,4 +15,4 @@ useful when you have made many changes to your gem dependencies.
15
15
  * `--dry-run`:
16
16
  Print the changes, but do not clean the unused gems.
17
17
  * `--force`:
18
- Force a clean even if `--path` is not set.
18
+ Forces cleaning up unused gems even if Bundler is configured to use globally installed gems. As a consequence, removes all system gems except for the ones in the current application.
@@ -1,13 +1,22 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "BUNDLE\-CONFIG" "1" "March 2022" "" ""
4
+ .TH "BUNDLE\-CONFIG" "1" "January 2023" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-config\fR \- Set bundler configuration options
8
8
  .
9
9
  .SH "SYNOPSIS"
10
- \fBbundle config\fR [list|get|set|unset] [\fIname\fR [\fIvalue\fR]]
10
+ \fBbundle config\fR list
11
+ .
12
+ .br
13
+ \fBbundle config\fR [get] NAME
14
+ .
15
+ .br
16
+ \fBbundle config\fR [set] NAME VALUE
17
+ .
18
+ .br
19
+ \fBbundle config\fR unset NAME
11
20
  .
12
21
  .SH "DESCRIPTION"
13
22
  This command allows you to interact with Bundler\'s configuration system\.
@@ -30,7 +39,7 @@ Bundler default config
30
39
  .IP "" 0
31
40
  .
32
41
  .P
33
- Executing \fBbundle config list\fR with will print a list of all bundler configuration for the current bundle, and where that configuration was set\.
42
+ Executing \fBbundle config list\fR will print a list of all bundler configuration for the current bundle, and where that configuration was set\.
34
43
  .
35
44
  .P
36
45
  Executing \fBbundle config get <name>\fR will print the value of that configuration setting, and where it was set\.
@@ -51,7 +60,7 @@ Executing \fBbundle config unset <name>\fR will delete the configuration in both
51
60
  Executing \fBbundle config unset \-\-global <name>\fR will delete the configuration only from the user configuration\.
52
61
  .
53
62
  .P
54
- Executing \fBbundle config unset \-\-local <name> <value>\fR will delete the configuration only from the local application\.
63
+ Executing \fBbundle config unset \-\-local <name>\fR will delete the configuration only from the local application\.
55
64
  .
56
65
  .P
57
66
  Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
@@ -74,6 +83,10 @@ Creates a directory (defaults to \fB~/bin\fR) and place any executables from the
74
83
  In deployment mode, Bundler will \'roll\-out\' the bundle for \fBproduction\fR use\. Please check carefully if you want to have this option enabled in \fBdevelopment\fR or \fBtest\fR environments\.
75
84
  .
76
85
  .TP
86
+ \fBonly\fR
87
+ A space\-separated list of groups to install only gems of the specified groups\.
88
+ .
89
+ .TP
77
90
  \fBpath\fR
78
91
  The location to install the specified gems to\. This defaults to Rubygems\' setting\. Bundler shares this location with Rubygems, \fBgem install \.\.\.\fR will have gem installed there, too\. Therefore, gems installed without a \fB\-\-path \.\.\.\fR setting will show up by calling \fBgem list\fR\. Accordingly, gems installed to other locations will not get listed\.
79
92
  .
@@ -205,6 +218,9 @@ The following is a list of all configuration keys and their purpose\. You can le
205
218
  \fBglobal_gem_cache\fR (\fBBUNDLE_GLOBAL_GEM_CACHE\fR): Whether Bundler should cache all gems globally, rather than locally to the installing Ruby installation\.
206
219
  .
207
220
  .IP "\(bu" 4
221
+ \fBignore_funding_requests\fR (\fBBUNDLE_IGNORE_FUNDING_REQUESTS\fR): When set, no funding requests will be printed\.
222
+ .
223
+ .IP "\(bu" 4
208
224
  \fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\.
209
225
  .
210
226
  .IP "\(bu" 4
@@ -220,6 +236,9 @@ The following is a list of all configuration keys and their purpose\. You can le
220
236
  \fBno_prune\fR (\fBBUNDLE_NO_PRUNE\fR): Whether Bundler should leave outdated gems unpruned when caching\.
221
237
  .
222
238
  .IP "\(bu" 4
239
+ \fBonly\fR (\fBBUNDLE_ONLY\fR): A space\-separated list of groups to install only gems of the specified groups\.
240
+ .
241
+ .IP "\(bu" 4
223
242
  \fBpath\fR (\fBBUNDLE_PATH\fR): The location on disk where all gems in your bundle will be located regardless of \fB$GEM_HOME\fR or \fB$GEM_PATH\fR values\. Bundle gems not found in this location will be installed by \fBbundle install\fR\. Defaults to \fBGem\.dir\fR\. When \-\-deployment is used, defaults to vendor/bundle\.
224
243
  .
225
244
  .IP "\(bu" 4
@@ -288,7 +307,7 @@ The following is a list of all configuration keys and their purpose\. You can le
288
307
  .IP "" 0
289
308
  .
290
309
  .P
291
- In general, you should set these settings per\-application by using the applicable flag to the bundle install(1) \fIbundle\-install\.1\.html\fR or bundle package(1) \fIbundle\-package\.1\.html\fR command\.
310
+ In general, you should set these settings per\-application by using the applicable flag to the bundle install(1) \fIbundle\-install\.1\.html\fR or bundle cache(1) \fIbundle\-cache\.1\.html\fR command\.
292
311
  .
293
312
  .P
294
313
  You can set them globally either via environment variables or \fBbundle config\fR, whichever is preferable for your setup\. If you use both, environment variables will take preference over global settings\.
@@ -342,13 +361,13 @@ bundle config set \-\-global mirror\.SOURCE_URL MIRROR_URL
342
361
  .IP "" 0
343
362
  .
344
363
  .P
345
- For example, to use a mirror of rubygems\.org hosted at rubygems\-mirror\.org:
364
+ For example, to use a mirror of https://rubygems\.org hosted at https://example\.org:
346
365
  .
347
366
  .IP "" 4
348
367
  .
349
368
  .nf
350
369
 
351
- bundle config set \-\-global mirror\.http://rubygems\.org http://rubygems\-mirror\.org
370
+ bundle config set \-\-global mirror\.https://rubygems\.org https://example\.org
352
371
  .
353
372
  .fi
354
373
  .