support project steps object

This commit is contained in:
oleg 2015-08-21 23:38:20 +03:00
parent 93c7ea0d4e
commit 649500a22f
2 changed files with 16 additions and 2 deletions

View File

@ -14,5 +14,5 @@ notify:
console:
steps:
- cmd: npm install && npm prune
- cmd: npm test
sync: npm install && npm prune
test: npm test

View File

@ -64,6 +64,20 @@ exports.loadConfig = function(dir, callback) {
reader.load(dir, 'config', this.slot());
},
function(err, config) {
// convert steps object to array
if (!_(config.steps).isArray() && _(config.steps).isObject()) {
config.steps = _(config.steps).map(function(val, name) {
var step;
if (_(val).isObject()) {
step = val;
} else {
step = {cmd: val};
}
step.name = name;
return step;
});
}
// apply defaults
_(config.steps).each(function(step) {
if (!step.type) step.type = 'shell';