summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2025-01-31 16:20:54 +0100
committerHiroshi SHIBATA <[email protected]>2025-02-06 15:58:00 +0900
commitac093f4350ae8f41ef18ac64829ea9dbc272063d (patch)
treeb752562f59663c3c75bea06ed108e594cddcc24e
parent78ef59acf7f443b7f87039d5927005a2f8f0bb36 (diff)
[rubygems/rubygems] Auto-heal empty installation directory
https://github.com/rubygems/rubygems/commit/9720a9b980
-rw-r--r--lib/bundler/rubygems_ext.rb2
-rw-r--r--spec/bundler/commands/install_spec.rb15
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index 33463618e5..50c650d378 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -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
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 3abe021855..92c8f52195 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -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