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-24 22:40:38 -0500
commitbd0243ee3396a74227dec330c8a2c159deccb5a7 (patch)
treeeb6c224b793524680e43dc118beb5b95d1032b25
parent348fa0d6ba16f3f50985f47c71e1e8869dd6e5bf (diff)
downloadbundler-bd0243ee3396a74227dec330c8a2c159deccb5a7.tar.gz
reinstalls gem if gem dir is missing but spec exists
Conflicts: lib/bundler/source/rubygems.rb
-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 0b5d264118..28f6b47c2f 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 4c38e77b82..f147b35b13 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