Permalink
Browse files

Respect --without in check, and exit 1 if the check fails

  • Loading branch information...
1 parent aa40749 commit 605def7813900fa570587950abe7da6923c66048 @thinkerbot thinkerbot committed with indirect Mar 15, 2010
Showing with 24 additions and 10 deletions.
  1. +2 −1 lib/bundler/cli.rb
  2. +8 −8 lib/bundler/environment.rb
  3. +14 −1 spec/other/check_spec.rb
View
@@ -38,11 +38,12 @@ def check
Bundler.ui.error "Try running `bundle install`"
exit 1
else
- not_installed = env.specs.select { |spec| !spec.loaded_from }
+ not_installed = env.requested_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`"
+ exit 1
else
Bundler.ui.info "The Gemfile's dependencies are satisfied"
end
View
@@ -16,6 +16,14 @@ def index
end
end
+ def requested_specs
+ @requested_specs ||= begin
+ groups = @definition.groups - Bundler.settings.without
+ groups.map! { |g| g.to_sym }
+ groups.any? ? specs_for(groups) : []
+ end
+ end
+
private
def runtime_gems
@@ -28,14 +36,6 @@ def runtime_gems
end
end
- def requested_specs
- @requested_specs ||= begin
- groups = @definition.groups - Bundler.settings.without
- groups.map! { |g| g.to_sym }
- groups.any? ? specs_for(groups) : []
- end
- end
-
def specs_for(groups)
deps = dependencies.select { |d| (d.groups & groups).any? }
# deps.any? ? specs.for(deps) : specs
View
@@ -54,14 +54,26 @@
out.should include('Conflict on: "activesupport"')
end
- it "ensures that gems are actually installed and not just cached" do
+ it "remembers --without option from install" do
gemfile <<-G
source "file://#{gem_repo1}"
group :foo do
gem "rack"
end
G
+ bundle "install --without foo"
+ bundle "check"
+ @exitstatus.should == 0 if @exitstatus
+ out.should == "The Gemfile's dependencies are satisfied"
+ end
+
+ it "ensures that gems are actually installed and not just cached" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", :group => :foo
+ G
+
bundle "install --without foo"
gemfile <<-G
@@ -70,6 +82,7 @@
G
bundle "check"
+ @exitstatus.should == 1 if @exitstatus
out.should include("rack (1.0.0) is cached, but not installed")
end

0 comments on commit 605def7

Please sign in to comment.