diff --git a/README.md b/README.md index 3a401d5..194fdbe 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Nitra is a multi-process, optionally multi-server rspec and cucumber runner that ## Philosophy * Nitra attempts to do the simplest thing possible * Nitra (ab)uses unix primitives where possible -* Nitra doesn't do thing that unix alnext_file does better (eg. rsync) +* Nitra doesn't do things that unix already does better (eg. rsync) * IPC is accomplished via pipes and select * Forking is used heavily for several reasons * Running nitra locally should be easy diff --git a/bin/nitra b/bin/nitra index 1d88762..177440b 100755 --- a/bin/nitra +++ b/bin/nitra @@ -8,5 +8,20 @@ Nitra::CommandLine.new(configuration, ARGV) if configuration.slave_mode Nitra::Slave::Server.new.run else - exit Nitra::Master.new(configuration, ARGV).run ? 0 : 1 + result = Nitra::Master.new(configuration, ARGV).run + + case result + when Nitra::Master::ABORTED + exit 1 + when Nitra::Master::TEST_FAILURES + exit 2 + when Nitra::Master::FAILURE + exit 3 + when Nitra::Master::UNPROCESSED_FILES + exit 4 + when Nitra::Master::SUCCESS + exit 0 + else + exit 127 + end end diff --git a/lib/nitra/master.rb b/lib/nitra/master.rb index d6e64dd..be60457 100644 --- a/lib/nitra/master.rb +++ b/lib/nitra/master.rb @@ -1,6 +1,12 @@ class Nitra::Master attr_reader :configuration, :files_by_framework + ABORTED = :aborted + FAILURE = :failure + SUCCESS = :success + TEST_FAILURES = :test_failures + UNPROCESSED_FILES = :unprocessed_files + def initialize(configuration, files = nil) @configuration = configuration if configuration.frameworks.any? @@ -43,7 +49,17 @@ def run formatter.finish burndown.finish configuration.burndown_report if configuration.burndown_report - !$aborted && progress.files_completed == progress.file_count && progress.failure_count.zero? && !progress.failure + if $aborted + ABORTED + elsif progress.files_completed != progress.file_count + UNPROCESSED_FILES + elsif progress.failure_count.positive? + TEST_FAILURES + elsif progress.failure + FAILURE + else + SUCCESS + end end protected