change distributor run signature

This commit is contained in:
oleg 2015-06-13 22:08:13 +03:00
parent a832398859
commit a704129a16
3 changed files with 10 additions and 8 deletions

View File

@ -107,7 +107,9 @@ Distributor.prototype._onBuildComplete = function(err, build, callback) {
if (after) { if (after) {
_(after).each(function(item) { _(after).each(function(item) {
if (!item.status || item.status === build.status) { if (!item.status || item.status === build.status) {
self.run(item.project, {}, triggerAfterGroup.slot()); self.run({
projectName: item.project
}, triggerAfterGroup.slot());
} }
}); });
} }
@ -158,15 +160,15 @@ Distributor.prototype._updateBuild = function(build, changes, callback) {
); );
}; };
Distributor.prototype.run = function(projectName, params, callback) { Distributor.prototype.run = function(params, callback) {
var self = this, var self = this,
project; project;
Steppy( Steppy(
function() { function() {
project = self.projectsHash[projectName].config; project = self.projectsHash[params.projectName].config;
self._updateBuild({}, { self._updateBuild({}, {
project: project, project: project,
params: params, params: params.params,
createDate: Date.now(), createDate: Date.now(),
status: 'queued', status: 'queued',
completed: false completed: false

View File

@ -109,8 +109,8 @@ module.exports = function(app) {
resource.use('run', function(req, res) { resource.use('run', function(req, res) {
var projectName = req.data.projectName; var projectName = req.data.projectName;
console.log('Run the project: %j', projectName); console.log('Run the project: %s', projectName);
distributor.run(projectName, {}, function(err, build) { distributor.run({projectName: projectName}, function(err, build) {
console.log('>>> err, build = ', err && err.stack || err, build); console.log('>>> err, build = ', err && err.stack || err, build);
}); });
res.send(); res.send();

View File

@ -55,7 +55,7 @@ describe('Distributor', function() {
}); });
it('should run without errors', function(done) { it('should run without errors', function(done) {
distributor.run('project1', {}, function(err) { distributor.run({projectName: 'project1'}, function(err) {
expect(err).not.ok(); expect(err).not.ok();
done(); done();
}); });
@ -118,7 +118,7 @@ describe('Distributor', function() {
}); });
it('should run without errors', function(done) { it('should run without errors', function(done) {
distributor.run('project1', {}, function(err) { distributor.run({projectName: 'project1'}, function(err) {
expect(err).not.ok(); expect(err).not.ok();
done(); done();
}); });