bundler 2.3.10 → 2.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d04e4256fa8e51a0169e749dac69ace323715bd6baf4f8d0b41030eecd096a45
4
- data.tar.gz: 58d03cf0bae41f3934eb6d2ced1b90d60b996ba0cb5a3400a8090218b9f2a978
3
+ metadata.gz: bcf48063fd68ff2303185f1bb117dcb52395cfdbc622d9a41dfc658115b196eb
4
+ data.tar.gz: 28a397130a9eb30ec877e7563cecccf29e8a1d849096028a6c49eb7ddd48ebd6
5
5
  SHA512:
6
- metadata.gz: 251af0c8ded951fa452b748f7bc179b575f970e07d6e6bb6668afa17ba2e60190652fb7b5e7f4da4530421467f809fbde015ff8c372922c119a0caf24aa9ac7c
7
- data.tar.gz: 77abe76f6b7a9acc862705adc601d09b3fc9f34a5b7f862952796ea45b89024a5b8fdda7cf4faf4dbf7934c77fc7d465906645be1dfc76eb89034ec89b8e0b44
6
+ metadata.gz: 8e1ef096a5444ba67c2b3d89ad91f6e26df973c18793c41b96ff2797ca15be596df5e6bd0c78a9e17d9078d30f5e348bcc17cde5d76bb1ce2534f3247716538f
7
+ data.tar.gz: 2ab4b43b9863888cb4515a5305b1fcbcb5eb4fa5e4f9aaa27c8202ad0de0a210dbf3304318728514436513060e950a8bfbad0c849f6ae73ac61eac120b36d644
data/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ # 2.3.13 (May 4, 2022)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix missing required rubygems version when using old APIs [#5496](https://github.com/rubygems/rubygems/pull/5496)
6
+ - Fix crash when gem used twice in Gemfile under different platforms [#5187](https://github.com/rubygems/rubygems/pull/5187)
7
+
8
+ ## Performance:
9
+
10
+ - Speed up `bundler/setup` time [#5503](https://github.com/rubygems/rubygems/pull/5503)
11
+
12
+ # 2.3.12 (April 20, 2022)
13
+
14
+ ## Enhancements:
15
+
16
+ - Improve Ruby version resolution conflicts [#5474](https://github.com/rubygems/rubygems/pull/5474)
17
+ - Stop considering `RUBY_PATCHLEVEL` for resolution [#5472](https://github.com/rubygems/rubygems/pull/5472)
18
+ - Add modern rubies as valid platform values in Gemfile DSL [#5469](https://github.com/rubygems/rubygems/pull/5469)
19
+
20
+ # 2.3.11 (April 7, 2022)
21
+
22
+ ## Enhancements:
23
+
24
+ - Bump actions/checkout to 3 in bundler gem template [#5445](https://github.com/rubygems/rubygems/pull/5445)
25
+ - Prefer `__dir__` to `__FILE__` [#5444](https://github.com/rubygems/rubygems/pull/5444)
26
+
27
+ ## Documentation:
28
+
29
+ - Update bundler documentation to reflect bundle config scope changes [#5441](https://github.com/rubygems/rubygems/pull/5441)
30
+
1
31
  # 2.3.10 (March 23, 2022)
2
32
 
3
33
  ## Enhancements:
data/exe/bundler CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- load File.expand_path("../bundle", __FILE__)
4
+ load File.expand_path("bundle", __dir__)
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2022-03-23".freeze
8
- @git_commit_sha = "4bbb70e7de".freeze
7
+ @built_at = "2022-05-04".freeze
8
+ @git_commit_sha = "b20be5a433".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -29,7 +29,7 @@ module Bundler
29
29
 
30
30
  # If Bundler has been installed without its .git directory and without a
31
31
  # commit instance variable then we can't determine its commits SHA.
32
- git_dir = File.join(File.expand_path("../../../..", __FILE__), ".git")
32
+ git_dir = File.expand_path("../../../.git", __dir__)
33
33
  if File.directory?(git_dir)
34
34
  return @git_commit_sha = Dir.chdir(git_dir) { `git rev-parse --short HEAD`.strip.freeze }
35
35
  end
@@ -47,7 +47,7 @@ module Bundler
47
47
  def print_gem_path(spec)
48
48
  name = spec.name
49
49
  if name == "bundler"
50
- path = File.expand_path("../../../..", __FILE__)
50
+ path = File.expand_path("../../..", __dir__)
51
51
  else
52
52
  path = spec.full_gem_path
53
53
  if spec.deleted_gem?
@@ -32,7 +32,7 @@ module Bundler
32
32
  file << spec.to_gemfile
33
33
  end
34
34
  else
35
- FileUtils.cp(File.expand_path("../../templates/#{gemfile}", __FILE__), gemfile)
35
+ FileUtils.cp(File.expand_path("../templates/#{gemfile}", __dir__), gemfile)
36
36
  end
37
37
 
38
38
  puts "Writing new #{gemfile} to #{SharedHelpers.pwd}/#{gemfile}"
@@ -18,7 +18,7 @@ module Bundler
18
18
 
19
19
  if gem_name
20
20
  if gem_name == "bundler"
21
- path = File.expand_path("../../../..", __FILE__)
21
+ path = File.expand_path("../../..", __dir__)
22
22
  else
23
23
  spec = Bundler::CLI::Common.select_spec(gem_name, :regex_match)
24
24
  return unless spec
data/lib/bundler/cli.rb CHANGED
@@ -610,7 +610,7 @@ module Bundler
610
610
  private :gem
611
611
 
612
612
  def self.source_root
613
- File.expand_path(File.join(File.dirname(__FILE__), "templates"))
613
+ File.expand_path("templates", __dir__)
614
614
  end
615
615
 
616
616
  desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory", :hide => true
@@ -21,6 +21,7 @@ module Bundler
21
21
  2.6
22
22
  2.7
23
23
  3.0
24
+ 3.1
24
25
  ].freeze
25
26
 
26
27
  KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
@@ -87,10 +87,11 @@ module Bundler
87
87
  @platforms = @locked_platforms.dup
88
88
  @locked_bundler_version = @locked_gems.bundler_version
89
89
  @locked_ruby_version = @locked_gems.ruby_version
90
+ @originally_locked_specs = SpecSet.new(@locked_gems.specs)
90
91
 
91
92
  if unlock != true
92
93
  @locked_deps = @locked_gems.dependencies
93
- @locked_specs = SpecSet.new(@locked_gems.specs)
94
+ @locked_specs = @originally_locked_specs
94
95
  @locked_sources = @locked_gems.sources
95
96
  else
96
97
  @unlock = {}
@@ -255,14 +256,14 @@ module Bundler
255
256
  # @return [SpecSet] resolved dependencies
256
257
  def resolve
257
258
  @resolve ||= begin
258
- last_resolve = converge_locked_specs
259
259
  if Bundler.frozen_bundle?
260
260
  Bundler.ui.debug "Frozen, using resolution from the lockfile"
261
- last_resolve
261
+ @locked_specs
262
262
  elsif !unlocking? && nothing_changed?
263
263
  Bundler.ui.debug("Found no changes, using resolution from the lockfile")
264
- last_resolve
264
+ SpecSet.new(filter_specs(@locked_specs, @dependencies.select{|dep| @locked_specs[dep].any? }))
265
265
  else
266
+ last_resolve = converge_locked_specs
266
267
  # Run a resolve against the locally available gems
267
268
  Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
268
269
  expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
@@ -464,6 +465,10 @@ module Bundler
464
465
 
465
466
  private
466
467
 
468
+ def filter_specs(specs, deps)
469
+ SpecSet.new(specs).for(expand_dependencies(deps, true), false, false)
470
+ end
471
+
467
472
  def materialize(dependencies)
468
473
  specs = resolve.materialize(dependencies)
469
474
  missing_specs = specs.missing_specs
@@ -679,17 +684,17 @@ module Bundler
679
684
  end
680
685
 
681
686
  def converge_specs(specs)
682
- deps = []
683
687
  converged = []
688
+
689
+ deps = @dependencies.select do |dep|
690
+ specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
691
+ end
692
+
684
693
  specs.each do |s|
685
694
  # Replace the locked dependency's source with the equivalent source from the Gemfile
686
695
  dep = @dependencies.find {|d| s.satisfies?(d) }
687
696
 
688
- if dep && (!dep.source || s.source.include?(dep.source))
689
- deps << dep
690
- end
691
-
692
- s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source unless Bundler.frozen_bundle?
697
+ s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source
693
698
 
694
699
  next if @unlock[:sources].include?(s.source.name)
695
700
 
@@ -726,36 +731,18 @@ module Bundler
726
731
  end
727
732
  end
728
733
 
729
- resolve = SpecSet.new(converged)
730
- SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
734
+ SpecSet.new(filter_specs(converged, deps).reject{|s| @unlock[:gems].include?(s.name) })
731
735
  end
732
736
 
733
737
  def metadata_dependencies
734
738
  @metadata_dependencies ||= begin
735
- ruby_versions = ruby_version_requirements(@ruby_version)
736
739
  [
737
- Dependency.new("Ruby\0", ruby_versions),
740
+ Dependency.new("Ruby\0", RubyVersion.system.gem_version),
738
741
  Dependency.new("RubyGems\0", Gem::VERSION),
739
742
  ]
740
743
  end
741
744
  end
742
745
 
743
- def ruby_version_requirements(ruby_version)
744
- return [] unless ruby_version
745
- if ruby_version.patchlevel
746
- [ruby_version.to_gem_version_with_patchlevel]
747
- else
748
- ruby_version.versions.map do |version|
749
- requirement = Gem::Requirement.new(version)
750
- if requirement.exact?
751
- "~> #{version}.0"
752
- else
753
- requirement
754
- end
755
- end
756
- end
757
- end
758
-
759
746
  def expand_dependencies(dependencies, remote = false)
760
747
  deps = []
761
748
  dependencies.each do |dep|
@@ -821,7 +808,7 @@ module Bundler
821
808
 
822
809
  def additional_base_requirements_for_resolve
823
810
  return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
824
- converge_specs(@locked_gems.specs).map do |locked_spec|
811
+ converge_specs(@originally_locked_specs).map do |locked_spec|
825
812
  name = locked_spec.name
826
813
  dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
827
814
  DepProxy.get_proxy(dep, locked_spec.platform)
@@ -20,6 +20,9 @@ module Bundler
20
20
  :ruby_24 => Gem::Platform::RUBY,
21
21
  :ruby_25 => Gem::Platform::RUBY,
22
22
  :ruby_26 => Gem::Platform::RUBY,
23
+ :ruby_27 => Gem::Platform::RUBY,
24
+ :ruby_30 => Gem::Platform::RUBY,
25
+ :ruby_31 => Gem::Platform::RUBY,
23
26
  :mri => Gem::Platform::RUBY,
24
27
  :mri_18 => Gem::Platform::RUBY,
25
28
  :mri_19 => Gem::Platform::RUBY,
@@ -30,6 +33,9 @@ module Bundler
30
33
  :mri_24 => Gem::Platform::RUBY,
31
34
  :mri_25 => Gem::Platform::RUBY,
32
35
  :mri_26 => Gem::Platform::RUBY,
36
+ :mri_27 => Gem::Platform::RUBY,
37
+ :mri_30 => Gem::Platform::RUBY,
38
+ :mri_31 => Gem::Platform::RUBY,
33
39
  :rbx => Gem::Platform::RUBY,
34
40
  :truffleruby => Gem::Platform::RUBY,
35
41
  :jruby => Gem::Platform::JAVA,
@@ -45,6 +51,9 @@ module Bundler
45
51
  :mswin_24 => Gem::Platform::MSWIN,
46
52
  :mswin_25 => Gem::Platform::MSWIN,
47
53
  :mswin_26 => Gem::Platform::MSWIN,
54
+ :mswin_27 => Gem::Platform::MSWIN,
55
+ :mswin_30 => Gem::Platform::MSWIN,
56
+ :mswin_31 => Gem::Platform::MSWIN,
48
57
  :mswin64 => Gem::Platform::MSWIN64,
49
58
  :mswin64_19 => Gem::Platform::MSWIN64,
50
59
  :mswin64_20 => Gem::Platform::MSWIN64,
@@ -54,6 +63,9 @@ module Bundler
54
63
  :mswin64_24 => Gem::Platform::MSWIN64,
55
64
  :mswin64_25 => Gem::Platform::MSWIN64,
56
65
  :mswin64_26 => Gem::Platform::MSWIN64,
66
+ :mswin64_27 => Gem::Platform::MSWIN64,
67
+ :mswin64_30 => Gem::Platform::MSWIN64,
68
+ :mswin64_31 => Gem::Platform::MSWIN64,
57
69
  :mingw => Gem::Platform::MINGW,
58
70
  :mingw_18 => Gem::Platform::MINGW,
59
71
  :mingw_19 => Gem::Platform::MINGW,
@@ -64,6 +76,9 @@ module Bundler
64
76
  :mingw_24 => Gem::Platform::MINGW,
65
77
  :mingw_25 => Gem::Platform::MINGW,
66
78
  :mingw_26 => Gem::Platform::MINGW,
79
+ :mingw_27 => Gem::Platform::MINGW,
80
+ :mingw_30 => Gem::Platform::MINGW,
81
+ :mingw_31 => Gem::Platform::MINGW,
67
82
  :x64_mingw => Gem::Platform::X64_MINGW,
68
83
  :x64_mingw_20 => Gem::Platform::X64_MINGW,
69
84
  :x64_mingw_21 => Gem::Platform::X64_MINGW,
@@ -72,6 +87,9 @@ module Bundler
72
87
  :x64_mingw_24 => Gem::Platform::X64_MINGW,
73
88
  :x64_mingw_25 => Gem::Platform::X64_MINGW,
74
89
  :x64_mingw_26 => Gem::Platform::X64_MINGW,
90
+ :x64_mingw_27 => Gem::Platform::X64_MINGW,
91
+ :x64_mingw_30 => Gem::Platform::X64_MINGW,
92
+ :x64_mingw_31 => Gem::Platform::X64_MINGW,
75
93
  }.freeze
76
94
 
77
95
  def initialize(name, version, options = {}, &blk)
@@ -26,8 +26,11 @@ module Bundler
26
26
  @required_ruby_version ||= _remote_specification.required_ruby_version
27
27
  end
28
28
 
29
+ # A fallback is included because the original version of the specification
30
+ # API didn't include that field, so some marshalled specs in the index have it
31
+ # set to +nil+.
29
32
  def required_rubygems_version
30
- @required_rubygems_version ||= _remote_specification.required_rubygems_version
33
+ @required_rubygems_version ||= _remote_specification.required_rubygems_version || Gem::Requirement.default
31
34
  end
32
35
 
33
36
  def fetch_platform
@@ -119,7 +119,7 @@ module Bundler
119
119
  relative_gemfile_path = relative_gemfile_path
120
120
  ruby_command = Thor::Util.ruby_command
121
121
  ruby_command = ruby_command
122
- template_path = File.expand_path("../templates/Executable", __FILE__)
122
+ template_path = File.expand_path("templates/Executable", __dir__)
123
123
  if spec.name == "bundler"
124
124
  template_path += ".bundler"
125
125
  spec.executables = %(bundle)
@@ -172,7 +172,7 @@ module Bundler
172
172
  end
173
173
  standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
174
174
  standalone_path = standalone_path
175
- template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__))
175
+ template = File.read(File.expand_path("templates/Executable.standalone", __dir__))
176
176
  ruby_command = Thor::Util.ruby_command
177
177
  ruby_command = ruby_command
178
178
 
@@ -36,13 +36,13 @@ Executing \fBbundle config list\fR with will print a list of all bundler configu
36
36
  Executing \fBbundle config get <name>\fR will print the value of that configuration setting, and where it was set\.
37
37
  .
38
38
  .P
39
- Executing \fBbundle config set <name> <value>\fR will set that configuration to the value specified for all bundles executed as the current user\. The configuration will be stored in \fB~/\.bundle/config\fR\. If \fIname\fR already is set, \fIname\fR will be overridden and user will be warned\.
39
+ Executing \fBbundle config set <name> <value>\fR defaults to setting \fBlocal\fR configuration if executing from within a local application, otherwise it will set \fBglobal\fR configuration\. See \fB\-\-local\fR and \fB\-\-global\fR options below\.
40
40
  .
41
41
  .P
42
- Executing \fBbundle config set \-\-global <name> <value>\fR works the same as above\.
42
+ Executing \fBbundle config set \-\-local <name> <value>\fR will set that configuration in the directory for the local application\. The configuration will be stored in \fB<project_root>/\.bundle/config\fR\. If \fBBUNDLE_APP_CONFIG\fR is set, the configuration will be stored in \fB$BUNDLE_APP_CONFIG/config\fR\.
43
43
  .
44
44
  .P
45
- Executing \fBbundle config set \-\-local <name> <value>\fR will set that configuration in the directory for the local application\. The configuration will be stored in \fB<project_root>/\.bundle/config\fR\. If \fBBUNDLE_APP_CONFIG\fR is set, the configuration will be stored in \fB$BUNDLE_APP_CONFIG/config\fR\.
45
+ Executing \fBbundle config set \-\-global <name> <value>\fR will set that configuration to the value specified for all bundles executed as the current user\. The configuration will be stored in \fB~/\.bundle/config\fR\. If \fIname\fR already is set, \fIname\fR will be overridden and user will be warned\.
46
46
  .
47
47
  .P
48
48
  Executing \fBbundle config unset <name>\fR will delete the configuration in both local and global sources\.
@@ -23,18 +23,20 @@ was set.
23
23
  Executing `bundle config get <name>` will print the value of that configuration
24
24
  setting, and where it was set.
25
25
 
26
- Executing `bundle config set <name> <value>` will set that configuration to the
27
- value specified for all bundles executed as the current user. The configuration
28
- will be stored in `~/.bundle/config`. If <name> already is set, <name> will be
29
- overridden and user will be warned.
30
-
31
- Executing `bundle config set --global <name> <value>` works the same as above.
26
+ Executing `bundle config set <name> <value>` defaults to setting `local`
27
+ configuration if executing from within a local application, otherwise it will
28
+ set `global` configuration. See `--local` and `--global` options below.
32
29
 
33
30
  Executing `bundle config set --local <name> <value>` will set that configuration
34
31
  in the directory for the local application. The configuration will be stored in
35
32
  `<project_root>/.bundle/config`. If `BUNDLE_APP_CONFIG` is set, the configuration
36
33
  will be stored in `$BUNDLE_APP_CONFIG/config`.
37
34
 
35
+ Executing `bundle config set --global <name> <value>` will set that
36
+ configuration to the value specified for all bundles executed as the current
37
+ user. The configuration will be stored in `~/.bundle/config`. If <name> already
38
+ is set, <name> will be overridden and user will be warned.
39
+
38
40
  Executing `bundle config unset <name>` will delete the configuration in both
39
41
  local and global sources.
40
42
 
@@ -97,10 +97,10 @@ module Bundler
97
97
  spec = @specs[platform].first
98
98
  return [] if spec.is_a?(LazySpecification)
99
99
  dependencies = []
100
- if !spec.required_ruby_version.nil? && !spec.required_ruby_version.none?
100
+ unless spec.required_ruby_version.none?
101
101
  dependencies << DepProxy.get_proxy(Gem::Dependency.new("Ruby\0", spec.required_ruby_version), platform)
102
102
  end
103
- if !spec.required_rubygems_version.nil? && !spec.required_rubygems_version.none?
103
+ unless spec.required_rubygems_version.none?
104
104
  dependencies << DepProxy.get_proxy(Gem::Dependency.new("RubyGems\0", spec.required_rubygems_version), platform)
105
105
  end
106
106
  dependencies
@@ -312,29 +312,66 @@ module Bundler
312
312
 
313
313
  e = Molinillo::VersionConflict.new(conflicts, e.specification_provider) unless conflicts.empty?
314
314
 
315
- solver_name = "Bundler"
316
- possibility_type = "gem"
317
315
  e.message_with_trees(
318
- :solver_name => solver_name,
319
- :possibility_type => possibility_type,
320
- :reduce_trees => lambda do |trees|
316
+ :full_message_for_conflict => lambda do |name, conflict|
317
+ o = if name.end_with?("\0")
318
+ String.new("Bundler found conflicting requirements for the #{name} version:")
319
+ else
320
+ String.new("Bundler could not find compatible versions for gem \"#{name}\":")
321
+ end
322
+ o << %(\n)
323
+ if conflict.locked_requirement
324
+ o << %( In snapshot (#{name_for_locking_dependency_source}):\n)
325
+ o << %( #{SharedHelpers.pretty_dependency(conflict.locked_requirement)}\n)
326
+ o << %(\n)
327
+ end
328
+ o << %( In #{name_for_explicit_dependency_source}:\n)
329
+ trees = conflict.requirement_trees
330
+
321
331
  # called first, because we want to reduce the amount of work required to find maximal empty sets
322
332
  trees = trees.uniq {|t| t.flatten.map {|dep| [dep.name, dep.requirement] } }
323
333
 
324
334
  # bail out if tree size is too big for Array#combination to make any sense
325
- return trees if trees.size > 15
326
- maximal = 1.upto(trees.size).map do |size|
327
- trees.map(&:last).flatten(1).combination(size).to_a
328
- end.flatten(1).select do |deps|
329
- Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
330
- end.min_by(&:size)
331
-
332
- trees.reject! {|t| !maximal.include?(t.last) } if maximal
333
-
334
- trees.sort_by {|t| t.reverse.map(&:name) }
335
- end,
336
- :printable_requirement => lambda {|req| SharedHelpers.pretty_dependency(req) },
337
- :additional_message_for_conflict => lambda do |o, name, conflict|
335
+ if trees.size <= 15
336
+ maximal = 1.upto(trees.size).map do |size|
337
+ trees.map(&:last).flatten(1).combination(size).to_a
338
+ end.flatten(1).select do |deps|
339
+ Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
340
+ end.min_by(&:size)
341
+
342
+ trees.reject! {|t| !maximal.include?(t.last) } if maximal
343
+
344
+ trees.sort_by! {|t| t.reverse.map(&:name) }
345
+ end
346
+
347
+ metadata_requirements = {}
348
+
349
+ o << trees.map do |tree|
350
+ t = "".dup
351
+ depth = 2
352
+
353
+ base_tree = tree.first
354
+ base_tree_name = base_tree.name
355
+
356
+ if base_tree_name.end_with?("\0")
357
+ metadata_requirements[base_tree_name] = base_tree
358
+ t = nil
359
+ else
360
+ tree.each do |req|
361
+ t << " " * depth << SharedHelpers.pretty_dependency(req)
362
+ unless tree.last == req
363
+ if spec = conflict.activated_by_name[req.name]
364
+ t << %( was resolved to #{spec.version}, which)
365
+ end
366
+ t << %( depends on)
367
+ end
368
+ t << %(\n)
369
+ depth += 1
370
+ end
371
+ end
372
+ t
373
+ end.compact.join("\n")
374
+
338
375
  if name == "bundler"
339
376
  o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
340
377
 
@@ -355,11 +392,13 @@ module Bundler
355
392
  o << "Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.\n"
356
393
  end
357
394
  end
395
+ elsif name.end_with?("\0")
396
+ o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(metadata_requirements[name])}\n\n)
358
397
  elsif conflict.locked_requirement
359
398
  o << "\n"
360
399
  o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
361
400
  o << %(the gems in your Gemfile, which may resolve the conflict.\n)
362
- elsif !conflict.existing && !name.end_with?("\0")
401
+ elsif !conflict.existing
363
402
  o << "\n"
364
403
 
365
404
  relevant_source = conflict.requirement.source || source_for(name)
@@ -372,14 +411,8 @@ module Bundler
372
411
 
373
412
  o << gem_not_found_message(name, conflict.requirement, relevant_source, extra_message)
374
413
  end
375
- end,
376
- :version_for_spec => lambda {|spec| spec.version },
377
- :incompatible_version_message_for_conflict => lambda do |name, _conflict|
378
- if name.end_with?("\0")
379
- %(#{solver_name} found conflicting requirements for the #{name} version:)
380
- else
381
- %(#{solver_name} could not find compatible versions for #{possibility_type} "#{name}":)
382
- end
414
+
415
+ o
383
416
  end
384
417
  )
385
418
  end
@@ -110,19 +110,6 @@ module Bundler
110
110
  @ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
111
111
  end
112
112
 
113
- def to_gem_version_with_patchlevel
114
- @gem_version_with_patch ||= begin
115
- Gem::Version.create("#{@gem_version}.#{@patchlevel}")
116
- rescue ArgumentError
117
- @gem_version
118
- end
119
- end
120
-
121
- def exact?
122
- return @exact if defined?(@exact)
123
- @exact = versions.all? {|v| Gem::Requirement.create(v).exact? }
124
- end
125
-
126
113
  private
127
114
 
128
115
  def matches?(requirements, version)
@@ -67,6 +67,23 @@ module Gem
67
67
  full_gem_path
68
68
  end
69
69
 
70
+ unless const_defined?(:LATEST_RUBY_WITHOUT_PATCH_VERSIONS)
71
+ LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1")
72
+
73
+ alias_method :rg_required_ruby_version=, :required_ruby_version=
74
+ def required_ruby_version=(req)
75
+ self.rg_required_ruby_version = req
76
+
77
+ @required_ruby_version.requirements.map! do |op, v|
78
+ if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4
79
+ [op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))]
80
+ else
81
+ [op, v]
82
+ end
83
+ end
84
+ end
85
+ end
86
+
70
87
  def groups
71
88
  @groups ||= []
72
89
  end
@@ -274,10 +274,10 @@ module Bundler
274
274
 
275
275
  def set_bundle_variables
276
276
  # bundler exe & lib folders have same root folder, typical gem installation
277
- exe_file = File.expand_path("../../../exe/bundle", __FILE__)
277
+ exe_file = File.expand_path("../../exe/bundle", __dir__)
278
278
 
279
279
  # for Ruby core repository testing
280
- exe_file = File.expand_path("../../../libexec/bundle", __FILE__) unless File.exist?(exe_file)
280
+ exe_file = File.expand_path("../../libexec/bundle", __dir__) unless File.exist?(exe_file)
281
281
 
282
282
  # bundler is a default gem, exe path is separate
283
283
  exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
@@ -309,7 +309,7 @@ module Bundler
309
309
  end
310
310
 
311
311
  def bundler_ruby_lib
312
- resolve_path File.expand_path("../..", __FILE__)
312
+ File.expand_path("..", __dir__)
313
313
  end
314
314
 
315
315
  def clean_load_path
@@ -325,7 +325,7 @@ module Bundler
325
325
 
326
326
  def resolve_path(path)
327
327
  expanded = File.expand_path(path)
328
- return expanded unless File.respond_to?(:realpath) && File.exist?(expanded)
328
+ return expanded unless File.exist?(expanded)
329
329
 
330
330
  File.realpath(expanded)
331
331
  end
@@ -5,7 +5,7 @@ module Bundler
5
5
  class Metadata < Source
6
6
  def specs
7
7
  @specs ||= Index.build do |idx|
8
- idx << Gem::Specification.new("Ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
8
+ idx << Gem::Specification.new("Ruby\0", RubyVersion.system.gem_version)
9
9
  idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
10
10
  s.required_rubygems_version = Gem::Requirement.default
11
11
  end
@@ -22,7 +22,7 @@ module Bundler
22
22
  s.summary = "The best way to manage your application's dependencies"
23
23
  s.executables = %w[bundle]
24
24
  # can't point to the actual gemspec or else the require paths will be wrong
25
- s.loaded_from = File.expand_path("..", __FILE__)
25
+ s.loaded_from = __dir__
26
26
  end
27
27
 
28
28
  if local_spec = Bundler.rubygems.find_bundler(VERSION)
@@ -8,11 +8,9 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../<%= relative_gemfile_path %>",
13
- Pathname.new(__FILE__).realpath)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("<%= relative_gemfile_path %>", __dir__)
14
12
 
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
16
14
 
17
15
  if File.file?(bundle_binstub)
18
16
  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
@@ -41,7 +41,7 @@ m = Module.new do
41
41
  gemfile = ENV["BUNDLE_GEMFILE"]
42
42
  return gemfile if gemfile && !gemfile.empty?
43
43
 
44
- File.expand_path("../<%= relative_gemfile_path %>", __FILE__)
44
+ File.expand_path("<%= relative_gemfile_path %>", __dir__)
45
45
  end
46
46
 
47
47
  def lockfile
@@ -6,9 +6,7 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require "pathname"
10
- path = Pathname.new(__FILE__)
11
- $:.unshift File.expand_path "../<%= standalone_path %>", path.realpath
9
+ $:.unshift File.expand_path "<%= standalone_path %>", __dir__
12
10
 
13
11
  require "bundler/setup"
14
- load File.expand_path "../<%= executable_path %>", path.realpath
12
+ load File.expand_path "<%= executable_path %>", __dir__
@@ -17,7 +17,7 @@ jobs:
17
17
  - '<%= RUBY_VERSION %>'
18
18
 
19
19
  steps:
20
- - uses: actions/checkout@v2
20
+ - uses: actions/checkout@v3
21
21
  - name: Set up Ruby
22
22
  uses: ruby/setup-ruby@v1
23
23
  with: