pretty-print coffeescript compile errors
This commit is contained in:
parent
086086cd3e
commit
58a952a4dd
@ -9,11 +9,13 @@ require 'getoptlong'
|
|||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
|
|
||||||
|
gem 'rainbow'
|
||||||
gem 'jasmine'
|
gem 'jasmine'
|
||||||
gem 'coffee-script'
|
gem 'coffee-script'
|
||||||
|
|
||||||
require 'jasmine'
|
require 'jasmine'
|
||||||
require 'coffee-script'
|
require 'coffee-script'
|
||||||
|
require 'rainbow'
|
||||||
|
|
||||||
require 'jasmine/cli'
|
require 'jasmine/cli'
|
||||||
include Jasmine::CLI
|
include Jasmine::CLI
|
||||||
@ -73,7 +75,14 @@ files = files.flatten.compact.collect { |file|
|
|||||||
when '.js'
|
when '.js'
|
||||||
%{<script type="text/javascript" src="#{file}"></script>}
|
%{<script type="text/javascript" src="#{file}"></script>}
|
||||||
when '.coffee'
|
when '.coffee'
|
||||||
%{<script type="text/javascript">#{CoffeeScript.compile File.read(file)}</script>}
|
begin
|
||||||
|
%{<script type="text/javascript">#{CoffeeScript.compile(fh = File.open(file))}</script>}
|
||||||
|
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'
|
when '.css'
|
||||||
%{<link rel="stylesheet" href="#{file}" type="text/css" />}
|
%{<link rel="stylesheet" href="#{file}" type="text/css" />}
|
||||||
end
|
end
|
||||||
|
@ -22,4 +22,5 @@ Gem::Specification.new do |s|
|
|||||||
|
|
||||||
s.add_dependency 'jasmine'
|
s.add_dependency 'jasmine'
|
||||||
s.add_dependency 'coffee-script'
|
s.add_dependency 'coffee-script'
|
||||||
|
s.add_dependency 'rainbow'
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user