Skip to content

Commit ac093f4

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Auto-heal empty installation directory
ruby/rubygems@9720a9b980
1 parent 78ef59a commit ac093f4

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lib/bundler/rubygems_ext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def nondevelopment_dependencies
259259
end
260260

261261
def installation_missing?
262-
!default_gem? && !File.directory?(full_gem_path)
262+
!default_gem? && (!Dir.exist?(full_gem_path) || Dir.empty?(full_gem_path))
263263
end
264264

265265
unless VALIDATES_FOR_RESOLUTION

spec/bundler/commands/install_spec.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,23 @@
100100
gem 'myrack'
101101
G
102102

103-
FileUtils.rm_rf(default_bundle_path("gems/myrack-1.0.0"))
103+
gem_dir = default_bundle_path("gems/myrack-1.0.0")
104+
105+
FileUtils.rm_rf(gem_dir)
104106

105107
bundle "install --verbose"
106108

107109
expect(out).to include("Installing myrack 1.0.0")
108-
expect(default_bundle_path("gems/myrack-1.0.0")).to exist
110+
expect(gem_dir).to exist
111+
expect(the_bundle).to include_gems("myrack 1.0.0")
112+
113+
FileUtils.rm_rf(gem_dir)
114+
Dir.mkdir(gem_dir)
115+
116+
bundle "install --verbose"
117+
118+
expect(out).to include("Installing myrack 1.0.0")
119+
expect(gem_dir).to exist
109120
expect(the_bundle).to include_gems("myrack 1.0.0")
110121
end
111122

0 commit comments

Comments
 (0)