summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2013-12-20 22:17:02 -0500
committerTerence Lee <hone02@gmail.com>2013-12-21 00:40:47 -0500
commit2f62ac536d41c46609018ff55666b6e71cdfaf19 (patch)
tree1a7bd71ee7406de241f786b89699a60ece3fd742
parentd1349e19a295d5798cd5f5bd0bdf4d491eab4372 (diff)
downloadbundler-fix_missing_gem_dir.tar.gz
reinstalls gem if gem dir is missing but spec existsfix_missing_gem_dir
-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 3a285ae0ff..8333a48ac0 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -68,7 +68,7 @@ module Bundler
end
def install(spec)
- return ["Using #{version_message(spec)}", nil] if installed_specs[spec].any?
+ return ["Using #{version_message(spec)}", nil] if installed_specs[spec].any? && gem_dir_exists?(spec)
# Download the gem to get the spec, because some specs that are returned
# by rubygems.org are broken and wrong.
@@ -273,6 +273,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 250681f48b..20a9ffdd13 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