-
Notifications
You must be signed in to change notification settings - Fork 0
/
gake
executable file
·42 lines (35 loc) · 938 Bytes
/
gake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env node
var fs = require('fs');
var async = require('async');
var exec = require('child_process').exec
var arguments = process.argv.splice(2);
var cyan = '\u001b[36m';
var reset = '\u001b[0m';
fs.exists('Gakefile', function(exists) {
if (exists) {
fs.readFile('Gakefile', 'utf-8', function (err, data) {
data = JSON.parse(data);
var fns = [];
data.forEach(function(row, i) {
fns.push(function(cb) {
console.log(cyan);
console.log('-=-=-=-=-=-=-=-=-=-=-');
console.log(row.description);
console.log('-=-=-=-=-=-=-=-=-=-=-');
console.log(reset);
var act = exec(row.command, function(err, stdout, stderr) {
console.log(stdout + stderr);
});
act.on('close', function(code, signal) {
cb(null, i)
});
});
});
async.series(fns, function(err, result) {
if (err) throw err
});
});
} else {
console.log('No Gakefile found!');
}
});