[rubygems/rubygems] Allow gem pristine to reset default gems too

c9e665eb8a
This commit is contained in:
David Rodríguez 2024-10-08 21:25:23 +02:00 committed by git
parent 73834f11fa
commit 9f812522f5
2 changed files with 5 additions and 6 deletions

View file

@ -134,11 +134,8 @@ extensions will be restored.
say "Restoring gems to pristine condition..." say "Restoring gems to pristine condition..."
specs.each do |spec| specs.group_by(&:full_name_with_location).values.each do |grouped_specs|
if spec.default_gem? spec = grouped_specs.find {|s| !s.default_gem? } || grouped_specs.first
say "Skipped #{spec.full_name}, it is a default gem"
next
end
if options.key? :skip if options.key? :skip
if options[:skip].include? spec.name if options[:skip].include? spec.name
@ -188,6 +185,7 @@ extensions will be restored.
env_shebang: env_shebang, env_shebang: env_shebang,
build_args: spec.build_args, build_args: spec.build_args,
bin_dir: bin_dir, bin_dir: bin_dir,
install_as_default: spec.default_gem?,
} }
if options[:only_executables] if options[:only_executables]

View file

@ -642,7 +642,8 @@ class TestGemCommandsPristineCommand < Gem::TestCase
assert_equal( assert_equal(
[ [
"Restoring gems to pristine condition...", "Restoring gems to pristine condition...",
"Skipped default-2.0.0.0, it is a default gem", "Cached gem for default-2.0.0.0 not found, attempting to fetch...",
"Skipped default-2.0.0.0, it was not found from cache and remote sources",
], ],
@ui.output.split("\n") @ui.output.split("\n")
) )