bundler 2.2.26 → 2.3.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +501 -1
  3. data/README.md +1 -1
  4. data/bundler.gemspec +6 -8
  5. data/exe/bundle +7 -8
  6. data/exe/bundler +1 -1
  7. data/lib/bundler/.document +1 -0
  8. data/lib/bundler/build_metadata.rb +3 -3
  9. data/lib/bundler/cli/check.rb +1 -1
  10. data/lib/bundler/cli/common.rb +3 -2
  11. data/lib/bundler/cli/config.rb +10 -1
  12. data/lib/bundler/cli/doctor.rb +12 -3
  13. data/lib/bundler/cli/gem.rb +98 -9
  14. data/lib/bundler/cli/info.rb +27 -6
  15. data/lib/bundler/cli/init.rb +5 -1
  16. data/lib/bundler/cli/install.rb +13 -30
  17. data/lib/bundler/cli/issue.rb +4 -3
  18. data/lib/bundler/cli/outdated.rb +12 -3
  19. data/lib/bundler/cli/platform.rb +2 -2
  20. data/lib/bundler/cli/remove.rb +1 -2
  21. data/lib/bundler/cli/show.rb +1 -1
  22. data/lib/bundler/cli/update.rb +8 -4
  23. data/lib/bundler/cli.rb +23 -19
  24. data/lib/bundler/compact_index_client/cache.rb +0 -9
  25. data/lib/bundler/compact_index_client/updater.rb +16 -8
  26. data/lib/bundler/compact_index_client.rb +2 -8
  27. data/lib/bundler/current_ruby.rb +16 -6
  28. data/lib/bundler/definition.rb +204 -217
  29. data/lib/bundler/dependency.rb +23 -71
  30. data/lib/bundler/digest.rb +71 -0
  31. data/lib/bundler/dsl.rb +28 -45
  32. data/lib/bundler/endpoint_specification.rb +19 -13
  33. data/lib/bundler/env.rb +1 -1
  34. data/lib/bundler/environment_preserver.rb +4 -1
  35. data/lib/bundler/errors.rb +28 -2
  36. data/lib/bundler/feature_flag.rb +0 -1
  37. data/lib/bundler/fetcher/base.rb +6 -8
  38. data/lib/bundler/fetcher/compact_index.rb +9 -14
  39. data/lib/bundler/fetcher/index.rb +0 -26
  40. data/lib/bundler/fetcher.rb +20 -22
  41. data/lib/bundler/friendly_errors.rb +26 -34
  42. data/lib/bundler/gem_helper.rb +7 -18
  43. data/lib/bundler/gem_helpers.rb +9 -2
  44. data/lib/bundler/gem_version_promoter.rb +14 -25
  45. data/lib/bundler/index.rb +10 -40
  46. data/lib/bundler/injector.rb +16 -2
  47. data/lib/bundler/inline.rb +2 -12
  48. data/lib/bundler/installer/gem_installer.rb +13 -5
  49. data/lib/bundler/installer/standalone.rb +30 -3
  50. data/lib/bundler/installer.rb +18 -29
  51. data/lib/bundler/lazy_specification.rb +52 -35
  52. data/lib/bundler/lockfile_generator.rb +2 -2
  53. data/lib/bundler/lockfile_parser.rb +12 -10
  54. data/lib/bundler/man/bundle-add.1 +21 -5
  55. data/lib/bundler/man/bundle-add.1.ronn +16 -4
  56. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  57. data/lib/bundler/man/bundle-cache.1 +7 -1
  58. data/lib/bundler/man/bundle-cache.1.ronn +7 -0
  59. data/lib/bundler/man/bundle-check.1 +1 -1
  60. data/lib/bundler/man/bundle-clean.1 +2 -2
  61. data/lib/bundler/man/bundle-clean.1.ronn +1 -1
  62. data/lib/bundler/man/bundle-config.1 +33 -14
  63. data/lib/bundler/man/bundle-config.1.ronn +30 -18
  64. data/lib/bundler/man/bundle-console.1 +53 -0
  65. data/lib/bundler/man/bundle-console.1.ronn +44 -0
  66. data/lib/bundler/man/bundle-doctor.1 +1 -1
  67. data/lib/bundler/man/bundle-exec.1 +2 -2
  68. data/lib/bundler/man/bundle-exec.1.ronn +1 -1
  69. data/lib/bundler/man/bundle-gem.1 +14 -1
  70. data/lib/bundler/man/bundle-gem.1.ronn +16 -0
  71. data/lib/bundler/man/bundle-help.1 +13 -0
  72. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  73. data/lib/bundler/man/bundle-info.1 +1 -1
  74. data/lib/bundler/man/bundle-init.1 +1 -1
  75. data/lib/bundler/man/bundle-inject.1 +5 -2
  76. data/lib/bundler/man/bundle-inject.1.ronn +3 -1
  77. data/lib/bundler/man/bundle-install.1 +6 -2
  78. data/lib/bundler/man/bundle-install.1.ronn +8 -2
  79. data/lib/bundler/man/bundle-list.1 +1 -1
  80. data/lib/bundler/man/bundle-lock.1 +1 -1
  81. data/lib/bundler/man/bundle-open.1 +1 -1
  82. data/lib/bundler/man/bundle-outdated.1 +3 -10
  83. data/lib/bundler/man/bundle-outdated.1.ronn +1 -10
  84. data/lib/bundler/man/bundle-platform.1 +16 -6
  85. data/lib/bundler/man/bundle-platform.1.ronn +14 -7
  86. data/lib/bundler/man/bundle-plugin.1 +81 -0
  87. data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
  88. data/lib/bundler/man/bundle-pristine.1 +1 -1
  89. data/lib/bundler/man/bundle-remove.1 +1 -1
  90. data/lib/bundler/man/bundle-show.1 +1 -1
  91. data/lib/bundler/man/bundle-update.1 +2 -2
  92. data/lib/bundler/man/bundle-update.1.ronn +2 -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 +117 -80
  100. data/lib/bundler/man/gemfile.5.ronn +105 -84
  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/plugin/api/source.rb +4 -9
  106. data/lib/bundler/plugin/installer/git.rb +0 -4
  107. data/lib/bundler/plugin/installer/rubygems.rb +0 -4
  108. data/lib/bundler/plugin/installer.rb +3 -1
  109. data/lib/bundler/plugin.rb +25 -6
  110. data/lib/bundler/process_lock.rb +1 -1
  111. data/lib/bundler/remote_specification.rb +10 -4
  112. data/lib/bundler/resolver/base.rb +50 -0
  113. data/lib/bundler/resolver/spec_group.rb +31 -49
  114. data/lib/bundler/resolver.rb +183 -192
  115. data/lib/bundler/ruby_dsl.rb +1 -1
  116. data/lib/bundler/ruby_version.rb +5 -18
  117. data/lib/bundler/rubygems_ext.rb +138 -20
  118. data/lib/bundler/rubygems_gem_installer.rb +42 -16
  119. data/lib/bundler/rubygems_integration.rb +42 -90
  120. data/lib/bundler/runtime.rb +2 -3
  121. data/lib/bundler/self_manager.rb +168 -0
  122. data/lib/bundler/settings.rb +13 -4
  123. data/lib/bundler/shared_helpers.rb +15 -24
  124. data/lib/bundler/source/git/git_proxy.rb +7 -4
  125. data/lib/bundler/source/git.rb +29 -13
  126. data/lib/bundler/source/metadata.rb +3 -3
  127. data/lib/bundler/source/path.rb +1 -1
  128. data/lib/bundler/source/rubygems.rb +148 -161
  129. data/lib/bundler/source/rubygems_aggregate.rb +1 -1
  130. data/lib/bundler/source.rb +6 -5
  131. data/lib/bundler/source_list.rb +15 -29
  132. data/lib/bundler/source_map.rb +15 -2
  133. data/lib/bundler/spec_set.rb +52 -32
  134. data/lib/bundler/stub_specification.rb +5 -3
  135. data/lib/bundler/templates/Executable +2 -4
  136. data/lib/bundler/templates/Executable.bundler +2 -2
  137. data/lib/bundler/templates/Executable.standalone +2 -4
  138. data/lib/bundler/templates/Gemfile +0 -2
  139. data/lib/bundler/templates/gems.rb +0 -3
  140. data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
  141. data/lib/bundler/templates/newgem/README.md.tt +3 -9
  142. data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
  143. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +5 -4
  144. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +5 -4
  145. data/lib/bundler/templates/newgem/newgem.gemspec.tt +16 -16
  146. data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
  147. data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
  148. data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
  149. data/lib/bundler/ui/shell.rb +1 -1
  150. data/lib/bundler/vendor/.document +1 -0
  151. data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
  152. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
  153. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  154. data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
  155. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
  156. data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
  157. data/lib/bundler/vendor/molinillo/LICENSE +9 -0
  158. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -3
  159. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +32 -26
  160. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  161. data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
  162. data/lib/bundler/vendor/thor/LICENSE.md +20 -0
  163. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
  164. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
  165. data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
  166. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
  167. data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
  168. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
  169. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
  170. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  171. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  172. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  173. data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
  174. data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
  175. data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
  176. data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
  177. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
  178. data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
  179. data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
  180. data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
  181. data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
  182. data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
  183. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
  184. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
  185. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  186. data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
  187. data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
  188. data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
  189. data/lib/bundler/vendored_tsort.rb +4 -0
  190. data/lib/bundler/version.rb +1 -1
  191. data/lib/bundler/worker.rb +2 -2
  192. data/lib/bundler.rb +40 -29
  193. metadata +37 -12
  194. data/lib/bundler/dep_proxy.rb +0 -55
  195. data/lib/bundler/gemdeps.rb +0 -29
  196. data/lib/bundler/psyched_yaml.rb +0 -22
  197. data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -12,6 +12,7 @@ module Bundler
12
12
  end
13
13
  File.open File.join(bundler_path, "setup.rb"), "w" do |file|
14
14
  file.puts "require 'rbconfig'"
15
+ file.puts define_path_helpers
15
16
  file.puts reverse_rubygems_kernel_mixin
16
17
  paths.each do |path|
17
18
  if Pathname.new(path).absolute?
@@ -29,18 +30,24 @@ module Bundler
29
30
  @specs.map do |spec|
30
31
  next if spec.name == "bundler"
31
32
  Array(spec.require_paths).map do |path|
32
- gem_path(path, spec).sub(version_dir, '#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}')
33
+ gem_path(path, spec).
34
+ sub(version_dir, '#{RUBY_ENGINE}/#{Gem.ruby_api_version}').
35
+ sub(extensions_dir, 'extensions/\k<platform>/#{Gem.extension_api_version}')
33
36
  # This is a static string intentionally. It's interpolated at a later time.
34
37
  end
35
38
  end.flatten.compact
36
39
  end
37
40
 
38
41
  def version_dir
39
- "#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}"
42
+ "#{RUBY_ENGINE}/#{Gem.ruby_api_version}"
43
+ end
44
+
45
+ def extensions_dir
46
+ %r{extensions/(?<platform>[^/]+)/#{Regexp.escape(Gem.extension_api_version)}}
40
47
  end
41
48
 
42
49
  def bundler_path
43
- Bundler.root.join(Bundler.settings[:path], "bundler")
50
+ Bundler.root.join(Bundler.settings[:path].to_s, "bundler")
44
51
  end
45
52
 
46
53
  def gem_path(path, spec)
@@ -55,6 +62,26 @@ module Bundler
55
62
  raise Gem::InvalidSpecificationException.new(error_message)
56
63
  end
57
64
 
65
+ def define_path_helpers
66
+ <<~'END'
67
+ unless defined?(Gem)
68
+ module Gem
69
+ def self.ruby_api_version
70
+ RbConfig::CONFIG["ruby_version"]
71
+ end
72
+
73
+ def self.extension_api_version
74
+ if 'no' == RbConfig::CONFIG['ENABLE_SHARED']
75
+ "#{ruby_api_version}-static"
76
+ else
77
+ ruby_api_version
78
+ end
79
+ end
80
+ end
81
+ end
82
+ END
83
+ end
84
+
58
85
  def reverse_rubygems_kernel_mixin
59
86
  <<~END
60
87
  kernel = (class << ::Kernel; self; end)
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rubygems/dependency_installer"
4
3
  require_relative "worker"
5
4
  require_relative "installer/parallel_installer"
6
5
  require_relative "installer/standalone"
@@ -14,7 +13,7 @@ module Bundler
14
13
  Installer.ambiguous_gems = []
15
14
  end
16
15
 
17
- attr_reader :post_install_messages
16
+ attr_reader :post_install_messages, :definition
18
17
 
19
18
  # Begins the installation process for Bundler.
20
19
  # For more information see the #run method on this class.
@@ -67,7 +66,7 @@ module Bundler
67
66
  # require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
68
67
  # information.
69
68
  def run(options)
70
- create_bundle_path
69
+ Bundler.create_bundle_path
71
70
 
72
71
  ProcessLock.lock do
73
72
  if Bundler.frozen_bundle?
@@ -120,7 +119,7 @@ module Bundler
120
119
  relative_gemfile_path = relative_gemfile_path
121
120
  ruby_command = Thor::Util.ruby_command
122
121
  ruby_command = ruby_command
123
- template_path = File.expand_path("../templates/Executable", __FILE__)
122
+ template_path = File.expand_path("templates/Executable", __dir__)
124
123
  if spec.name == "bundler"
125
124
  template_path += ".bundler"
126
125
  spec.executables = %(bundle)
@@ -173,7 +172,7 @@ module Bundler
173
172
  end
174
173
  standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
175
174
  standalone_path = standalone_path
176
- template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__))
175
+ template = File.read(File.expand_path("templates/Executable.standalone", __dir__))
177
176
  ruby_command = Thor::Util.ruby_command
178
177
  ruby_command = ruby_command
179
178
 
@@ -219,9 +218,6 @@ module Bundler
219
218
  return jobs
220
219
  end
221
220
 
222
- # Parallelization has some issues on Windows, so it's not yet the default
223
- return 1 if Gem.win_platform?
224
-
225
221
  Bundler.settings.processor_count
226
222
  end
227
223
 
@@ -242,19 +238,14 @@ module Bundler
242
238
  end
243
239
 
244
240
  def ensure_specs_are_compatible!
245
- system_ruby = Bundler::RubyVersion.system
246
- rubygems_version = Gem::Version.create(Gem::VERSION)
247
241
  @definition.specs.each do |spec|
248
- if required_ruby_version = spec.required_ruby_version
249
- unless required_ruby_version.satisfied_by?(system_ruby.gem_version)
250
- raise InstallError, "#{spec.full_name} requires ruby version #{required_ruby_version}, " \
251
- "which is incompatible with the current version, #{system_ruby}"
252
- end
242
+ unless spec.matches_current_ruby?
243
+ raise InstallError, "#{spec.full_name} requires ruby version #{spec.required_ruby_version}, " \
244
+ "which is incompatible with the current version, #{Gem.ruby_version}"
253
245
  end
254
- next unless required_rubygems_version = spec.required_rubygems_version
255
- unless required_rubygems_version.satisfied_by?(rubygems_version)
256
- raise InstallError, "#{spec.full_name} requires rubygems version #{required_rubygems_version}, " \
257
- "which is incompatible with the current version, #{rubygems_version}"
246
+ unless spec.matches_current_rubygems?
247
+ raise InstallError, "#{spec.full_name} requires rubygems version #{spec.required_rubygems_version}, " \
248
+ "which is incompatible with the current version, #{Gem.rubygems_version}"
258
249
  end
259
250
  end
260
251
  end
@@ -266,22 +257,20 @@ module Bundler
266
257
  end
267
258
  end
268
259
 
269
- def create_bundle_path
270
- SharedHelpers.filesystem_access(Bundler.bundle_path.to_s) do |p|
271
- Bundler.mkdir_p(p)
272
- end unless Bundler.bundle_path.exist?
273
- rescue Errno::EEXIST
274
- raise PathError, "Could not install to path `#{Bundler.bundle_path}` " \
275
- "because a file already exists at that path. Either remove or rename the file so the directory can be created."
276
- end
277
-
278
260
  # returns whether or not a re-resolve was needed
279
261
  def resolve_if_needed(options)
280
262
  if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
281
263
  return false if @definition.nothing_changed? && !@definition.missing_specs?
282
264
  end
283
265
 
284
- options["local"] ? @definition.resolve_with_cache! : @definition.resolve_remotely!
266
+ if options["local"]
267
+ @definition.resolve_with_cache!
268
+ elsif options["prefer-local"]
269
+ @definition.resolve_prefering_local!
270
+ else
271
+ @definition.resolve_remotely!
272
+ end
273
+
285
274
  true
286
275
  end
287
276
 
@@ -1,13 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "match_platform"
4
-
5
3
  module Bundler
6
4
  class LazySpecification
7
5
  include MatchPlatform
8
6
 
9
7
  attr_reader :name, :version, :dependencies, :platform
10
- attr_accessor :source, :remote
8
+ attr_accessor :source, :remote, :force_ruby_platform
11
9
 
12
10
  def initialize(name, version, platform, source = nil)
13
11
  @name = name
@@ -19,7 +17,7 @@ module Bundler
19
17
  end
20
18
 
21
19
  def full_name
22
- if platform == Gem::Platform::RUBY || platform.nil?
20
+ if platform == Gem::Platform::RUBY
23
21
  "#{@name}-#{@version}"
24
22
  else
25
23
  "#{@name}-#{@version}-#{platform}"
@@ -38,14 +36,30 @@ module Bundler
38
36
  identifier.hash
39
37
  end
40
38
 
39
+ ##
40
+ # Does this locked specification satisfy +dependency+?
41
+ #
42
+ # NOTE: Rubygems default requirement is ">= 0", which doesn't match
43
+ # prereleases of 0 versions, like "0.0.0.dev" or "0.0.0.SNAPSHOT". However,
44
+ # bundler users expect those to work. We need to make sure that Gemfile
45
+ # dependencies without explicit requirements (which use ">= 0" under the
46
+ # hood by default) are still valid for locked specs using this kind of
47
+ # versions. The method implements an ad-hoc fix for that. A better solution
48
+ # might be to change default rubygems requirement of dependencies to be ">=
49
+ # 0.A" but that's a major refactoring likely to break things. Hopefully we
50
+ # can attempt it in the future.
51
+ #
52
+
41
53
  def satisfies?(dependency)
42
- @name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
54
+ effective_requirement = dependency.requirement == Gem::Requirement.default ? Gem::Requirement.new(">= 0.A") : dependency.requirement
55
+
56
+ @name == dependency.name && effective_requirement.satisfied_by?(Gem::Version.new(@version))
43
57
  end
44
58
 
45
59
  def to_lock
46
60
  out = String.new
47
61
 
48
- if platform == Gem::Platform::RUBY || platform.nil?
62
+ if platform == Gem::Platform::RUBY
49
63
  out << " #{name} (#{version})\n"
50
64
  else
51
65
  out << " #{name} (#{version}-#{platform})\n"
@@ -59,27 +73,34 @@ module Bundler
59
73
  out
60
74
  end
61
75
 
62
- def __materialize__
63
- @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
64
- source.gemspec.tap {|s| s.source = source }
76
+ def materialize_for_installation
77
+ source.local!
78
+
79
+ candidates = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
80
+ target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform
81
+
82
+ GemHelpers.select_best_platform_match(source.specs.search(Dependency.new(name, version)), target_platform)
65
83
  else
66
- search_object = if source.is_a?(Source::Path)
67
- Dependency.new(name, version)
68
- else
69
- ruby_platform_materializes_to_ruby_platform? ? self : Dependency.new(name, version)
70
- end
71
- platform_object = Gem::Platform.new(platform)
72
- candidates = source.specs.search(search_object)
73
- same_platform_candidates = candidates.select do |spec|
74
- MatchPlatform.platforms_match?(spec.platform, platform_object)
84
+ source.specs.search(self)
85
+ end
86
+
87
+ return self if candidates.empty?
88
+
89
+ __materialize__(candidates)
90
+ end
91
+
92
+ def __materialize__(candidates)
93
+ @specification = begin
94
+ search = candidates.reverse.find do |spec|
95
+ spec.is_a?(StubSpecification) ||
96
+ (spec.matches_current_ruby? &&
97
+ spec.matches_current_rubygems?)
75
98
  end
76
- installable_candidates = same_platform_candidates.select do |spec|
77
- !spec.is_a?(EndpointSpecification) ||
78
- (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
79
- spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
99
+ if search.nil? && Bundler.frozen_bundle?
100
+ search = candidates.last
101
+ else
102
+ search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
80
103
  end
81
- search = installable_candidates.last || same_platform_candidates.last
82
- search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
83
104
  search
84
105
  end
85
106
  end
@@ -89,7 +110,7 @@ module Bundler
89
110
  end
90
111
 
91
112
  def to_s
92
- @__to_s ||= if platform == Gem::Platform::RUBY || platform.nil?
113
+ @__to_s ||= if platform == Gem::Platform::RUBY
93
114
  "#{name} (#{version})"
94
115
  else
95
116
  "#{name} (#{version}-#{platform})"
@@ -97,7 +118,7 @@ module Bundler
97
118
  end
98
119
 
99
120
  def identifier
100
- @__identifier ||= [name, version, platform_string]
121
+ @__identifier ||= [name, version, platform.to_s]
101
122
  end
102
123
 
103
124
  def git_version
@@ -105,13 +126,6 @@ module Bundler
105
126
  " #{source.revision[0..6]}"
106
127
  end
107
128
 
108
- protected
109
-
110
- def platform_string
111
- platform_string = platform.to_s
112
- platform_string == Index::RUBY ? Index::NULL : platform_string
113
- end
114
-
115
129
  private
116
130
 
117
131
  def to_ary
@@ -128,7 +142,8 @@ module Bundler
128
142
 
129
143
  #
130
144
  # For backwards compatibility with existing lockfiles, if the most specific
131
- # locked platform is RUBY, we keep the previous behaviour of resolving the
145
+ # locked platform is not a specific platform like x86_64-linux or
146
+ # universal-java-11, then we keep the previous behaviour of resolving the
132
147
  # best platform variant at materiliazation time. For previous bundler
133
148
  # versions (before 2.2.0) this was always the case (except when the lockfile
134
149
  # only included non-ruby platforms), but we're also keeping this behaviour
@@ -136,7 +151,9 @@ module Bundler
136
151
  # explicitly add a more specific platform.
137
152
  #
138
153
  def ruby_platform_materializes_to_ruby_platform?
139
- !Bundler.most_specific_locked_platform?(Gem::Platform::RUBY) || Bundler.settings[:force_ruby_platform]
154
+ generic_platform = generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY
155
+
156
+ !Bundler.most_specific_locked_platform?(generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
140
157
  end
141
158
  end
142
159
  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
@@ -71,7 +71,7 @@ module Bundler
71
71
  end
72
72
 
73
73
  def add_bundled_with
74
- add_section("BUNDLED WITH", definition.locked_bundler_version.to_s)
74
+ add_section("BUNDLED WITH", Bundler::VERSION)
75
75
  end
76
76
 
77
77
  def add_section(name, value)
@@ -46,6 +46,16 @@ module Bundler
46
46
  attributes
47
47
  end
48
48
 
49
+ def self.bundled_with
50
+ lockfile = Bundler.default_lockfile
51
+ return unless lockfile.file?
52
+
53
+ lockfile_contents = Bundler.read_file(lockfile)
54
+ return unless lockfile_contents.include?(BUNDLED)
55
+
56
+ lockfile_contents.split(BUNDLED).last.strip
57
+ end
58
+
49
59
  def initialize(lockfile)
50
60
  @platforms = []
51
61
  @sources = []
@@ -77,22 +87,14 @@ module Bundler
77
87
  end
78
88
  end
79
89
  @specs = @specs.values.sort_by(&:identifier)
80
- warn_for_outdated_bundler_version
81
90
  rescue ArgumentError => e
82
91
  Bundler.ui.debug(e)
83
92
  raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \
84
93
  "and then `bundle install` to generate a new lockfile."
85
94
  end
86
95
 
87
- def warn_for_outdated_bundler_version
88
- return unless bundler_version
89
- prerelease_text = bundler_version.prerelease? ? " --pre" : ""
90
- current_version = Gem::Version.create(Bundler::VERSION)
91
- return unless current_version < bundler_version
92
- Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \
93
- "than the version that created the lockfile (#{bundler_version}). We suggest you to " \
94
- "upgrade to the version that created the lockfile by running `gem install " \
95
- "bundler:#{bundler_version}#{prerelease_text}`.\n"
96
+ def may_include_redundant_platform_specific_gems?
97
+ bundler_version.nil? || bundler_version < Gem::Version.new("1.16.2")
96
98
  end
97
99
 
98
100
  private
@@ -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" "June 2021" "" ""
4
+ .TH "BUNDLE\-ADD" "1" "October 2022" "" ""
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] [\-\-branch=BRANCH] [\-\-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,26 +41,42 @@ 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
  .
51
59
  .TP
60
+ \fB\-\-github\fR
61
+ Specify the github source for the added gem\.
62
+ .
63
+ .TP
52
64
  \fB\-\-branch\fR
53
65
  Specify the git branch for the added gem\.
54
66
  .
55
67
  .TP
68
+ \fB\-\-ref\fR
69
+ Specify the git ref for the added gem\.
70
+ .
71
+ .TP
56
72
  \fB\-\-skip\-install\fR
57
73
  Adds the gem to the Gemfile but does not install it\.
58
74
  .
59
75
  .TP
60
76
  \fB\-\-optimistic\fR
61
- Adds optimistic declaration of version
77
+ Adds optimistic declaration of version\.
62
78
  .
63
79
  .TP
64
80
  \fB\-\-strict\fR
65
- Adds strict declaration of version
81
+ Adds strict declaration of version\.
66
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] [--branch=BRANCH] [--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,20 +27,32 @@ 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
 
42
+ * `--github`:
43
+ Specify the github source for the added gem.
44
+
36
45
  * `--branch`:
37
46
  Specify the git branch for the added gem.
38
47
 
48
+ * `--ref`:
49
+ Specify the git ref for the added gem.
50
+
39
51
  * `--skip-install`:
40
52
  Adds the gem to the Gemfile but does not install it.
41
53
 
42
54
  * `--optimistic`:
43
- Adds optimistic declaration of version
55
+ Adds optimistic declaration of version.
44
56
 
45
57
  * `--strict`:
46
- 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" "June 2021" "" ""
4
+ .TH "BUNDLE\-BINSTUBS" "1" "October 2022" "" ""
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" "June 2021" "" ""
4
+ .TH "BUNDLE\-CACHE" "1" "October 2022" "" ""
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" "June 2021" "" ""
4
+ .TH "BUNDLE\-CHECK" "1" "October 2022" "" ""
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" "June 2021" "" ""
4
+ .TH "BUNDLE\-CLEAN" "1" "October 2022" "" ""
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.