summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-03-05 14:27:33 -0800
committerCarl Lerche <carllerche@mac.com>2010-03-09 12:16:26 -0800
commitb5f28d641cb0b282196ff70305e4f5ea8b29a807 (patch)
treed8aa756f4d8e78a31339b384ba7528632a2880b7
parentd56104cf29a88ac434cbed80a0ee3623ec1d902d (diff)
downloadbundler-b5f28d641cb0b282196ff70305e4f5ea8b29a807.tar.gz
Fix `bundle check` when there are gems that are cached but not installed
-rw-r--r--lib/bundler/cli.rb15
-rw-r--r--spec/other/check_spec.rb19
2 files changed, 30 insertions, 4 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 57b262c58a..968b345b6b 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -31,14 +31,21 @@ module Bundler
# Check top level dependencies
missing = env.dependencies.select { |d| env.index.search(d).empty? }
if missing.any?
- puts "The following dependencies are missing"
+ Bundler.ui.error "The following dependencies are missing"
missing.each do |d|
- puts " * #{d}"
+ Bundler.ui.error " * #{d}"
end
+ Bundler.ui.error "Try running `bundle install`"
exit 1
else
- env.specs
- puts "The Gemfile's dependencies are satisfied"
+ not_installed = env.specs.select { |spec| !spec.loaded_from }
+
+ if not_installed.any?
+ not_installed.each { |s| Bundler.ui.error "#{s.name} (#{s.version}) is cached, but not installed" }
+ Bundler.ui.error "Try running `bundle install`"
+ else
+ Bundler.ui.info "The Gemfile's dependencies are satisfied"
+ end
end
end
diff --git a/spec/other/check_spec.rb b/spec/other/check_spec.rb
index 1ddf555d16..0351208ee8 100644
--- a/spec/other/check_spec.rb
+++ b/spec/other/check_spec.rb
@@ -54,6 +54,25 @@ describe "bundle check" do
out.should include('Conflict on: "activesupport"')
end
+ it "ensures that gems are actually installed and not just cached" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ group :foo do
+ gem "rack"
+ end
+ G
+
+ bundle "install --without foo"
+
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ bundle "check"
+ out.should include("rack (1.0.0) is cached, but not installed")
+ end
+
it "outputs an error when the default Gemspec is not found" do
bundle :check
@exitstatus.should_not == 0 if @exitstatus