diff --git a/lib/flowerbox/rack.rb b/lib/flowerbox/rack.rb index b54c13c..1b33fb4 100644 --- a/lib/flowerbox/rack.rb +++ b/lib/flowerbox/rack.rb @@ -25,9 +25,11 @@ module Flowerbox end get '/' do - sprockets.expire_index! - - runner.template + begin + runner.template + rescue Flowerbox::Runner::Base::RunnerDiedError => e + e.message + end end end end diff --git a/lib/flowerbox/runner/base.rb b/lib/flowerbox/runner/base.rb index d9421ad..e39d763 100644 --- a/lib/flowerbox/runner/base.rb +++ b/lib/flowerbox/runner/base.rb @@ -81,9 +81,7 @@ module Flowerbox @results rescue ExecJS::RuntimeError => e - puts e.message.foreground(:red) - - raise RunnerDiedError.new + handle_coffeescript_compilation_error(e) end def configured? @@ -118,6 +116,8 @@ module Flowerbox def start_test_environment Flowerbox.test_environment.start + rescue ExecJS::ProgramError => e + handle_coffeescript_compilation_error(e) end def time=(time) @@ -201,6 +201,13 @@ module Flowerbox @count = 0 end + def handle_coffeescript_compilation_error(exception) + puts exception.message.foreground(:red) + @finished = true + + raise RunnerDiedError.new(exception.message) + end + private def result_set_from_test_results(test_results) ResultSet.from_results(test_results, options.merge(:runner => name)) diff --git a/lib/flowerbox/sprockets_handler.rb b/lib/flowerbox/sprockets_handler.rb index 77f4422..82b5108 100644 --- a/lib/flowerbox/sprockets_handler.rb +++ b/lib/flowerbox/sprockets_handler.rb @@ -25,11 +25,11 @@ module Flowerbox end def add(asset) - paths_for(asset).each { |path| add_paths_for_compiled_asset(path) } + assets_for(asset).each { |dependent_asset| @files.add(dependent_asset) } end - def paths_for(asset) - environment.find_asset(asset).to_a.collect(&:pathname) + def assets_for(asset) + environment.find_asset(asset, :bundle => false).to_a end def expire_index! @@ -52,10 +52,6 @@ module Flowerbox environment.find_asset(*args) end - def add_paths_for_compiled_asset(path) - asset_for(path, :bundle => false).to_a.each { |file_path| @files.add(file_path) } - end - def logical_path_for(asset) asset_path = asset.pathname.to_s