| @@ -1 +1,35 @@ | |||||
| runner.js | runner.js | ||||
| mustache-commonjs/LICENSE | |||||
| mustache-commonjs/README.md | |||||
| mustache-commonjs/examples/comments.html | |||||
| mustache-commonjs/examples/comments.js | |||||
| mustache-commonjs/examples/comments.txt | |||||
| mustache-commonjs/examples/complex.html | |||||
| mustache-commonjs/examples/complex.js | |||||
| mustache-commonjs/examples/complex.txt | |||||
| mustache-commonjs/examples/delimiters.html | |||||
| mustache-commonjs/examples/delimiters.js | |||||
| mustache-commonjs/examples/delimiters.txt | |||||
| mustache-commonjs/examples/escaped.html | |||||
| mustache-commonjs/examples/escaped.js | |||||
| mustache-commonjs/examples/escaped.txt | |||||
| mustache-commonjs/examples/simple.html | |||||
| mustache-commonjs/examples/simple.js | |||||
| mustache-commonjs/examples/simple.txt | |||||
| mustache-commonjs/examples/template_partial.html | |||||
| mustache-commonjs/examples/template_partial.js | |||||
| mustache-commonjs/examples/template_partial.txt | |||||
| mustache-commonjs/examples/unescaped.html | |||||
| mustache-commonjs/examples/unescaped.js | |||||
| mustache-commonjs/examples/unescaped.txt | |||||
| mustache-commonjs/examples/view_partial.html | |||||
| mustache-commonjs/examples/view_partial.js | |||||
| mustache-commonjs/examples/view_partial.txt | |||||
| mustache-commonjs/lib/mustache.js | |||||
| mustache-commonjs/test/mustache_test.js | |||||
| mustache-commonjs/test/mustache_test.rb | |||||
| mustache-jquery/jquery.mustache.js | |||||
| mustache-jquery/LICENSE | |||||
| mustache-jquery/README.md | |||||
| mustache-jquery/examples/ | |||||
| mustache-jquery/test/ | |||||
| @@ -1,11 +1,38 @@ | |||||
| require 'rake' | |||||
| require 'rake/testtask' | require 'rake/testtask' | ||||
| task :default => :test | task :default => :test | ||||
| Rake::TestTask.new do |t| | |||||
| Dir.glob("examples/*.html") do |file| | |||||
| test = File.basename(file, ".html") | |||||
| cmd = "ruby test/mustache_test.rb #{test}" | |||||
| print `#{cmd}` | |||||
| task :test do | |||||
| Rake::TestTask.new do |t| | |||||
| Dir.glob("examples/*.html") do |file| | |||||
| test = File.basename(file, ".html") | |||||
| cmd = "ruby test/mustache_test.rb #{test}" | |||||
| print `#{cmd}` | |||||
| end | |||||
| end | end | ||||
| end | end | ||||
| task :commonjs do | |||||
| print "Packaging for CommonJS\n" | |||||
| target = "mustache-commonjs" | |||||
| copy_distfiles(target); | |||||
| `mkdir #{target}/lib` | |||||
| `cp mustache.js #{target}/lib` | |||||
| print "Done, see ./#{target}\n" | |||||
| end | |||||
| task :jquery do | |||||
| print "Packaging for jQuery\n" | |||||
| target = "mustache-jquery/" | |||||
| target_jq = "#{target}/jquery.mustache.js" | |||||
| `cat #{target_jq}.tpl.pre mustache.js #{target_jq}.tpl.post > #{target_jq}` | |||||
| copy_distfiles(target); | |||||
| print "Done, see ./#{target}\n" | |||||
| end | |||||
| private | |||||
| def copy_distfiles(target) | |||||
| files = "LICENSE README.md test examples" | |||||
| `cp -r #{files} #{target}` | |||||
| end | |||||
| @@ -0,0 +1,6 @@ | |||||
| { | |||||
| "name": "mustache", | |||||
| "author": "Jan Lehnardt", | |||||
| "description": "{{mustaches}} in JavaScript — shameless port from @defunkt", | |||||
| "keywords": ["template"] | |||||
| } | |||||
| @@ -0,0 +1,6 @@ | |||||
| $.mustache = function(template, view) { | |||||
| return Mustache.to_html(template, view); | |||||
| }; | |||||
| })(jQuery); | |||||
| @@ -0,0 +1,9 @@ | |||||
| /* | |||||
| Shameless port of a shameless port | |||||
| @defunkt => @janl => @aq | |||||
| See http://github.com/defunkt/mustache for more info. | |||||
| */ | |||||
| ;(function($) { | |||||