aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/source/rubygems.rb10
-rw-r--r--spec/install/gems/simple_case_spec.rb16
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 0b5d2641..28f6b47c 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -68,7 +68,7 @@ module Bundler
end
def install(spec)
- if installed_specs[spec].any?
+ if installed_specs[spec].any? && gem_dir_exists?(spec)
Bundler.ui.info "Using #{spec.name} (#{spec.version}) "
return
end
@@ -250,6 +250,14 @@ module Bundler
Bundler.rubygems.sources = old
end
end
+
+ def gem_dir_exists?(spec)
+ if spec.name == "bundler"
+ true
+ else
+ File.directory?(spec.full_gem_path)
+ end
+ end
end
end
diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb
index 4c38e77b..f147b35b 100644
--- a/spec/install/gems/simple_case_spec.rb
+++ b/spec/install/gems/simple_case_spec.rb
@@ -337,6 +337,22 @@ describe "bundle install with gem sources" do
G
expect(exitstatus).to eq(0)
end
+
+ it "reinstalls the gem if the gem dir is missing but the specification file exists" do
+ gemfile(<<-G)
+ source "file://#{gem_repo1}"
+
+ gem 'foo'
+ G
+
+ bundle "install --path vendor/bundle"
+
+ FileUtils.rm_rf(vendored_gems('gems/foo-1.0'))
+
+ bundle "install"
+
+ expect(vendored_gems('gems/foo-1.0')).to exist
+ end
end
describe "when Bundler root contains regex chars" do