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) {
_(after).each(function(item) {
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,
project;
Steppy(
function() {
project = self.projectsHash[projectName].config;
project = self.projectsHash[params.projectName].config;
self._updateBuild({}, {
project: project,
params: params,
params: params.params,
createDate: Date.now(),
status: 'queued',
completed: false

View File

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

View File

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