Handle 'jison' failing in 'rake compile'

This commit is contained in:
Peter Wagenet
2011-10-24 17:20:19 -07:00
parent b832c85923
commit b501c380af
+8 -4
View File
@@ -4,11 +4,15 @@ require "bundler/setup"
file "lib/handlebars/compiler/parser.js" => ["src/handlebars.yy","src/handlebars.l"] do
if ENV['PATH'].split(':').any? {|folder| File.exists?(folder+'/jison')}
system "jison src/handlebars.yy src/handlebars.l"
File.open("lib/handlebars/compiler/parser.js", "w") do |file|
file.puts File.read("handlebars.js") + ";"
end
if $?.success?
File.open("lib/handlebars/compiler/parser.js", "w") do |file|
file.puts File.read("handlebars.js") + ";"
end
sh "rm handlebars.js"
sh "rm handlebars.js"
else
puts "Failed to run Jison."
end
else
puts "Jison is not installed. Try running `npm install jison`."
end