/
rubedo.js
36 lines (25 loc) · 964 Bytes
/
rubedo.js
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
var exec = require('child_process').exec;
var Handlebars = require('handlebars');
module.exports = function(gold) {
// RUBEDO
// A reddening, purpling or iosis - You have succeeded, now do any cleanup or preparations you need. Compile, fetch dependencies or execute any other custom shell commands.
return new Promise(function(resolve, reject){
var i = 0;
var execute = function(i){
if(gold.circle.blueprint.commands && gold.circle.blueprint.commands[i]){
var cmd = gold.circle.blueprint.commands[i];
var parser = Handlebars.compile(cmd);
var cmd = parser(gold);
console.log('Executing: '+cmd);
exec(cmd, function(error, stdout, stderr) {
console.log(error, stdout, stderr);
i++;
execute(i);
});
};
};
exec('rm -rf circles', function(error, stdout, stderr) {
execute(i);
});
});
};