diff options
-rw-r--r-- | lib/bundler/rubygems_ext.rb | 2 | ||||
-rw-r--r-- | spec/bundler/commands/install_spec.rb | 15 |
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 |