| @@ -1,5 +1,2 @@ | |||||
| runner.js | |||||
| jquery.mustache.js | |||||
| dojox | |||||
| yui3 | |||||
| commonjs.mustache.js | |||||
| packages/** | |||||
| support/** | |||||
| @@ -1,6 +1,6 @@ | |||||
| # mustache.js Changes | # mustache.js Changes | ||||
| ## 0.5.1-vsc | |||||
| ## 0.5.1-vcs | |||||
| * Added Dot Notation Support | * Added Dot Notation Support | ||||
| @@ -0,0 +1,110 @@ | |||||
| var fs = require('fs'), | |||||
| sys = require('sys'), | |||||
| util = require('util'), | |||||
| uglify = require('uglify-js'); | |||||
| function copyFile(src, dst, cb) { | |||||
| function copy(err) { | |||||
| var is, os; | |||||
| if (!err) { | |||||
| return cb(new Error("File " + dst + " exists.")); | |||||
| } | |||||
| fs.stat(src, function (err) { | |||||
| if (err) { | |||||
| return cb(err); | |||||
| } | |||||
| is = fs.createReadStream(src); | |||||
| os = fs.createWriteStream(dst); | |||||
| util.pump(is, os, cb); | |||||
| }); | |||||
| } | |||||
| fs.stat(dst, copy); | |||||
| } | |||||
| function makeDirectoryIfNotExists(path) { | |||||
| try { | |||||
| var stats = fs.statSync(path); | |||||
| if (!stats.isDirectory()) { | |||||
| fs.mkdirSync(path, 0); | |||||
| } | |||||
| } catch (e) { | |||||
| fs.mkdirSync(path, 0); | |||||
| } | |||||
| } | |||||
| desc('Obfuscation and Compression'); | |||||
| task('minify', function() { | |||||
| var all = fs.readFileSync('mustache.js').toString(), | |||||
| out = fs.openSync('mustache.min.js', 'w+'), | |||||
| ast = uglify.parser.parse(all); | |||||
| ast = uglify.uglify.ast_mangle(ast); | |||||
| ast = uglify.uglify.ast_squeeze(ast); | |||||
| fs.writeSync(out, uglify.uglify.gen_code(ast)); | |||||
| }); | |||||
| task('package', function() { | |||||
| function package(id, location) { | |||||
| var files = [ | |||||
| , 'mustache.js' | |||||
| ]; | |||||
| files.unshift('mustache-' + id + '/mustache.js.tpl.pre'); | |||||
| files.push('mustache-' + id + '/mustache.js.tpl.post'); | |||||
| var all = ''; | |||||
| files.forEach(function(file, i) { | |||||
| all += fs.readFileSync(file).toString(); | |||||
| all += '\n'; | |||||
| }); | |||||
| var outPath; | |||||
| if (location) { | |||||
| makeDirectoryIfNotExists('packages/' + id); | |||||
| if (location === true) { | |||||
| outPath = 'packages/' + id + '/mustache.js'; | |||||
| } else { | |||||
| outPath = 'packages/' + id + '/' + location + '/mustache.js'; | |||||
| makeDirectoryIfNotExists('packages/' + id + '/' + location); | |||||
| } | |||||
| } else { | |||||
| outPath = 'packages/' + id + '.mustache.js'; | |||||
| } | |||||
| var out = fs.openSync(outPath, 'w+'); | |||||
| fs.writeSync(out, all); | |||||
| } | |||||
| var params = Array.prototype.slice.call(arguments); | |||||
| makeDirectoryIfNotExists('packages'); | |||||
| for (var i = 0, n = params.length; i<n; ++i) { | |||||
| switch (params[i].toLowerCase()) { | |||||
| case 'jquery': | |||||
| package('jquery'); | |||||
| break; | |||||
| case 'commonjs': | |||||
| package('commonjs', true); | |||||
| copyFile('mustache-commonjs/package.json', 'packages/commonjs/package.json'); | |||||
| break; | |||||
| case 'dojox': | |||||
| package('dojox', 'string'); | |||||
| break; | |||||
| case 'yui3': | |||||
| package('yui3', 'mustache'); | |||||
| break; | |||||
| case 'requirejs': | |||||
| package('requirejs'); | |||||
| break; | |||||
| default: | |||||
| break; | |||||
| } | |||||
| } | |||||
| }); | |||||
| @@ -1,58 +0,0 @@ | |||||
| require 'rake' | |||||
| require 'spec/rake/spectask' | |||||
| task :default => :spec | |||||
| Spec::Rake::SpecTask.new(:spec) do |t| | |||||
| #t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""] | |||||
| t.spec_files = FileList['test/*_spec.rb'] | |||||
| end | |||||
| desc "Run all specs" | |||||
| task :spec | |||||
| def templated_build(name, opts={}) | |||||
| # Create a rule that uses the .tmpl.{pre,post} stuff to make a final, | |||||
| # wrapped, output file. | |||||
| # There is some extra complexity because Dojo and YUI3 use different | |||||
| # template files and final locations. | |||||
| short = name.downcase | |||||
| source = "mustache-#{short}" | |||||
| dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*") | |||||
| desc "Package for #{name}" | |||||
| task short.to_sym => dependencies do | |||||
| target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js" | |||||
| puts "Packaging for #{name}" | |||||
| sh "mkdir -p #{opts[:location]}" if opts[:location] | |||||
| sh "cat #{source}/#{target_js}.tpl.pre mustache.js \ | |||||
| #{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}" | |||||
| # extra | |||||
| if opts[:extra] | |||||
| sh "sed -e 's/{{version}}/#{version}/' #{source}/#{opts[:extra]} \ | |||||
| > #{opts[:location]}/#{opts[:extra]}" | |||||
| end | |||||
| puts "Done, see #{opts[:location] || '.'}/#{target_js}" | |||||
| end | |||||
| end | |||||
| templated_build "CommonJS", :location => "lib", :extra => "package.json" | |||||
| templated_build "jQuery" | |||||
| templated_build "Dojo", :location => "dojox/string" | |||||
| templated_build "YUI3", :location => "yui3/mustache" | |||||
| templated_build "requirejs" | |||||
| def version | |||||
| File.read("mustache.js").match('version: "([^\"]+)",$')[1] | |||||
| end | |||||
| desc "Remove temporary files." | |||||
| task :clean do | |||||
| sh "git clean -fdx" | |||||
| end | |||||
| @@ -2,6 +2,8 @@ | |||||
| Mustache.js wouldn't kick ass if it weren't for these fine souls: | Mustache.js wouldn't kick ass if it weren't for these fine souls: | ||||
| ## janl (mainline) Branch: | |||||
| * Chris Wanstrath / defunkt | * Chris Wanstrath / defunkt | ||||
| * Alexander Lang / langalex | * Alexander Lang / langalex | ||||
| * Sebastian Cohnen / tisba | * Sebastian Cohnen / tisba | ||||
| @@ -18,3 +20,8 @@ Mustache.js wouldn't kick ass if it weren't for these fine souls: | |||||
| * Jason Smith / jhs | * Jason Smith / jhs | ||||
| * Aaron Gibralter / agibralter | * Aaron Gibralter / agibralter | ||||
| * Ross Boucher / boucher | * Ross Boucher / boucher | ||||
| ## doodad Branch: | |||||
| * Gregory Jacobs / gjslick | |||||
| @@ -1,8 +0,0 @@ | |||||
| { | |||||
| "name": "mustache", | |||||
| "author": "http://mustache.github.com/", | |||||
| "description": "{{ mustache }} in JavaScript — Logic-less templates.", | |||||
| "keywords": ["template"], | |||||
| "version": "0.3.1-dev", | |||||
| "main": "./mustache" | |||||
| } | |||||
| @@ -1,7 +1,11 @@ | |||||
| { | { | ||||
| "name": "mustache", | "name": "mustache", | ||||
| "author": "http://mustache.github.com/", | |||||
| "author": "Vastardis Capital Services", | |||||
| "contributors": [ | |||||
| "Mustache <http://mustache.github.com>" | |||||
| ], | |||||
| "description": "{{ mustache }} in JavaScript — Logic-less templates.", | "description": "{{ mustache }} in JavaScript — Logic-less templates.", | ||||
| "keywords": ["template"], | "keywords": ["template"], | ||||
| "version": "{{version}}" | |||||
| "version": "0.5.1-vsc", | |||||
| "main": "./mustache" | |||||
| } | } | ||||