| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 | // Generated by CoffeeScript 1.6.3var APP, BIN, BROWSERIFY, CAKE, COFFEE, DOCPAD, EXT, NODE, NPM, OUT, SRC, WINDOWS, bench, browserify, clean, compile, exec, finish, install, pathUtil, reset, safe, setup, spawn, test, watch, _ref;WINDOWS = process.platform.indexOf('win') === 0;NODE = process.execPath;NPM = WINDOWS ? process.execPath.replace('node.exe', 'npm.cmd') : 'npm';EXT = (WINDOWS ? '.cmd' : '');APP = process.cwd();BIN = "" + APP + "/node_modules/.bin";CAKE = "" + BIN + "/cake" + EXT;COFFEE = "" + BIN + "/coffee" + EXT;DOCPAD = "" + BIN + "/docpad" + EXT;OUT = "" + APP + "/out";SRC = "" + APP + "/src";BROWSERIFY = "" + BIN + "/browserify" + EXT;pathUtil = require('path');_ref = require('child_process'), exec = _ref.exec, spawn = _ref.spawn;safe = function(next, fn) {  return function(err) {    if (err) {      return next(err);    }    return fn();  };};bench = function(opts, next) {  if (next == null) {    next = opts;    opts = {};  }  return spawn(NODE, ["" + OUT + "/test/benchmark.js"], {    stdio: 'inherit',    cwd: APP  }).on('close', next);};clean = function(opts, next) {  var args;  if (next == null) {    next = opts;    opts = {};  }  args = ['-Rf', OUT, pathUtil.join(APP, 'node_modules'), pathUtil.join(APP, '*out'), pathUtil.join(APP, '*log')];  return spawn('rm', args, {    stdio: 'inherit',    cwd: APP  }).on('close', next);};browserify = function(opts, next) {  if (next == null) {    next = opts;    opts = {};  }  return spawn(BROWSERIFY, ["" + OUT + "/lib/js2coffee.js", '-s', 'js2coffee', '-o', "" + OUT + "/lib/browser.js"], {    stdio: 'inherit',    cwd: APP  }).on('close', next);};compile = function(opts, next) {  if (next == null) {    next = opts;    opts = {};  }  return spawn(DOCPAD, ['generate'], {    stdio: 'inherit',    cwd: APP  }).on('close', next);};watch = function(opts, next) {  if (next == null) {    next = opts;    opts = {};  }  return spawn(DOCPAD, ['watch'], {    stdio: 'inherit',    cwd: APP  }).on('close', next);};install = function(opts, next) {  if (next == null) {    next = opts;    opts = {};  }  return spawn(NPM, ['install'], {    stdio: 'inherit',    cwd: APP  }).on('close', next);};reset = function(opts, next) {  if (next == null) {    next = opts;    opts = {};  }  return clean(opts, safe(next, function() {    return install(opts, safe(next, function() {      return compile(opts, safe(next, function() {        return browserify(opts, next);      }));    }));  }));};setup = function(opts, next) {  if (next == null) {    next = opts;    opts = {};  }  return install(opts, safe(next, function() {    return compile(opts, safe(next, function() {      return browserify(opts, next);    }));  }));};test = function(opts, next) {  var args;  if (next == null) {    next = opts;    opts = {};  }  args = [];  if (opts.debug) {    args.push("--debug-brk");  }  args.push("" + OUT + "/test/everything.js");  return spawn(NODE, args, {    stdio: 'inherit',    cwd: APP  }, next);};finish = function(err) {  if (err) {    throw err;  }  return console.log('OK');};task('bench', 'benchmark our project', function() {  return bench(finish);});task('clean', 'clean up instance', function() {  return clean(finish);});task('compile', 'compile our files', function() {  return compile(browserify(finish));});task('dev', 'watch and recompile our files', function() {  return watch(browserify(finish));});task('watch', 'watch and recompile our files', function() {  return watch(browserify(finish));});task('install', 'install dependencies', function() {  return install(finish);});task('reset', 'reset instance', function() {  return reset(finish);});task('setup', 'setup for development', function() {  return setup(finish);});task('test', 'run our tests', function() {  return test(finish);});task('test-debug', 'run our tests in debug mode', function() {  return test({    debug: true  }, finish);});task('test-prepare', 'prepare out tests', function() {  return setup(finish);});
 |