1 | var exec = require('child_process').exec;
|
2 | var sysPath = require('path');
|
3 |
|
4 | var mode = process.argv[2];
|
5 |
|
6 | var execute = function(pathParts, params, callback) {
|
7 | if (callback == null) callback = function() {};
|
8 | var path = sysPath.join.apply(null, pathParts);
|
9 | var command = 'node ' + path + ' ' + params;
|
10 | console.log('Executing', command);
|
11 | exec(command, function(error, stdout, stderr) {
|
12 | if (error != null) return process.stderr.write(stderr.toString());
|
13 | process.stdout.write(stdout.toString());
|
14 | });
|
15 | };
|
16 |
|
17 | if (mode === 'postinstall') {
|
18 | execute(['node_modules', 'coffee-script', 'bin', 'coffee'], '-o lib/ src/');
|
19 | } else if (mode === 'test') {
|
20 | execute(['node_modules', 'mocha', 'bin', 'mocha'],
|
21 | '--require test/common.js --colors');
|
22 | }
|