[rubygems/rubygems] Auto-heal empty installation directory

https://github.com/rubygems/rubygems/commit/9720a9b980
This commit is contained in:
David Rodríguez 2025-01-31 16:20:54 +01:00 committed by Hiroshi SHIBATA
parent 78ef59acf7
commit ac093f4350
2 changed files with 14 additions and 3 deletions

View File

@ -259,7 +259,7 @@ module Gem
end
def installation_missing?
!default_gem? && !File.directory?(full_gem_path)
!default_gem? && (!Dir.exist?(full_gem_path) || Dir.empty?(full_gem_path))
end
unless VALIDATES_FOR_RESOLUTION

View File

@ -100,12 +100,23 @@ RSpec.describe "bundle install with gem sources" do
gem 'myrack'
G
FileUtils.rm_rf(default_bundle_path("gems/myrack-1.0.0"))
gem_dir = default_bundle_path("gems/myrack-1.0.0")
FileUtils.rm_rf(gem_dir)
bundle "install --verbose"
expect(out).to include("Installing myrack 1.0.0")
expect(default_bundle_path("gems/myrack-1.0.0")).to exist
expect(gem_dir).to exist
expect(the_bundle).to include_gems("myrack 1.0.0")
FileUtils.rm_rf(gem_dir)
Dir.mkdir(gem_dir)
bundle "install --verbose"
expect(out).to include("Installing myrack 1.0.0")
expect(gem_dir).to exist
expect(the_bundle).to include_gems("myrack 1.0.0")
end