Skip to content

Commit

Permalink
Update Rakefile to use a locally installed version of jison
Browse files Browse the repository at this point in the history
The means root access is no longer required to build.
  • Loading branch information
kiall committed Sep 12, 2012
1 parent 89f5ab8 commit 4b73b51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@ lib/handlebars/compiler/parser.js
node_modules
*.sublime-project
*.sublime-workspace
npm-debug.log
6 changes: 3 additions & 3 deletions Rakefile
Expand Up @@ -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") + ";"
Expand All @@ -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
Expand Down

0 comments on commit 4b73b51

Please sign in to comment.