diff --git a/lib/assets/javascripts/flowerbox.js.coffee b/lib/assets/javascripts/flowerbox.js.coffee index 105326f..eb0414e 100644 --- a/lib/assets/javascripts/flowerbox.js.coffee +++ b/lib/assets/javascripts/flowerbox.js.coffee @@ -1,7 +1,3 @@ -#= require_self -#= require flowerbox/result -#= require flowerbox/exception -# Flowerbox = debug: false ping: -> @@ -37,3 +33,25 @@ Flowerbox = fail: -> +class Flowerbox.Exception + constructor: (@source, @name, @stack) -> + + toJSON: -> + { status: Flowerbox.Result.FAILURE, source: @source, name: @name, trace: { stack: @stack } } + +class Flowerbox.Result + @SUCCESS = 'success' + @PENDING = 'pending' + @UNDEFINED = 'undefined' + @FAILURE = 'failure' + @SKIPPED = 'skipped' + + constructor: (data) -> + for key, value of data + this[key] = value + + this.status ||= Flowerbox.Result.SKIPPED + this.failures ||= [] + + toJSON: => this + diff --git a/lib/assets/javascripts/flowerbox/exception.js.coffee b/lib/assets/javascripts/flowerbox/exception.js.coffee deleted file mode 100644 index e6903a7..0000000 --- a/lib/assets/javascripts/flowerbox/exception.js.coffee +++ /dev/null @@ -1,5 +0,0 @@ -class Flowerbox.Exception - constructor: (@source, @name, @stack) -> - - toJSON: -> - { status: Flowerbox.Result.FAILURE, source: @source, name: @name, trace: { stack: @stack } } diff --git a/lib/assets/javascripts/flowerbox/result.js.coffee b/lib/assets/javascripts/flowerbox/result.js.coffee deleted file mode 100644 index cf412a4..0000000 --- a/lib/assets/javascripts/flowerbox/result.js.coffee +++ /dev/null @@ -1,17 +0,0 @@ -Flowerbox ||= {} - -class Flowerbox.Result - @SUCCESS = 'success' - @PENDING = 'pending' - @UNDEFINED = 'undefined' - @FAILURE = 'failure' - @SKIPPED = 'skipped' - - constructor: (data) -> - for key, value of data - this[key] = value - - this.status ||= Flowerbox.Result.SKIPPED - this.failures ||= [] - - toJSON: => this diff --git a/lib/flowerbox/rack.rb b/lib/flowerbox/rack.rb index 1f37fba..b1c5c84 100644 --- a/lib/flowerbox/rack.rb +++ b/lib/flowerbox/rack.rb @@ -17,7 +17,18 @@ module Flowerbox result else - [ 200, { 'Content-type' => 'text/html' }, [ runner.template ] ] + begin + template = runner.template + + [ 200, { 'Content-type' => 'text/html' }, [ template ] ] + rescue => e + $stderr.puts + $stderr.puts e.message + $stderr.puts e.backtrace.join("\n") + $stderr.puts + + [ 500, {}, [] ] + end end end end