lib/bait/build.rb in bait-0.3.2 vs lib/bait/build.rb in bait-0.4.0

- old
+ new

@@ -1,19 +1,14 @@ -require 'bait' -require 'moneta' -require "toystore" -require 'bait/simple_query' +require 'bait/object' require 'bait/tester' +require 'ansi2html/main' module Bait - class Build - include Toy::Store - extend Bait::SimpleQuery + class Build < Bait::Object + adapter :memory, + Moneta.new(:YAML, :file => Bait.db_file('builds')) - @@db_file = Bait.db_file('builds') - adapter :memory, Moneta.new(:YAML, :file => @@db_file) - attribute :ref, String attribute :owner_name, String attribute :owner_email, String attribute :name, String attribute :clone_url, String @@ -29,22 +24,25 @@ end def test_later self.tested = false self.save - unless Bait.env == "test" - fork do - self.tester.clone! - self.tester.test! - end + fork do + self.tester.clone! + self.tester.test! end self end def queued? !self.reload.tested? end - after_destroy { tester.cleanup! } + def html_output + out = StringIO.new + ::ANSI2HTML::Main.new(self.output, out) + return out.string + end + after_destroy { tester.cleanup! } end end