Update Rakefile to use a locally installed version of jison

The means root access is no longer required to build.
This commit is contained in:
Kiall Mac Innes
2012-09-12 11:15:31 +01:00
parent 89f5ab8aaf
commit 4b73b51e12
2 changed files with 4 additions and 3 deletions
+1
View File
@@ -6,3 +6,4 @@ lib/handlebars/compiler/parser.js
node_modules
*.sublime-project
*.sublime-workspace
npm-debug.log
+3 -3
View File
@@ -2,7 +2,7 @@ require "rubygems"
require "bundler/setup"
def compile_parser
system "jison src/handlebars.yy src/handlebars.l"
system "./node_modules/jison/lib/jison/cli-wrapper.js src/handlebars.yy src/handlebars.l"
if $?.success?
File.open("lib/handlebars/compiler/parser.js", "w") do |file|
file.puts File.read("handlebars.js") + ";"
@@ -15,11 +15,11 @@ def compile_parser
end
file "lib/handlebars/compiler/parser.js" => ["src/handlebars.yy","src/handlebars.l"] do
if ENV['PATH'].split(':').any? {|folder| File.exists?(folder+'/jison')}
if File.exists?('./node_modules/jison/lib/jison/cli-wrapper.js')
compile_parser
else
puts "Jison is not installed. Trying `npm install jison`."
sh "npm install jison -g"
sh "npm install jison"
compile_parser
end
end