From 58a952a4dd541aec385f27c855a50d19c151c765 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 9 May 2011 07:35:50 -0400 Subject: [PATCH] pretty-print coffeescript compile errors --- bin/jasmine-headless-webkit | 11 ++++++++++- jasmine-headless-webkit.gemspec | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/jasmine-headless-webkit b/bin/jasmine-headless-webkit index 65b5885..79590e3 100755 --- a/bin/jasmine-headless-webkit +++ b/bin/jasmine-headless-webkit @@ -9,11 +9,13 @@ require 'getoptlong' require 'rubygems' +gem 'rainbow' gem 'jasmine' gem 'coffee-script' require 'jasmine' require 'coffee-script' +require 'rainbow' require 'jasmine/cli' include Jasmine::CLI @@ -73,7 +75,14 @@ files = files.flatten.compact.collect { |file| when '.js' %{} when '.coffee' - %{} + begin + %{} + rescue CoffeeScript::CompilationError => e + puts "[%s] %s: %s" % [ 'coffeescript'.color(:red), file.color(:yellow), e.message.color(:white) ] + exit 1 + ensure + fh.close + end when '.css' %{} end diff --git a/jasmine-headless-webkit.gemspec b/jasmine-headless-webkit.gemspec index da6959c..7a7bc62 100644 --- a/jasmine-headless-webkit.gemspec +++ b/jasmine-headless-webkit.gemspec @@ -22,4 +22,5 @@ Gem::Specification.new do |s| s.add_dependency 'jasmine' s.add_dependency 'coffee-script' + s.add_dependency 'rainbow' end