From 187e9d06e9f4255e9069a3fc3c7e232e07be8395 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 5 Dec 2007 13:41:00 +0100 Subject: Move summary outputter to lib/bacon.rb darcs-hash:20071205124100-4fc50-369b336a902888b068c626b08a7ae5869d31c117.gz --- bin/bacon | 9 +-------- lib/bacon.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bin/bacon b/bin/bacon index 4ed32e0..ad70263 100755 --- a/bin/bacon +++ b/bin/bacon @@ -97,14 +97,7 @@ end require 'bacon' Bacon.extend Bacon.const_get(output) -at_exit { - Bacon.handle_summary - if $! - raise $! - elsif Bacon::Counter[:errors] + Bacon::Counter[:failed] > 0 - exit 1 - end -} +Bacon.summary_on_exit files.each { |file| load file diff --git a/lib/bacon.rb b/lib/bacon.rb index 884f6f2..80d5465 100644 --- a/lib/bacon.rb +++ b/lib/bacon.rb @@ -13,6 +13,19 @@ module Bacon RestrictName = // unless defined? RestrictName RestrictContext = // unless defined? RestrictContext + def self.summary_on_exit + return if Bacon::Counter[:installed_summary] > 0 + at_exit { + Bacon.handle_summary + if $! + raise $! + elsif Bacon::Counter[:errors] + Bacon::Counter[:failed] > 0 + exit 1 + end + } + Bacon::Counter[:installed_summary] += 1 + end + module SpecDoxOutput def handle_specification(name) puts name -- cgit 1.4.1