rubygems-update 3.5.16 → 3.5.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97995bf356031d7683c1336089b3520a4604416619ce917d5efb42f628c8abc2
4
- data.tar.gz: 3f66e1705ddc62583b44bebedd33089c7edbb6ba27f4ecfee984069a53f97548
3
+ metadata.gz: c3139eb9f0637a60e29d93dd00cfa4d2bd484a0901d919e9863f4d10ad0e8f3a
4
+ data.tar.gz: e4ae59b74ee6faef499b282cbef49177f02aa0e7f6737ae844cf32d4543829d1
5
5
  SHA512:
6
- metadata.gz: e92f698093d5c671bb617ecb0d5b25e3803b55f182e3cf523e4a2490278ece4a9ed0aa4d984d54ae2f0703847d2b63c50557d1fc05d84b2cd40b6d87c85fe105
7
- data.tar.gz: 520eead8b68e27c40f18e54976aac985e1d52baed43b080bbb54a7ab43d6c3f936f8a0d57a0c1fe797e17bdf0a189f4d920e0876b2f938f6ebd571e391c74a28
6
+ metadata.gz: 5fa2a4b919ec4a16af6f6b4de687aa98fe16f3dadca6e96c530c5d2c1d53f4eed6ce9e5137b468271692fc35e3eb025f8a38559d3da599347374494278f176bb
7
+ data.tar.gz: ffc9199f1fc3cf5023cf1344c3597ae1ce08b9a7ba817f4b4b082da5c0d92031085c1b62d2f0629e190297c7b9abcdbd53eb9eb99f6f4281ed9f5aff683e6a9f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ # 3.5.18 / 2024-08-26
2
+
3
+ ## Enhancements:
4
+
5
+ * Installs bundler 2.5.18 as a default gem.
6
+
7
+ ## Bug fixes:
8
+
9
+ * Fix `gem uninstall <name>:<version>` failing on shadowed default gems.
10
+ Pull request [#7949](https://github.com/rubygems/rubygems/pull/7949) by
11
+ deivid-rodriguez
12
+
13
+ # 3.5.17 / 2024-08-01
14
+
15
+ ## Enhancements:
16
+
17
+ * Explicitly encode `Gem::Dependency` to yaml. Pull request
18
+ [#7867](https://github.com/rubygems/rubygems/pull/7867) by segiddins
19
+ * Installs bundler 2.5.17 as a default gem.
20
+
21
+ ## Bug fixes:
22
+
23
+ * Fix `gem list` regression when a regular gem shadows a default one. Pull
24
+ request [#7892](https://github.com/rubygems/rubygems/pull/7892) by
25
+ deivid-rodriguez
26
+ * Always leave default gem executables around. Pull request
27
+ [#7879](https://github.com/rubygems/rubygems/pull/7879) by
28
+ deivid-rodriguez
29
+ * Fix line comment issue for hash when loading gemrc. Pull request
30
+ [#7857](https://github.com/rubygems/rubygems/pull/7857) by leetking
31
+
1
32
  # 3.5.16 / 2024-07-18
2
33
 
3
34
  ## Enhancements:
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ # 2.5.18 (August 26, 2024)
2
+
3
+ ## Enhancements:
4
+
5
+ - Don't remove existing platform gems when PLATFORMS section is badly indented [#7916](https://github.com/rubygems/rubygems/pull/7916)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix error message when Bundler refuses to install due to frozen being set without a lockfile [#7955](https://github.com/rubygems/rubygems/pull/7955)
10
+ - Fix several issues with the `--prefer-local` flag [#7951](https://github.com/rubygems/rubygems/pull/7951)
11
+ - Restore support for passing relative paths to `git:` sources [#7950](https://github.com/rubygems/rubygems/pull/7950)
12
+ - Regenerate previous git application caches that didn't include bare repos [#7926](https://github.com/rubygems/rubygems/pull/7926)
13
+ - Fix `bundle update <indirect_dep>` failing to upgrade when versions present in two different sources [#7915](https://github.com/rubygems/rubygems/pull/7915)
14
+
15
+ ## Documentation:
16
+
17
+ - Change new gem README template to have copyable code blocks [#7935](https://github.com/rubygems/rubygems/pull/7935)
18
+
19
+ # 2.5.17 (August 1, 2024)
20
+
21
+ ## Enhancements:
22
+
23
+ - Print better log message when current platform is not present in the lockfile [#7891](https://github.com/rubygems/rubygems/pull/7891)
24
+ - Explicitly encode `Gem::Dependency` to yaml [#7867](https://github.com/rubygems/rubygems/pull/7867)
25
+ - Enable lockfile checksums on future Bundler 3 when there's no previous lockfile [#7805](https://github.com/rubygems/rubygems/pull/7805)
26
+
27
+ ## Bug fixes:
28
+
29
+ - Fix truffleruby removing gems from lockfile [#7795](https://github.com/rubygems/rubygems/pull/7795)
30
+ - Fix `bundle check` exit code when gem git source is not checked out [#7894](https://github.com/rubygems/rubygems/pull/7894)
31
+ - Generate gems.rb from Gemfile.tt template for `bundle-gem` [#7853](https://github.com/rubygems/rubygems/pull/7853)
32
+ - Fix git source cache being used as the install location [#4469](https://github.com/rubygems/rubygems/pull/4469)
33
+ - Fix `bundle exec gem uninstall` [#7886](https://github.com/rubygems/rubygems/pull/7886)
34
+
1
35
  # 2.5.16 (July 18, 2024)
2
36
 
3
37
  ## Bug fixes:
@@ -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 = "2024-07-18".freeze
8
- @git_commit_sha = "f49d3d48c9".freeze
7
+ @built_at = "2024-08-26".freeze
8
+ @git_commit_sha = "c218aab519".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -17,7 +17,7 @@ module Bundler
17
17
  begin
18
18
  definition.resolve_only_locally!
19
19
  not_installed = definition.missing_specs
20
- rescue GemNotFound, SolveFailure
20
+ rescue GemNotFound, GitError, SolveFailure
21
21
  Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
22
22
  Bundler.ui.warn "Install missing gems with `bundle install`."
23
23
  exit 1
@@ -79,7 +79,7 @@ module Bundler
79
79
  ensure_safe_gem_name(name, constant_array)
80
80
 
81
81
  templates = {
82
- "#{Bundler.preferred_gemfile_name}.tt" => Bundler.preferred_gemfile_name,
82
+ "Gemfile.tt" => Bundler.preferred_gemfile_name,
83
83
  "lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
84
84
  "lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
85
85
  "sig/newgem.rbs.tt" => "sig/#{namespaced_path}.rbs",
@@ -25,9 +25,10 @@ module Bundler
25
25
 
26
26
  if options[:deployment] || options[:frozen] || Bundler.frozen_bundle?
27
27
  unless Bundler.default_lockfile.exist?
28
- flag = "--deployment flag" if options[:deployment]
29
- flag ||= "--frozen flag" if options[:frozen]
30
- flag ||= "deployment setting"
28
+ flag = "--deployment flag" if options[:deployment]
29
+ flag ||= "--frozen flag" if options[:frozen]
30
+ flag ||= "deployment setting" if Bundler.settings[:deployment]
31
+ flag ||= "frozen setting" if Bundler.settings[:frozen]
31
32
  raise ProductionError, "The #{flag} requires a lockfile. Please make " \
32
33
  "sure you have checked your #{SharedHelpers.relative_lockfile_path} into version control " \
33
34
  "before deploying."
@@ -110,8 +110,8 @@ module Bundler
110
110
  default_task(Bundler.feature_flag.default_cli_command)
111
111
 
112
112
  class_option "no-color", type: :boolean, desc: "Disable colorization in output"
113
- class_option "retry", type: :numeric, aliases: "-r", banner: "NUM",
114
- desc: "Specify the number of times you wish to attempt network commands"
113
+ class_option "retry", type: :numeric, aliases: "-r", banner: "NUM",
114
+ desc: "Specify the number of times you wish to attempt network commands"
115
115
  class_option "verbose", type: :boolean, desc: "Enable verbose output mode", aliases: "-V"
116
116
 
117
117
  def help(cli = nil)
@@ -260,15 +260,15 @@ module Bundler
260
260
  method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
261
261
  method_option "group", aliases: "-g", type: :array, banner: "Update a specific group"
262
262
  method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
263
- method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
264
- method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
263
+ method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
264
+ method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
265
265
  method_option "source", type: :array, banner: "Update a specific source (and all gems associated with it)"
266
266
  method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
267
267
  method_option "ruby", type: :boolean, banner: "Update ruby specified in Gemfile.lock"
268
268
  method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
269
- method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
270
- method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
271
- method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
269
+ method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
270
+ method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
271
+ method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
272
272
  method_option "pre", type: :boolean, banner: "Always choose the highest allowed version when updating gems, regardless of prerelease status"
273
273
  method_option "strict", type: :boolean, banner: "Do not allow any gem to be updated past latest --patch | --minor | --major"
274
274
  method_option "conservative", type: :boolean, banner: "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
@@ -397,11 +397,11 @@ module Bundler
397
397
  end
398
398
 
399
399
  desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
400
- method_option "all", type: :boolean,
401
- default: Bundler.feature_flag.cache_all?,
402
- banner: "Include all sources (including path and git)."
400
+ method_option "all", type: :boolean,
401
+ default: Bundler.feature_flag.cache_all?,
402
+ banner: "Include all sources (including path and git)."
403
403
  method_option "all-platforms", type: :boolean, banner: "Include gems for all platforms present in the lockfile, not only the current one"
404
- method_option "cache-path", type: :string, banner: "Specify a different cache path than the default (vendor/cache)."
404
+ method_option "cache-path", type: :string, banner: "Specify a different cache path than the default (vendor/cache)."
405
405
  method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
406
406
  method_option "no-install", type: :boolean, banner: "Don't install the gems, only update the cache."
407
407
  method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
@@ -605,7 +605,7 @@ module Bundler
605
605
  end
606
606
 
607
607
  desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", hide: true
608
- method_option "source", type: :string, banner: "Install gem from the given source"
608
+ method_option "source", type: :string, banner: "Install gem from the given source"
609
609
  method_option "group", type: :string, banner: "Install gem into a bundler group"
610
610
  def inject(name, version)
611
611
  SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
@@ -615,16 +615,16 @@ module Bundler
615
615
 
616
616
  desc "lock", "Creates a lockfile without installing"
617
617
  method_option "update", type: :array, lazy_default: true, banner: "ignore the existing lockfile, update all gems by default, or update list of given gems"
618
- method_option "local", type: :boolean, default: false, banner: "do not attempt to fetch remote gemspecs and use the local gem cache only"
619
- method_option "print", type: :boolean, default: false, banner: "print the lockfile to STDOUT instead of writing to the file system"
618
+ method_option "local", type: :boolean, default: false, banner: "do not attempt to fetch remote gemspecs and use the local gem cache only"
619
+ method_option "print", type: :boolean, default: false, banner: "print the lockfile to STDOUT instead of writing to the file system"
620
620
  method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
621
621
  method_option "lockfile", type: :string, default: nil, banner: "the path the lockfile should be written to"
622
622
  method_option "full-index", type: :boolean, default: false, banner: "Fall back to using the single-file index of all gems"
623
623
  method_option "add-platform", type: :array, default: [], banner: "Add a new platform to the lockfile"
624
- method_option "remove-platform", type: :array, default: [], banner: "Remove a platform from the lockfile"
625
- method_option "patch", type: :boolean, banner: "If updating, prefer updating only to next patch version"
626
- method_option "minor", type: :boolean, banner: "If updating, prefer updating only to next minor version"
627
- method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)"
624
+ method_option "remove-platform", type: :array, default: [], banner: "Remove a platform from the lockfile"
625
+ method_option "patch", type: :boolean, banner: "If updating, prefer updating only to next patch version"
626
+ method_option "minor", type: :boolean, banner: "If updating, prefer updating only to next minor version"
627
+ method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)"
628
628
  method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status"
629
629
  method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
630
630
  method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
@@ -115,7 +115,7 @@ module Bundler
115
115
  @originally_locked_specs = @locked_specs
116
116
  @locked_sources = []
117
117
  @locked_platforms = []
118
- @locked_checksums = nil
118
+ @locked_checksums = Bundler.feature_flag.bundler_3_mode?
119
119
  end
120
120
 
121
121
  locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
@@ -137,7 +137,7 @@ module Bundler
137
137
  end
138
138
  @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
139
139
 
140
- add_current_platform unless Bundler.frozen_bundle?
140
+ @current_platform_missing = add_current_platform unless Bundler.frozen_bundle?
141
141
 
142
142
  converge_path_sources_to_gemspec_sources
143
143
  @path_changes = converge_paths
@@ -214,6 +214,7 @@ module Bundler
214
214
  @resolve = nil
215
215
  @resolver = nil
216
216
  @resolution_packages = nil
217
+ @source_requirements = nil
217
218
  @specs = nil
218
219
 
219
220
  Bundler.ui.debug "The definition is missing dependencies, failed to resolve & materialize locally (#{e})"
@@ -476,14 +477,12 @@ module Bundler
476
477
  end
477
478
  end
478
479
 
479
- attr_reader :sources
480
- private :sources
481
-
482
480
  def nothing_changed?
483
481
  return false unless lockfile_exists?
484
482
 
485
483
  !@source_changes &&
486
484
  !@dependency_changes &&
485
+ !@current_platform_missing &&
487
486
  @new_platforms.empty? &&
488
487
  !@path_changes &&
489
488
  !@local_changes &&
@@ -501,8 +500,12 @@ module Bundler
501
500
  @unlocking
502
501
  end
503
502
 
503
+ attr_writer :source_requirements
504
+
504
505
  private
505
506
 
507
+ attr_reader :sources
508
+
506
509
  def should_add_extra_platforms?
507
510
  !lockfile_exists? && generic_local_platform_is_ruby? && !Bundler.settings[:force_ruby_platform]
508
511
  end
@@ -568,7 +571,7 @@ module Bundler
568
571
  @resolution_packages ||= begin
569
572
  last_resolve = converge_locked_specs
570
573
  remove_invalid_platforms!
571
- packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @gems_to_unlock, prerelease: gem_version_promoter.pre?)
574
+ packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @gems_to_unlock, prerelease: gem_version_promoter.pre?, prefer_local: @prefer_local)
572
575
  packages = additional_base_requirements_to_prevent_downgrades(packages, last_resolve)
573
576
  packages = additional_base_requirements_to_force_updates(packages)
574
577
  packages
@@ -629,6 +632,7 @@ module Bundler
629
632
  def start_resolution
630
633
  local_platform_needed_for_resolvability = @most_specific_non_local_locked_ruby_platform && !@platforms.include?(local_platform)
631
634
  @platforms << local_platform if local_platform_needed_for_resolvability
635
+ add_platform(Gem::Platform::RUBY) if RUBY_ENGINE == "truffleruby"
632
636
 
633
637
  result = SpecSet.new(resolver.start)
634
638
 
@@ -651,19 +655,6 @@ module Bundler
651
655
  sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
652
656
  end
653
657
 
654
- def pin_locally_available_names(source_requirements)
655
- source_requirements.each_with_object({}) do |(name, original_source), new_source_requirements|
656
- local_source = original_source.dup
657
- local_source.local_only!
658
-
659
- new_source_requirements[name] = if local_source.specs.search(name).any?
660
- local_source
661
- else
662
- original_source
663
- end
664
- end
665
- end
666
-
667
658
  def current_platform_locked?
668
659
  @platforms.any? do |bundle_platform|
669
660
  MatchPlatform.platforms_match?(bundle_platform, local_platform)
@@ -671,19 +662,19 @@ module Bundler
671
662
  end
672
663
 
673
664
  def add_current_platform
674
- @most_specific_non_local_locked_ruby_platform = find_most_specific_non_local_locked_ruby_platform
665
+ return if @platforms.include?(local_platform)
666
+
667
+ @most_specific_non_local_locked_ruby_platform = find_most_specific_locked_ruby_platform
675
668
  return if @most_specific_non_local_locked_ruby_platform
676
669
 
677
- add_platform(local_platform)
670
+ @platforms << local_platform
671
+ true
678
672
  end
679
673
 
680
- def find_most_specific_non_local_locked_ruby_platform
674
+ def find_most_specific_locked_ruby_platform
681
675
  return unless generic_local_platform_is_ruby? && current_platform_locked?
682
676
 
683
- most_specific_locked_ruby_platform = most_specific_locked_platform
684
- return unless most_specific_locked_ruby_platform != local_platform
685
-
686
- most_specific_locked_ruby_platform
677
+ most_specific_locked_platform
687
678
  end
688
679
 
689
680
  def change_reason
@@ -705,6 +696,7 @@ module Bundler
705
696
  [
706
697
  [@source_changes, "the list of sources changed"],
707
698
  [@dependency_changes, "the dependencies in your gemfile changed"],
699
+ [@current_platform_missing, "your lockfile does not include the current platform"],
708
700
  [@new_platforms.any?, "you added a new platform to your gemfile"],
709
701
  [@path_changes, "the gemspecs for path gems changed"],
710
702
  [@local_changes, "the gemspecs for git local gems changed"],
@@ -969,12 +961,15 @@ module Bundler
969
961
  end
970
962
 
971
963
  def source_requirements
964
+ @source_requirements ||= find_source_requirements
965
+ end
966
+
967
+ def find_source_requirements
972
968
  # Record the specs available in each gem's source, so that those
973
969
  # specs will be available later when the resolver knows where to
974
970
  # look for that gemspec (or its dependencies)
975
971
  source_requirements = if precompute_source_requirements_for_indirect_dependencies?
976
972
  all_requirements = source_map.all_requirements
977
- all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
978
973
  { default: default_source }.merge(all_requirements)
979
974
  else
980
975
  { default: Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
@@ -1050,6 +1045,7 @@ module Bundler
1050
1045
 
1051
1046
  def dup_for_full_unlock
1052
1047
  unlocked_definition = self.class.new(@lockfile, @dependencies, @sources, true, @ruby_version, @optional_groups, @gemfiles)
1048
+ unlocked_definition.source_requirements = source_requirements
1053
1049
  unlocked_definition.gem_version_promoter.tap do |gvp|
1054
1050
  gvp.level = gem_version_promoter.level
1055
1051
  gvp.strict = gem_version_promoter.strict
@@ -2,8 +2,6 @@
2
2
 
3
3
  module Bundler
4
4
  module ForcePlatform
5
- private
6
-
7
5
  # The `:force_ruby_platform` value used by dependencies for resolution, and
8
6
  # by locked specifications for materialization is `false` by default, except
9
7
  # for TruffleRuby. TruffleRuby generally needs to force the RUBY platform
@@ -272,7 +272,7 @@ module Bundler
272
272
  end
273
273
 
274
274
  def parse_platform(line)
275
- @platforms << Gem::Platform.new($1) if line =~ /^ (.*)$/
275
+ @platforms << Gem::Platform.new($1.strip) if line =~ /^ (.*)$/
276
276
  end
277
277
 
278
278
  def parse_bundled_with(line)
@@ -196,6 +196,7 @@ module Bundler
196
196
 
197
197
  FileUtils.rm_rf(new_cache_path)
198
198
  FileUtils.cp_r(install_path, new_cache_path)
199
+ FileUtils.rm_rf(app_cache_path.join(".git"))
199
200
  FileUtils.touch(app_cache_path.join(".bundlecache"))
200
201
  end
201
202
 
@@ -72,6 +72,12 @@ module Bundler
72
72
  end
73
73
  end
74
74
 
75
+ def include_remote_specs(names)
76
+ names.each do |name|
77
+ get_package(name).consider_remote_versions!
78
+ end
79
+ end
80
+
75
81
  private
76
82
 
77
83
  def indirect_pins(names)
@@ -15,7 +15,7 @@ module Bundler
15
15
  class Package
16
16
  attr_reader :name, :platforms, :dependency, :locked_version
17
17
 
18
- def initialize(name, platforms, locked_specs:, unlock:, prerelease: false, dependency: nil)
18
+ def initialize(name, platforms, locked_specs:, unlock:, prerelease: false, prefer_local: false, dependency: nil)
19
19
  @name = name
20
20
  @platforms = platforms
21
21
  @locked_version = locked_specs[name].first&.version
@@ -23,6 +23,7 @@ module Bundler
23
23
  @dependency = dependency || Dependency.new(name, @locked_version)
24
24
  @top_level = !dependency.nil?
25
25
  @prerelease = @dependency.prerelease? || @locked_version&.prerelease? || prerelease ? :consider_first : :ignore
26
+ @prefer_local = prefer_local
26
27
  end
27
28
 
28
29
  def platform_specs(specs)
@@ -69,6 +70,14 @@ module Bundler
69
70
  @prerelease = :consider_last
70
71
  end
71
72
 
73
+ def prefer_local?
74
+ @prefer_local
75
+ end
76
+
77
+ def consider_remote_versions!
78
+ @prefer_local = false
79
+ end
80
+
72
81
  def force_ruby_platform?
73
82
  @dependency.force_ruby_platform
74
83
  end
@@ -84,9 +84,9 @@ module Bundler
84
84
  rescue PubGrub::SolveFailure => e
85
85
  incompatibility = e.incompatibility
86
86
 
87
- names_to_unlock, names_to_allow_prereleases_for, extended_explanation = find_names_to_relax(incompatibility)
87
+ names_to_unlock, names_to_allow_prereleases_for, names_to_allow_remote_specs_for, extended_explanation = find_names_to_relax(incompatibility)
88
88
 
89
- names_to_relax = names_to_unlock + names_to_allow_prereleases_for
89
+ names_to_relax = names_to_unlock + names_to_allow_prereleases_for + names_to_allow_remote_specs_for
90
90
 
91
91
  if names_to_relax.any?
92
92
  if names_to_unlock.any?
@@ -96,11 +96,17 @@ module Bundler
96
96
  end
97
97
 
98
98
  if names_to_allow_prereleases_for.any?
99
- Bundler.ui.debug "Found conflicts with dependencies with prereleases. Will retrying considering prereleases for #{names_to_allow_prereleases_for.join(", ")}...", true
99
+ Bundler.ui.debug "Found conflicts with dependencies with prereleases. Will retry considering prereleases for #{names_to_allow_prereleases_for.join(", ")}...", true
100
100
 
101
101
  @base.include_prereleases(names_to_allow_prereleases_for)
102
102
  end
103
103
 
104
+ if names_to_allow_remote_specs_for.any?
105
+ Bundler.ui.debug "Found conflicts with local versions of #{names_to_allow_remote_specs_for.join(", ")}. Will retry considering remote versions...", true
106
+
107
+ @base.include_remote_specs(names_to_allow_remote_specs_for)
108
+ end
109
+
104
110
  root, logger = setup_solver
105
111
 
106
112
  Bundler.ui.debug "Retrying resolution...", true
@@ -120,6 +126,7 @@ module Bundler
120
126
  def find_names_to_relax(incompatibility)
121
127
  names_to_unlock = []
122
128
  names_to_allow_prereleases_for = []
129
+ names_to_allow_remote_specs_for = []
123
130
  extended_explanation = nil
124
131
 
125
132
  while incompatibility.conflict?
@@ -134,6 +141,8 @@ module Bundler
134
141
  names_to_unlock << name
135
142
  elsif package.ignores_prereleases? && @all_specs[name].any? {|s| s.version.prerelease? }
136
143
  names_to_allow_prereleases_for << name
144
+ elsif package.prefer_local? && @all_specs[name].any? {|s| !s.is_a?(StubSpecification) }
145
+ names_to_allow_remote_specs_for << name
137
146
  end
138
147
 
139
148
  no_versions_incompat = [cause.incompatibility, cause.satisfier].find {|incompat| incompat.cause.is_a?(PubGrub::Incompatibility::NoVersions) }
@@ -143,7 +152,7 @@ module Bundler
143
152
  end
144
153
  end
145
154
 
146
- [names_to_unlock.uniq, names_to_allow_prereleases_for.uniq, extended_explanation]
155
+ [names_to_unlock.uniq, names_to_allow_prereleases_for.uniq, names_to_allow_remote_specs_for.uniq, extended_explanation]
147
156
  end
148
157
 
149
158
  def parse_dependency(package, dependency)
@@ -244,7 +253,7 @@ module Bundler
244
253
 
245
254
  def all_versions_for(package)
246
255
  name = package.name
247
- results = (@base[name] + filter_prereleases(@all_specs[name], package)).uniq {|spec| [spec.version.hash, spec.platform] }
256
+ results = (@base[name] + filter_specs(@all_specs[name], package)).uniq {|spec| [spec.version.hash, spec.platform] }
248
257
 
249
258
  if name == "bundler" && !bundler_pinned_to_current_version?
250
259
  bundler_spec = Gem.loaded_specs["bundler"]
@@ -368,12 +377,22 @@ module Bundler
368
377
  end
369
378
  end
370
379
 
380
+ def filter_specs(specs, package)
381
+ filter_remote_specs(filter_prereleases(specs, package), package)
382
+ end
383
+
371
384
  def filter_prereleases(specs, package)
372
385
  return specs unless package.ignores_prereleases? && specs.size > 1
373
386
 
374
387
  specs.reject {|s| s.version.prerelease? }
375
388
  end
376
389
 
390
+ def filter_remote_specs(specs, package)
391
+ return specs unless package.prefer_local?
392
+
393
+ specs.select {|s| s.is_a?(StubSpecification) }
394
+ end
395
+
377
396
  # Ignore versions that depend on themselves incorrectly
378
397
  def filter_invalid_self_dependencies(specs, name)
379
398
  specs.reject do |s|
@@ -405,10 +424,13 @@ module Bundler
405
424
 
406
425
  dep_range = dep_constraint.range
407
426
  versions = select_sorted_versions(dep_package, dep_range)
408
- if versions.empty? && dep_package.ignores_prereleases?
409
- @all_versions.delete(dep_package)
410
- @sorted_versions.delete(dep_package)
411
- dep_package.consider_prereleases!
427
+ if versions.empty?
428
+ if dep_package.ignores_prereleases? || dep_package.prefer_local?
429
+ @all_versions.delete(dep_package)
430
+ @sorted_versions.delete(dep_package)
431
+ end
432
+ dep_package.consider_prereleases! if dep_package.ignores_prereleases?
433
+ dep_package.consider_remote_versions! if dep_package.prefer_local?
412
434
  versions = select_sorted_versions(dep_package, dep_range)
413
435
  end
414
436
 
@@ -237,26 +237,20 @@ module Gem
237
237
 
238
238
  include ::Bundler::ForcePlatform
239
239
 
240
+ attr_reader :force_ruby_platform
241
+
240
242
  attr_accessor :source, :groups
241
243
 
242
244
  alias_method :eql?, :==
243
245
 
244
- def force_ruby_platform
245
- return @force_ruby_platform if defined?(@force_ruby_platform) && !@force_ruby_platform.nil?
246
-
247
- @force_ruby_platform = default_force_ruby_platform
248
- end
249
-
250
- def encode_with(coder)
251
- to_yaml_properties.each do |ivar|
252
- coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar)
246
+ unless method_defined?(:encode_with, false)
247
+ def encode_with(coder)
248
+ [:@name, :@requirement, :@type, :@prerelease, :@version_requirements].each do |ivar|
249
+ coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar)
250
+ end
253
251
  end
254
252
  end
255
253
 
256
- def to_yaml_properties
257
- instance_variables.reject {|p| ["@source", "@groups"].include?(p.to_s) }
258
- end
259
-
260
254
  def to_lock
261
255
  out = String.new(" #{name}")
262
256
  unless requirement.none?
@@ -128,11 +128,6 @@ module Bundler
128
128
  spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache)
129
129
  end
130
130
 
131
- Dir[cache_path.join("*/.git")].each do |git_dir|
132
- FileUtils.rm_rf(git_dir)
133
- FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
134
- end
135
-
136
131
  prune_cache(cache_path) unless Bundler.settings[:no_prune]
137
132
  end
138
133
 
@@ -84,6 +84,10 @@ module Bundler
84
84
  end
85
85
  end
86
86
 
87
+ def not_a_bare_repository?
88
+ git_local("rev-parse", "--is-bare-repository", dir: path).strip == "false"
89
+ end
90
+
87
91
  def contains?(commit)
88
92
  allowed_with_path do
89
93
  result, status = git_null("branch", "--contains", commit, dir: path)
@@ -332,8 +336,6 @@ module Bundler
332
336
  config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
333
337
  remote.userinfo ||= config_auth
334
338
  remote.to_s
335
- elsif File.exist?(uri)
336
- "file://#{uri}"
337
339
  else
338
340
  uri.to_s
339
341
  end
@@ -164,7 +164,8 @@ module Bundler
164
164
  "does not exist. Run `bundle config unset local.#{override_for(original_path)}` to remove the local override"
165
165
  end
166
166
 
167
- set_local!(path)
167
+ @local = true
168
+ set_paths!(path)
168
169
 
169
170
  # Create a new git proxy without the cached revision
170
171
  # so the Gemfile.lock always picks up the new revision.
@@ -187,13 +188,13 @@ module Bundler
187
188
  end
188
189
 
189
190
  def specs(*)
190
- set_local!(app_cache_path) if has_app_cache? && !local?
191
+ set_cache_path!(app_cache_path) if use_app_cache?
191
192
 
192
193
  if requires_checkout? && !@copied
194
+ FileUtils.rm_rf(app_cache_path) if use_app_cache? && git_proxy.not_a_bare_repository?
195
+
193
196
  fetch
194
- git_proxy.copy_to(install_path, submodules)
195
- serialize_gemspecs_in(install_path)
196
- @copied = true
197
+ checkout
197
198
  end
198
199
 
199
200
  local_specs
@@ -206,10 +207,7 @@ module Bundler
206
207
  print_using_message "Using #{version_message(spec, options[:previous_spec])} from #{self}"
207
208
 
208
209
  if (requires_checkout? && !@copied) || force
209
- Bundler.ui.debug " * Checking out revision: #{ref}"
210
- git_proxy.copy_to(install_path, submodules)
211
- serialize_gemspecs_in(install_path)
212
- @copied = true
210
+ checkout
213
211
  end
214
212
 
215
213
  generate_bin_options = { disable_extensions: !Bundler.rubygems.spec_missing_extensions?(spec), build_args: options[:build_args] }
@@ -221,12 +219,13 @@ module Bundler
221
219
  def cache(spec, custom_path = nil)
222
220
  app_cache_path = app_cache_path(custom_path)
223
221
  return unless Bundler.feature_flag.cache_all?
224
- return if path == app_cache_path
222
+ return if install_path == app_cache_path
223
+ return if cache_path == app_cache_path
225
224
  cached!
226
225
  FileUtils.rm_rf(app_cache_path)
227
226
  git_proxy.checkout if requires_checkout?
228
- git_proxy.copy_to(app_cache_path, @submodules)
229
- serialize_gemspecs_in(app_cache_path)
227
+ FileUtils.cp_r("#{cache_path}/.", app_cache_path)
228
+ FileUtils.touch(app_cache_path.join(".bundlecache"))
230
229
  end
231
230
 
232
231
  def load_spec_files
@@ -270,6 +269,13 @@ module Bundler
270
269
 
271
270
  private
272
271
 
272
+ def checkout
273
+ Bundler.ui.debug " * Checking out revision: #{ref}"
274
+ git_proxy.copy_to(install_path, submodules)
275
+ serialize_gemspecs_in(install_path)
276
+ @copied = true
277
+ end
278
+
273
279
  def humanized_ref
274
280
  if local?
275
281
  path
@@ -298,16 +304,29 @@ module Bundler
298
304
  end
299
305
  end
300
306
 
301
- def set_local!(path)
302
- @local = true
303
- @local_specs = @git_proxy = nil
304
- @cache_path = @install_path = path
307
+ def set_paths!(path)
308
+ set_cache_path!(path)
309
+ set_install_path!(path)
310
+ end
311
+
312
+ def set_cache_path!(path)
313
+ @git_proxy = nil
314
+ @cache_path = path
315
+ end
316
+
317
+ def set_install_path!(path)
318
+ @local_specs = nil
319
+ @install_path = path
305
320
  end
306
321
 
307
322
  def has_app_cache?
308
323
  cached_revision && super
309
324
  end
310
325
 
326
+ def use_app_cache?
327
+ has_app_cache? && !local?
328
+ end
329
+
311
330
  def requires_checkout?
312
331
  allow_git_ops? && !local? && !cached_revision_checked_out?
313
332
  end
@@ -94,7 +94,7 @@ module Bundler
94
94
  end
95
95
 
96
96
  def delete(specs)
97
- specs.each {|spec| @specs.delete(spec) }
97
+ Array(specs).each {|spec| @specs.delete(spec) }
98
98
 
99
99
  reset!
100
100
  end
@@ -280,7 +280,7 @@ module Bundler
280
280
  if platform
281
281
  GemHelpers.select_best_platform_match(specs_for_name, platform, force_ruby: dep.force_ruby_platform)
282
282
  else
283
- GemHelpers.select_best_local_platform_match(specs_for_name, force_ruby: dep.force_ruby_platform)
283
+ GemHelpers.select_best_local_platform_match(specs_for_name, force_ruby: dep.force_ruby_platform || dep.default_force_ruby_platform)
284
284
  end
285
285
  end
286
286
 
@@ -10,11 +10,15 @@ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_O
10
10
 
11
11
  Install the gem and add to the application's Gemfile by executing:
12
12
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
14
16
 
15
17
  If bundler is not being used to manage dependencies, install the gem by executing:
16
18
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
18
22
 
19
23
  ## Usage
20
24
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.5.16".freeze
4
+ VERSION = "2.5.18".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -41,7 +41,7 @@ module Bundler
41
41
  HASH_REGEX = /
42
42
  ^
43
43
  ([ ]*) # indentations
44
- (.+) # key
44
+ ([^#]+) # key excludes comment char '#'
45
45
  (?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
46
46
  [ ]?
47
47
  (['"]?) # optional opening quote
@@ -157,9 +157,14 @@ that is a dependency of an existing gem. You can use the
157
157
 
158
158
  gem_specs = Gem::Specification.find_all_by_name(name, original_gem_version[name])
159
159
 
160
- say("Gem '#{name}' is not installed") if gem_specs.empty?
161
- gem_specs.each do |spec|
162
- deplist.add spec
160
+ if gem_specs.empty?
161
+ say("Gem '#{name}' is not installed")
162
+ else
163
+ gem_specs.reject!(&:default_gem?) if gem_specs.size > 1
164
+
165
+ gem_specs.each do |spec|
166
+ deplist.add spec
167
+ end
163
168
  end
164
169
  end
165
170
 
@@ -337,4 +337,12 @@ class Gem::Dependency
337
337
  :released
338
338
  end
339
339
  end
340
+
341
+ def encode_with(coder) # :nodoc:
342
+ coder.add "name", @name
343
+ coder.add "requirement", @requirement
344
+ coder.add "type", @type
345
+ coder.add "prerelease", @prerelease
346
+ coder.add "version_requirements", @version_requirements
347
+ end
340
348
  end
@@ -132,7 +132,7 @@ module Gem::QueryUtils
132
132
  version_matches = show_prereleases? || !s.version.prerelease?
133
133
 
134
134
  name_matches && version_matches
135
- end
135
+ end.uniq(&:full_name)
136
136
 
137
137
  spec_tuples = specs.map do |spec|
138
138
  [spec.name_tuple, spec]
@@ -251,7 +251,15 @@ class Gem::Uninstaller
251
251
  raise Gem::FilePermissionError, spec.base_dir unless
252
252
  File.writable?(spec.base_dir)
253
253
 
254
- safe_delete { FileUtils.rm_r spec.full_gem_path }
254
+ full_gem_path = spec.full_gem_path
255
+ exclusions = []
256
+
257
+ if default_spec_matches?(spec) && spec.executables.any?
258
+ exclusions = spec.executables.map {|exe| File.join(spec.bin_dir, exe) }
259
+ exclusions << File.dirname(exclusions.last) until exclusions.last == full_gem_path
260
+ end
261
+
262
+ safe_delete { rm_r full_gem_path, exclusions: exclusions }
255
263
  safe_delete { FileUtils.rm_r spec.extension_dir }
256
264
 
257
265
  old_platform_name = spec.original_name
@@ -378,6 +386,12 @@ class Gem::Uninstaller
378
386
 
379
387
  private
380
388
 
389
+ def rm_r(path, exclusions:)
390
+ FileUtils::Entry_.new(path).postorder_traverse do |ent|
391
+ ent.remove unless exclusions.include?(ent.path)
392
+ end
393
+ end
394
+
381
395
  def specification_record
382
396
  @specification_record ||= @install_dir ? Gem::SpecificationRecord.from_path(@install_dir) : Gem::Specification.specification_record
383
397
  end
@@ -41,7 +41,7 @@ module Gem
41
41
  HASH_REGEX = /
42
42
  ^
43
43
  ([ ]*) # indentations
44
- (.+) # key
44
+ ([^#]+) # key excludes comment char '#'
45
45
  (?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
46
46
  [ ]?
47
47
  (['"]?) # optional opening quote
data/lib/rubygems.rb CHANGED
@@ -9,7 +9,7 @@
9
9
  require "rbconfig"
10
10
 
11
11
  module Gem
12
- VERSION = "3.5.16"
12
+ VERSION = "3.5.18"
13
13
  end
14
14
 
15
15
  # Must be first since it unloads the prelude from 1.9.2
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.5.16"
5
+ s.version = "3.5.18"
6
6
  s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
7
7
  s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.16
4
+ version: 3.5.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: exe
18
18
  cert_chain: []
19
- date: 2024-07-18 00:00:00.000000000 Z
19
+ date: 2024-08-26 00:00:00.000000000 Z
20
20
  dependencies: []
21
21
  description: |-
22
22
  A package (also known as a library) contains a set of functionality
@@ -727,7 +727,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
727
727
  - !ruby/object:Gem::Version
728
728
  version: '0'
729
729
  requirements: []
730
- rubygems_version: 3.5.16
730
+ rubygems_version: 3.5.18
731
731
  signing_key:
732
732
  specification_version: 4
733
733
  summary: RubyGems is a package management framework for Ruby. This gem is downloaded