forked from fuseelements/ember-handlebars-brunch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.js
22 lines (19 loc) · 762 Bytes
/
setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var exec = require('child_process').exec;
var sysPath = require('path');
var mode = process.argv[2];
var execute = function(pathParts, params, callback) {
if (callback == null) callback = function() {};
var path = sysPath.join.apply(null, pathParts);
var command = 'node ' + path + ' ' + params;
console.log('Executing', command);
exec(command, function(error, stdout, stderr) {
if (error != null) return process.stderr.write('Error', stderr.toString());
process.stdout.write(stdout.toString());
});
};
if (mode === 'postinstall') {
execute(['node_modules', 'coffee-script', 'bin', 'coffee'], '-o lib/ src/');
} else if (mode === 'test') {
execute(['node_modules', 'mocha', 'bin', 'mocha'],
'--require test/common.js --colors');
}