| @@ -11,6 +11,10 @@ task :spec do | |||||
| end | end | ||||
| end | end | ||||
| def version | |||||
| File.read("mustache.js").match('version: "([^\"]+)",$')[1] | |||||
| end | |||||
| def templated_build(name, opts={}) | def templated_build(name, opts={}) | ||||
| # Create a rule that uses the .tmpl.{pre,post} stuff to make a final, | # Create a rule that uses the .tmpl.{pre,post} stuff to make a final, | ||||
| # wrapped, output file. | # wrapped, output file. | ||||
| @@ -25,7 +29,7 @@ def templated_build(name, opts={}) | |||||
| target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js" | target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js" | ||||
| puts "Packaging for #{name}" | puts "Packaging for #{name}" | ||||
| sh "mkdir -p #{opts[:location]}" if opts[:location] | |||||
| mkdir_p opts[:location] if opts[:location] | |||||
| sh "cat #{source}/#{target_js}.tpl.pre mustache.js \ | sh "cat #{source}/#{target_js}.tpl.pre mustache.js \ | ||||
| #{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}" | #{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}" | ||||
| @@ -33,10 +37,9 @@ def templated_build(name, opts={}) | |||||
| if opts[:extra] | if opts[:extra] | ||||
| sh "sed -e 's/{{version}}/#{version}/' #{source}/#{opts[:extra]} \ | sh "sed -e 's/{{version}}/#{version}/' #{source}/#{opts[:extra]} \ | ||||
| > #{opts[:location]}/#{opts[:extra]}" | > #{opts[:location]}/#{opts[:extra]}" | ||||
| end | |||||
| puts "Done, see #{opts[:location] || '.'}/#{target_js}" | |||||
| end | |||||
| puts "Done, see #{opts[:location] || '.'}/#{target_js}" | |||||
| end | end | ||||
| end | end | ||||
| @@ -47,12 +50,6 @@ templated_build "Dojo", :location => "dojox/string" | |||||
| templated_build "YUI3", :location => "yui3/mustache" | templated_build "YUI3", :location => "yui3/mustache" | ||||
| templated_build "requirejs" | templated_build "requirejs" | ||||
| def version | |||||
| File.read("mustache.js").match('version: "([^\"]+)",$')[1] | |||||
| end | |||||
| desc "Remove temporary files." | desc "Remove temporary files." | ||||
| task :clean do | task :clean do | ||||
| sh "git clean -fdx" | sh "git clean -fdx" | ||||