2015-03-17 21:13:37 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-03-23 21:16:00 +00:00
|
|
|
var Steppy = require('twostep').Steppy,
|
|
|
|
path = require('path'),
|
|
|
|
_ = require('underscore');
|
2015-03-17 21:13:37 +00:00
|
|
|
|
|
|
|
function Executor(params) {
|
2015-03-23 21:16:00 +00:00
|
|
|
this.project = params.project;
|
|
|
|
this.cwd = path.join(this.project.dir, 'workspace');
|
2015-03-17 21:13:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.Executor = Executor;
|
|
|
|
|
|
|
|
Executor.prototype._getSources = function(params, callback) {
|
|
|
|
};
|
|
|
|
|
|
|
|
Executor.prototype._runStep = function(params, callback) {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Executor.prototype.run = function(params, callback) {
|
2015-03-23 21:16:00 +00:00
|
|
|
var self = this,
|
|
|
|
project = _({}).extend(self.project, params);
|
2015-03-17 21:13:37 +00:00
|
|
|
Steppy(
|
|
|
|
function() {
|
2015-03-23 21:16:00 +00:00
|
|
|
self._getSources(project.scm, this.slot());
|
2015-03-17 21:13:37 +00:00
|
|
|
},
|
|
|
|
function() {
|
2015-03-23 21:16:00 +00:00
|
|
|
var funcs = project.steps.map(function(step) {
|
2015-03-17 21:13:37 +00:00
|
|
|
return function() {
|
|
|
|
self._runStep(step, this.slot());
|
|
|
|
};
|
|
|
|
});
|
|
|
|
funcs.push(this.slot());
|
|
|
|
Steppy.apply(this, funcs);
|
|
|
|
},
|
|
|
|
callback
|
|
|
|
);
|
|
|
|
};
|