bundler 2.3.21 → 2.3.23

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -0
  3. data/bundler.gemspec +6 -8
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/cli/init.rb +5 -1
  6. data/lib/bundler/cli.rb +2 -1
  7. data/lib/bundler/current_ruby.rb +14 -5
  8. data/lib/bundler/definition.rb +7 -20
  9. data/lib/bundler/dependency.rb +18 -85
  10. data/lib/bundler/dsl.rb +0 -1
  11. data/lib/bundler/endpoint_specification.rb +1 -1
  12. data/lib/bundler/feature_flag.rb +0 -1
  13. data/lib/bundler/gem_version_promoter.rb +10 -25
  14. data/lib/bundler/index.rb +3 -26
  15. data/lib/bundler/injector.rb +2 -1
  16. data/lib/bundler/lockfile_generator.rb +1 -1
  17. data/lib/bundler/man/bundle-add.1 +6 -2
  18. data/lib/bundler/man/bundle-add.1.ronn +4 -1
  19. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  20. data/lib/bundler/man/bundle-cache.1 +1 -1
  21. data/lib/bundler/man/bundle-check.1 +1 -1
  22. data/lib/bundler/man/bundle-clean.1 +1 -1
  23. data/lib/bundler/man/bundle-config.1 +1 -1
  24. data/lib/bundler/man/bundle-console.1 +53 -0
  25. data/lib/bundler/man/bundle-console.1.ronn +44 -0
  26. data/lib/bundler/man/bundle-doctor.1 +1 -1
  27. data/lib/bundler/man/bundle-exec.1 +1 -1
  28. data/lib/bundler/man/bundle-gem.1 +1 -1
  29. data/lib/bundler/man/bundle-help.1 +13 -0
  30. data/lib/bundler/man/bundle-help.1.ronn +12 -0
  31. data/lib/bundler/man/bundle-info.1 +1 -1
  32. data/lib/bundler/man/bundle-init.1 +1 -1
  33. data/lib/bundler/man/bundle-inject.1 +1 -1
  34. data/lib/bundler/man/bundle-install.1 +1 -1
  35. data/lib/bundler/man/bundle-list.1 +1 -1
  36. data/lib/bundler/man/bundle-lock.1 +1 -1
  37. data/lib/bundler/man/bundle-open.1 +1 -1
  38. data/lib/bundler/man/bundle-outdated.1 +1 -1
  39. data/lib/bundler/man/bundle-platform.1 +1 -1
  40. data/lib/bundler/man/bundle-plugin.1 +1 -1
  41. data/lib/bundler/man/bundle-pristine.1 +1 -1
  42. data/lib/bundler/man/bundle-remove.1 +1 -1
  43. data/lib/bundler/man/bundle-show.1 +1 -1
  44. data/lib/bundler/man/bundle-update.1 +1 -1
  45. data/lib/bundler/man/bundle-version.1 +35 -0
  46. data/lib/bundler/man/bundle-version.1.ronn +24 -0
  47. data/lib/bundler/man/bundle-viz.1 +1 -1
  48. data/lib/bundler/man/bundle.1 +6 -2
  49. data/lib/bundler/man/bundle.1.ronn +4 -1
  50. data/lib/bundler/man/gemfile.5 +8 -38
  51. data/lib/bundler/man/gemfile.5.ronn +9 -27
  52. data/lib/bundler/man/index.txt +3 -0
  53. data/lib/bundler/match_remote_metadata.rb +4 -1
  54. data/lib/bundler/resolver/base.rb +50 -0
  55. data/lib/bundler/resolver.rb +72 -93
  56. data/lib/bundler/rubygems_ext.rb +24 -3
  57. data/lib/bundler/settings.rb +0 -1
  58. data/lib/bundler/spec_set.rb +11 -1
  59. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +5 -4
  60. data/lib/bundler/version.rb +1 -1
  61. metadata +11 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06eb5dcedd936231226213f5eeca20b368e575d153efa728a27ecb0912c41386
4
- data.tar.gz: 60cfd094b573635123576691ceb73b62d297698b217cc68933e0ad4b293ce7b9
3
+ metadata.gz: 28c415ab98b0a481538fb3881860945bc2ec0b0d78afd59dbd8a38d75fcfdd4b
4
+ data.tar.gz: ccf31d79b872afd5d3fffd60b8ccfd425eb14e189f512b5187e6c171a2cf696b
5
5
  SHA512:
6
- metadata.gz: 04ec1c67333ae78914e6076b6b68024d9c8d57199a7d1a3898a44e643c4f91d5132351ee48590dc9c8167a64a9c838906683ac9b09255394c425193b9741ca34
7
- data.tar.gz: aa077c408592fe31ed5102e8d4b0a5f8f103691236fe71ee40e8461d926047e2e4c65e600557a8addca192e7ad4c8d71c69a34b4ded4bd06d8427f7d437a5d9c
6
+ metadata.gz: 6486b340fde2e41727126b985846503e89f7fd22a5f2b197f5e687b2e8840c7043be9eab0a54797cf9b0b1d777d9f9ee92bfc6b0c069c5eb310a2812c5af8460
7
+ data.tar.gz: 591190883dfb54835e5f11129ac09a87e9462a427fb97831c5def834664e18b55ca59b80b68028b35fe015fde2d5cfa3a372218a6b4c9432bfd9a0e585612f23
data/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ # 2.3.23 (October 5, 2022)
2
+
3
+ ## Enhancements:
4
+
5
+ - Update GitLab CI template with new one [#5944](https://github.com/rubygems/rubygems/pull/5944)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix `bundle init` not respecting umask in generated gem's Gemfile [#5947](https://github.com/rubygems/rubygems/pull/5947)
10
+
11
+ ## Performance:
12
+
13
+ - Further speed up Bundler by not sorting specs unnecessarily [#5868](https://github.com/rubygems/rubygems/pull/5868)
14
+
15
+ ## Documentation:
16
+
17
+ - Update Bundler new feature instructions [#5912](https://github.com/rubygems/rubygems/pull/5912)
18
+
19
+ # 2.3.22 (September 7, 2022)
20
+
21
+ ## Enhancements:
22
+
23
+ - Use a more accurate source code uri in gemspec [#5896](https://github.com/rubygems/rubygems/pull/5896)
24
+ - Support `--path` option in `bundle add` [#5897](https://github.com/rubygems/rubygems/pull/5897)
25
+ - Improve lockfile dependency unlocking [#5881](https://github.com/rubygems/rubygems/pull/5881)
26
+ - Add platform alias `:windows` to Gemfile DSL [#5650](https://github.com/rubygems/rubygems/pull/5650)
27
+ - Make `#to_lock` consistent between `Gem::Dependency` and `Bundler::Dependency` [#5872](https://github.com/rubygems/rubygems/pull/5872)
28
+ - Support marshaled index specifications with `nil` required ruby version [#5824](https://github.com/rubygems/rubygems/pull/5824)
29
+
30
+ ## Bug fixes:
31
+
32
+ - Fix resolution hanging on musl platforms [#5875](https://github.com/rubygems/rubygems/pull/5875)
33
+ - Fix another regression affecting the sorbet family of gems [#5874](https://github.com/rubygems/rubygems/pull/5874)
34
+
35
+ ## Documentation:
36
+
37
+ - Introduce bundle-console(1) man [#5901](https://github.com/rubygems/rubygems/pull/5901)
38
+ - Introduce bundle-version(1) man [#5895](https://github.com/rubygems/rubygems/pull/5895)
39
+ - Introduce bundle-help(1) man [#5886](https://github.com/rubygems/rubygems/pull/5886)
40
+
1
41
  # 2.3.21 (August 24, 2022)
2
42
 
3
43
  ## Enhancements:
data/bundler.gemspec CHANGED
@@ -22,14 +22,12 @@ Gem::Specification.new do |s|
22
22
  s.summary = "The best way to manage your application's dependencies"
23
23
  s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
24
24
 
25
- if s.respond_to?(:metadata=)
26
- s.metadata = {
27
- "bug_tracker_uri" => "https://github.com/rubygems/rubygems/issues?q=is%3Aopen+is%3Aissue+label%3ABundler",
28
- "changelog_uri" => "https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md",
29
- "homepage_uri" => "https://bundler.io/",
30
- "source_code_uri" => "https://github.com/rubygems/rubygems/",
31
- }
32
- end
25
+ s.metadata = {
26
+ "bug_tracker_uri" => "https://github.com/rubygems/rubygems/issues?q=is%3Aopen+is%3Aissue+label%3ABundler",
27
+ "changelog_uri" => "https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md",
28
+ "homepage_uri" => "https://bundler.io/",
29
+ "source_code_uri" => "https://github.com/rubygems/rubygems/tree/master/bundler",
30
+ }
33
31
 
34
32
  s.required_ruby_version = ">= 2.3.0"
35
33
  s.required_rubygems_version = ">= 2.5.2"
@@ -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-08-24".freeze
8
- @git_commit_sha = "d54be5fdd8".freeze
7
+ @built_at = "2022-10-05".freeze
8
+ @git_commit_sha = "250d9d485d".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -32,7 +32,11 @@ module Bundler
32
32
  file << spec.to_gemfile
33
33
  end
34
34
  else
35
- FileUtils.cp(File.expand_path("../templates/#{gemfile}", __dir__), gemfile)
35
+ File.open(File.expand_path("../templates/#{gemfile}", __dir__), "r") do |template|
36
+ File.open(gemfile, "wb") do |destination|
37
+ IO.copy_stream(template, destination)
38
+ end
39
+ end
36
40
  end
37
41
 
38
42
  puts "Writing new #{gemfile} to #{SharedHelpers.pwd}/#{gemfile}"
data/lib/bundler/cli.rb CHANGED
@@ -372,6 +372,7 @@ module Bundler
372
372
  method_option "group", :aliases => "-g", :type => :string
373
373
  method_option "source", :aliases => "-s", :type => :string
374
374
  method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string."
375
+ method_option "path", :type => :string
375
376
  method_option "git", :type => :string
376
377
  method_option "github", :type => :string
377
378
  method_option "branch", :type => :string
@@ -516,7 +517,7 @@ module Bundler
516
517
  end
517
518
  end
518
519
 
519
- desc "version", "Prints the bundler's version information"
520
+ desc "version", "Prints Bundler version information"
520
521
  def version
521
522
  cli_help = current_command.name == "cli_help"
522
523
  if cli_help || ARGV.include?("version")
@@ -36,17 +36,18 @@ module Bundler
36
36
  rbx
37
37
  ruby
38
38
  truffleruby
39
+ windows
39
40
  x64_mingw
40
41
  ].freeze
41
42
 
42
43
  def ruby?
43
44
  return true if Bundler::GemHelpers.generic_local_platform == Gem::Platform::RUBY
44
45
 
45
- !mswin? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
46
+ !windows? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
46
47
  end
47
48
 
48
49
  def mri?
49
- !mswin? && RUBY_ENGINE == "ruby"
50
+ !windows? && RUBY_ENGINE == "ruby"
50
51
  end
51
52
 
52
53
  def rbx?
@@ -65,16 +66,24 @@ module Bundler
65
66
  RUBY_ENGINE == "truffleruby"
66
67
  end
67
68
 
68
- def mswin?
69
+ def windows?
69
70
  Gem.win_platform?
70
71
  end
71
72
 
73
+ def mswin?
74
+ # For backwards compatibility
75
+ windows?
76
+
77
+ # TODO: This should correctly be:
78
+ # windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin32" && Bundler.local_platform.cpu == "x86"
79
+ end
80
+
72
81
  def mswin64?
73
- Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
82
+ windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
74
83
  end
75
84
 
76
85
  def mingw?
77
- Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
86
+ windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
78
87
  end
79
88
 
80
89
  def x64_mingw?
@@ -106,6 +106,7 @@ module Bundler
106
106
  @locked_gems = nil
107
107
  @locked_deps = {}
108
108
  @locked_specs = SpecSet.new([])
109
+ @originally_locked_specs = @locked_specs
109
110
  @locked_sources = []
110
111
  @locked_platforms = []
111
112
  end
@@ -149,18 +150,7 @@ module Bundler
149
150
  end
150
151
 
151
152
  def gem_version_promoter
152
- @gem_version_promoter ||= begin
153
- locked_specs =
154
- if unlocking? && @locked_specs.empty? && !@lockfile_contents.empty?
155
- # Definition uses an empty set of locked_specs to indicate all gems
156
- # are unlocked, but GemVersionPromoter needs the locked_specs
157
- # for conservative comparison.
158
- Bundler::SpecSet.new(@locked_gems.specs)
159
- else
160
- @locked_specs
161
- end
162
- GemVersionPromoter.new(locked_specs, @unlock[:gems])
163
- end
153
+ @gem_version_promoter ||= GemVersionPromoter.new(@originally_locked_specs, @unlock[:gems])
164
154
  end
165
155
 
166
156
  def resolve_only_locally!
@@ -484,15 +474,13 @@ module Bundler
484
474
  def resolver
485
475
  @resolver ||= begin
486
476
  last_resolve = converge_locked_specs
487
- Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
477
+ remove_ruby_from_platforms_if_necessary!(dependencies)
478
+ Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve(last_resolve), platforms)
488
479
  end
489
480
  end
490
481
 
491
482
  def expanded_dependencies
492
- @expanded_dependencies ||= begin
493
- remove_ruby_from_platforms_if_necessary!(dependencies)
494
- expand_dependencies(dependencies + metadata_dependencies, true)
495
- end
483
+ @expanded_dependencies ||= expand_dependencies(dependencies + metadata_dependencies, true)
496
484
  end
497
485
 
498
486
  def filter_specs(specs, deps)
@@ -880,9 +868,9 @@ module Bundler
880
868
  end
881
869
  end
882
870
 
883
- def additional_base_requirements_for_resolve
871
+ def additional_base_requirements_for_resolve(last_resolve)
884
872
  return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
885
- converge_specs(@originally_locked_specs).map do |locked_spec|
873
+ converge_specs(@originally_locked_specs - last_resolve).map do |locked_spec|
886
874
  Dependency.new(locked_spec.name, ">= #{locked_spec.version}")
887
875
  end.uniq
888
876
  end
@@ -896,7 +884,6 @@ module Bundler
896
884
 
897
885
  remove_platform(Gem::Platform::RUBY)
898
886
  add_current_platform
899
- resolver.platforms = @platforms
900
887
  end
901
888
 
902
889
  def source_map
@@ -7,92 +7,24 @@ require_relative "rubygems_ext"
7
7
  module Bundler
8
8
  class Dependency < Gem::Dependency
9
9
  attr_reader :autorequire
10
- attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref, :force_ruby_platform
10
+ attr_reader :groups, :platforms, :gemfile, :path, :git, :github, :branch, :ref, :force_ruby_platform
11
11
 
12
- # rubocop:disable Naming/VariableNumber
12
+ ALL_RUBY_VERSIONS = ((18..27).to_a + (30..31).to_a).freeze
13
13
  PLATFORM_MAP = {
14
- :ruby => Gem::Platform::RUBY,
15
- :ruby_18 => Gem::Platform::RUBY,
16
- :ruby_19 => Gem::Platform::RUBY,
17
- :ruby_20 => Gem::Platform::RUBY,
18
- :ruby_21 => Gem::Platform::RUBY,
19
- :ruby_22 => Gem::Platform::RUBY,
20
- :ruby_23 => Gem::Platform::RUBY,
21
- :ruby_24 => Gem::Platform::RUBY,
22
- :ruby_25 => Gem::Platform::RUBY,
23
- :ruby_26 => Gem::Platform::RUBY,
24
- :ruby_27 => Gem::Platform::RUBY,
25
- :ruby_30 => Gem::Platform::RUBY,
26
- :ruby_31 => Gem::Platform::RUBY,
27
- :mri => Gem::Platform::RUBY,
28
- :mri_18 => Gem::Platform::RUBY,
29
- :mri_19 => Gem::Platform::RUBY,
30
- :mri_20 => Gem::Platform::RUBY,
31
- :mri_21 => Gem::Platform::RUBY,
32
- :mri_22 => Gem::Platform::RUBY,
33
- :mri_23 => Gem::Platform::RUBY,
34
- :mri_24 => Gem::Platform::RUBY,
35
- :mri_25 => Gem::Platform::RUBY,
36
- :mri_26 => Gem::Platform::RUBY,
37
- :mri_27 => Gem::Platform::RUBY,
38
- :mri_30 => Gem::Platform::RUBY,
39
- :mri_31 => Gem::Platform::RUBY,
40
- :rbx => Gem::Platform::RUBY,
41
- :truffleruby => Gem::Platform::RUBY,
42
- :jruby => Gem::Platform::JAVA,
43
- :jruby_18 => Gem::Platform::JAVA,
44
- :jruby_19 => Gem::Platform::JAVA,
45
- :mswin => Gem::Platform::MSWIN,
46
- :mswin_18 => Gem::Platform::MSWIN,
47
- :mswin_19 => Gem::Platform::MSWIN,
48
- :mswin_20 => Gem::Platform::MSWIN,
49
- :mswin_21 => Gem::Platform::MSWIN,
50
- :mswin_22 => Gem::Platform::MSWIN,
51
- :mswin_23 => Gem::Platform::MSWIN,
52
- :mswin_24 => Gem::Platform::MSWIN,
53
- :mswin_25 => Gem::Platform::MSWIN,
54
- :mswin_26 => Gem::Platform::MSWIN,
55
- :mswin_27 => Gem::Platform::MSWIN,
56
- :mswin_30 => Gem::Platform::MSWIN,
57
- :mswin_31 => Gem::Platform::MSWIN,
58
- :mswin64 => Gem::Platform::MSWIN64,
59
- :mswin64_19 => Gem::Platform::MSWIN64,
60
- :mswin64_20 => Gem::Platform::MSWIN64,
61
- :mswin64_21 => Gem::Platform::MSWIN64,
62
- :mswin64_22 => Gem::Platform::MSWIN64,
63
- :mswin64_23 => Gem::Platform::MSWIN64,
64
- :mswin64_24 => Gem::Platform::MSWIN64,
65
- :mswin64_25 => Gem::Platform::MSWIN64,
66
- :mswin64_26 => Gem::Platform::MSWIN64,
67
- :mswin64_27 => Gem::Platform::MSWIN64,
68
- :mswin64_30 => Gem::Platform::MSWIN64,
69
- :mswin64_31 => Gem::Platform::MSWIN64,
70
- :mingw => Gem::Platform::MINGW,
71
- :mingw_18 => Gem::Platform::MINGW,
72
- :mingw_19 => Gem::Platform::MINGW,
73
- :mingw_20 => Gem::Platform::MINGW,
74
- :mingw_21 => Gem::Platform::MINGW,
75
- :mingw_22 => Gem::Platform::MINGW,
76
- :mingw_23 => Gem::Platform::MINGW,
77
- :mingw_24 => Gem::Platform::MINGW,
78
- :mingw_25 => Gem::Platform::MINGW,
79
- :mingw_26 => Gem::Platform::MINGW,
80
- :mingw_27 => Gem::Platform::MINGW,
81
- :mingw_30 => Gem::Platform::MINGW,
82
- :mingw_31 => Gem::Platform::MINGW,
83
- :x64_mingw => Gem::Platform::X64_MINGW,
84
- :x64_mingw_20 => Gem::Platform::X64_MINGW,
85
- :x64_mingw_21 => Gem::Platform::X64_MINGW,
86
- :x64_mingw_22 => Gem::Platform::X64_MINGW,
87
- :x64_mingw_23 => Gem::Platform::X64_MINGW,
88
- :x64_mingw_24 => Gem::Platform::X64_MINGW,
89
- :x64_mingw_25 => Gem::Platform::X64_MINGW,
90
- :x64_mingw_26 => Gem::Platform::X64_MINGW,
91
- :x64_mingw_27 => Gem::Platform::X64_MINGW,
92
- :x64_mingw_30 => Gem::Platform::X64_MINGW,
93
- :x64_mingw_31 => Gem::Platform::X64_MINGW,
94
- }.freeze
95
- # rubocop:enable Naming/VariableNumber
14
+ :ruby => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
15
+ :mri => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
16
+ :rbx => [Gem::Platform::RUBY],
17
+ :truffleruby => [Gem::Platform::RUBY],
18
+ :jruby => [Gem::Platform::JAVA, [18, 19]],
19
+ :windows => [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS],
20
+ :mswin => [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS],
21
+ :mswin64 => [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]],
22
+ :mingw => [Gem::Platform::MINGW, ALL_RUBY_VERSIONS],
23
+ :x64_mingw => [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]],
24
+ }.each_with_object({}) do |(platform, spec), hash|
25
+ hash[platform] = spec[0]
26
+ spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] }
27
+ end.freeze
96
28
 
97
29
  def initialize(name, version, options = {}, &blk)
98
30
  type = options["type"] || :runtime
@@ -101,6 +33,7 @@ module Bundler
101
33
  @autorequire = nil
102
34
  @groups = Array(options["group"] || :default).map(&:to_sym)
103
35
  @source = options["source"]
36
+ @path = options["path"]
104
37
  @git = options["git"]
105
38
  @github = options["github"]
106
39
  @branch = options["branch"]
@@ -151,7 +84,7 @@ module Bundler
151
84
  def to_lock
152
85
  out = super
153
86
  out << "!" if source
154
- out << "\n"
87
+ out
155
88
  end
156
89
 
157
90
  def specific?
data/lib/bundler/dsl.rb CHANGED
@@ -67,7 +67,6 @@ module Bundler
67
67
 
68
68
  gemspecs = Gem::Util.glob_files_in_dir("{,*}.gemspec", expanded_path).map {|g| Bundler.load_gemspec(g) }.compact
69
69
  gemspecs.reject! {|s| s.name != name } if name
70
- Index.sort_specs(gemspecs)
71
70
  specs_by_name_and_version = gemspecs.group_by {|s| [s.name, s.version] }
72
71
 
73
72
  case specs_by_name_and_version.size
@@ -12,7 +12,7 @@ module Bundler
12
12
  super()
13
13
  @name = name
14
14
  @version = Gem::Version.create version
15
- @platform = platform
15
+ @platform = Gem::Platform.new(platform)
16
16
  @spec_fetcher = spec_fetcher
17
17
  @dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) }
18
18
 
@@ -39,7 +39,6 @@ module Bundler
39
39
  settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
40
40
  settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
41
41
  settings_flag(:update_requires_all_flag) { bundler_4_mode? }
42
- settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
43
42
 
44
43
  settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
45
44
 
@@ -55,19 +55,17 @@ module Bundler
55
55
  @level = v
56
56
  end
57
57
 
58
- # Given a Dependency and an Array of SpecGroups of available versions for a
59
- # gem, this method will return the Array of SpecGroups sorted (and possibly
58
+ # Given a Dependency and an Array of Specifications of available versions for a
59
+ # gem, this method will return the Array of Specifications sorted (and possibly
60
60
  # truncated if strict is true) in an order to give preference to the current
61
61
  # level (:major, :minor or :patch) when resolution is deciding what versions
62
62
  # best resolve all dependencies in the bundle.
63
63
  # @param dep [Dependency] The Dependency of the gem.
64
- # @param spec_groups [SpecGroup] An array of SpecGroups for the same gem
64
+ # @param spec_groups [Specification] An array of Specifications for the same gem
65
65
  # named in the @dep param.
66
- # @return [SpecGroup] A new instance of the SpecGroup Array sorted and
66
+ # @return [Specification] A new instance of the Specification Array sorted and
67
67
  # possibly filtered.
68
68
  def sort_versions(dep, spec_groups)
69
- before_result = "before sort_versions: #{debug_format_result(dep, spec_groups).inspect}" if DEBUG
70
-
71
69
  @sort_versions[dep] ||= begin
72
70
  gem_name = dep.name
73
71
 
@@ -79,11 +77,6 @@ module Bundler
79
77
  filter_dep_specs(spec_groups, locked_spec)
80
78
  else
81
79
  sort_dep_specs(spec_groups, locked_spec)
82
- end.tap do |specs|
83
- if DEBUG
84
- puts before_result
85
- puts " after sort_versions: #{debug_format_result(dep, specs).inspect}"
86
- end
87
80
  end
88
81
  end
89
82
  end
@@ -123,15 +116,14 @@ module Bundler
123
116
  end
124
117
 
125
118
  def sort_dep_specs(spec_groups, locked_spec)
126
- return spec_groups unless locked_spec
127
- @gem_name = locked_spec.name
128
- @locked_version = locked_spec.version
119
+ @locked_version = locked_spec&.version
120
+ @gem_name = locked_spec&.name
129
121
 
130
122
  result = spec_groups.sort do |a, b|
131
123
  @a_ver = a.version
132
124
  @b_ver = b.version
133
125
 
134
- unless @prerelease_specified[@gem_name]
126
+ unless @gem_name && @prerelease_specified[@gem_name]
135
127
  a_pre = @a_ver.prerelease?
136
128
  b_pre = @b_ver.prerelease?
137
129
 
@@ -155,7 +147,7 @@ module Bundler
155
147
  end
156
148
 
157
149
  def either_version_older_than_locked
158
- @a_ver < @locked_version || @b_ver < @locked_version
150
+ @locked_version && (@a_ver < @locked_version || @b_ver < @locked_version)
159
151
  end
160
152
 
161
153
  def segments_do_not_match(level)
@@ -164,7 +156,7 @@ module Bundler
164
156
  end
165
157
 
166
158
  def unlocking_gem?
167
- unlock_gems.empty? || unlock_gems.include?(@gem_name)
159
+ unlock_gems.empty? || (@gem_name && unlock_gems.include?(@gem_name))
168
160
  end
169
161
 
170
162
  # Specific version moves can't always reliably be done during sorting
@@ -172,7 +164,7 @@ module Bundler
172
164
  def post_sort(result)
173
165
  # default :major behavior in Bundler does not do this
174
166
  return result if major?
175
- if unlocking_gem?
167
+ if unlocking_gem? || @locked_version.nil?
176
168
  result
177
169
  else
178
170
  move_version_to_end(result, @locked_version)
@@ -183,12 +175,5 @@ module Bundler
183
175
  move, keep = result.partition {|s| s.version.to_s == version.to_s }
184
176
  keep.concat(move)
185
177
  end
186
-
187
- def debug_format_result(dep, spec_groups)
188
- a = [dep.to_s,
189
- spec_groups.map {|sg| [sg.version, sg.dependencies_for_activated_platforms.map {|dp| [dp.name, dp.requirement.to_s] }] }]
190
- last_map = a.last.map {|sg_data| [sg_data.first.version, sg_data.last.map {|aa| aa.join(" ") }] }
191
- [a.first, last_map, level, strict ? :strict : :not_strict]
192
- end
193
178
  end
194
179
  end
data/lib/bundler/index.rb CHANGED
@@ -57,36 +57,13 @@ module Bundler
57
57
  # Search this index's specs, and any source indexes that this index knows
58
58
  # about, returning all of the results.
59
59
  def search(query)
60
- sort_specs(unsorted_search(query))
61
- end
62
-
63
- def unsorted_search(query)
64
60
  results = local_search(query)
65
-
66
- seen = results.map(&:full_name).uniq unless @sources.empty?
61
+ return results unless @sources.any?
67
62
 
68
63
  @sources.each do |source|
69
- source.unsorted_search(query).each do |spec|
70
- next if seen.include?(spec.full_name)
71
-
72
- seen << spec.full_name
73
- results << spec
74
- end
64
+ results.concat(source.search(query))
75
65
  end
76
-
77
- results
78
- end
79
- protected :unsorted_search
80
-
81
- def self.sort_specs(specs)
82
- specs.sort_by do |s|
83
- platform_string = s.platform.to_s
84
- [s.version, platform_string == RUBY ? NULL : platform_string]
85
- end
86
- end
87
-
88
- def sort_specs(specs)
89
- self.class.sort_specs(specs)
66
+ results.uniq(&:full_name)
90
67
  end
91
68
 
92
69
  def local_search(query)
@@ -115,13 +115,14 @@ module Bundler
115
115
  end
116
116
 
117
117
  source = ", :source => \"#{d.source}\"" unless d.source.nil?
118
+ path = ", :path => \"#{d.path}\"" unless d.path.nil?
118
119
  git = ", :git => \"#{d.git}\"" unless d.git.nil?
119
120
  github = ", :github => \"#{d.github}\"" unless d.github.nil?
120
121
  branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil?
121
122
  ref = ", :ref => \"#{d.ref}\"" unless d.ref.nil?
122
123
  require_path = ", :require => #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil?
123
124
 
124
- %(gem #{name}#{requirement}#{group}#{source}#{git}#{github}#{branch}#{ref}#{require_path})
125
+ %(gem #{name}#{requirement}#{group}#{source}#{path}#{git}#{github}#{branch}#{ref}#{require_path})
125
126
  end.join("\n")
126
127
  end
127
128
 
@@ -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
@@ -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" "August 2022" "" ""
4
+ .TH "BUNDLE\-ADD" "1" "September 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] [\-\-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\.
@@ -49,6 +49,10 @@ Specify the source for the added gem\.
49
49
  Adds require path to gem\. Provide false, or a path as a string\.
50
50
  .
51
51
  .TP
52
+ \fB\-\-path\fR
53
+ Specify the file system path for the added gem\.
54
+ .
55
+ .TP
52
56
  \fB\-\-git\fR
53
57
  Specify the git source for the added gem\.
54
58
  .
@@ -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`.
@@ -33,6 +33,9 @@ bundle add rails --group "development, test"
33
33
  * `--require`, `-r`:
34
34
  Adds require path to gem. Provide false, or a path as a string.
35
35
 
36
+ * `--path`:
37
+ Specify the file system path for the added gem.
38
+
36
39
  * `--git`:
37
40
  Specify the git source for the added gem.
38
41
 
@@ -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" "August 2022" "" ""
4
+ .TH "BUNDLE\-BINSTUBS" "1" "September 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" "August 2022" "" ""
4
+ .TH "BUNDLE\-CACHE" "1" "September 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
@@ -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" "August 2022" "" ""
4
+ .TH "BUNDLE\-CHECK" "1" "September 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" "August 2022" "" ""
4
+ .TH "BUNDLE\-CLEAN" "1" "September 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
@@ -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\-CONFIG" "1" "August 2022" "" ""
4
+ .TH "BUNDLE\-CONFIG" "1" "September 2022" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-config\fR \- Set bundler configuration options