require 'tilt/template' module Jasmine::Headless class CoffeeTemplate < Tilt::Template def prepare ; end def evaluate(scope, locals, &block) begin cache = Jasmine::Headless::CoffeeScriptCache.new(file) source = cache.handle if cache.cached? %{ } else %{} end rescue CoffeeScript::CompilationError => ne puts "[%s] %s: %s" % [ 'coffeescript'.color(:red), file.color(:yellow), "#{ne.message}".color(:white) ] raise ne rescue StandardError => e puts "[%s] Error in compiling file: %s" % [ 'coffeescript'.color(:red), file.color(:yellow) ] raise e end end end end