From 96004e3d71943b6db411de1564f92651730a63c6 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sun, 18 Oct 2009 18:33:56 +0200 Subject: [PATCH] add commonjs package generation, run `rake commonjs `, somebody please port this to ruby :) --- .gitignore | 29 +++++++++++++++++++++++++++++ Rakefile | 23 ++++++++++++++++++----- mustache-commonjs/package.json | 6 ++++++ 3 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 mustache-commonjs/package.json diff --git a/.gitignore b/.gitignore index 1a6d8fe..1886df5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,30 @@ 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 diff --git a/Rakefile b/Rakefile index eee70c8..ab2bab9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,11 +1,24 @@ +require 'rake' require 'rake/testtask' 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 + +task :commonjs do + print "Packaging for CommonJS\n" + target = "mustache-commonjs" + files = "LICENSE README.md test examples" + `cp -r #{files} #{target}` + `mkdir #{target}/lib` + `cp mustache.js #{target}/lib` + print "Done, see ./#{target}\n" +end diff --git a/mustache-commonjs/package.json b/mustache-commonjs/package.json new file mode 100644 index 0000000..8ba2db4 --- /dev/null +++ b/mustache-commonjs/package.json @@ -0,0 +1,6 @@ +{ + "name": "mustache", + "author": "Jan Lehnardt", + "description": "{{mustaches}} in JavaScript — shameless port from @defunkt", + "keywords": ["template"] +}