mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-11 16:55:09 +00:00
33 lines
775 B
JavaScript
33 lines
775 B
JavaScript
'use strict';
|
|
|
|
var Steppy = require('twostep').Steppy,
|
|
createBuildDataResource = require('../distributor').createBuildDataResource,
|
|
logger = require('../lib/logger')('projects resource');
|
|
|
|
module.exports = function(app) {
|
|
|
|
var resource = app.dataio.resource('projects'),
|
|
distributor = app.distributor;
|
|
|
|
resource.use('createBuildDataResource', function(req, res) {
|
|
createBuildDataResource({id: req.data.id});
|
|
res.send();
|
|
});
|
|
|
|
resource.use('readAll', function(req, res) {
|
|
res.send(app.projects);
|
|
});
|
|
|
|
resource.use('run', function(req, res) {
|
|
var projectName = req.data.projectName;
|
|
logger.log('Run the project: "%s"', projectName);
|
|
distributor.run({
|
|
projectName: projectName,
|
|
initiator: {type: 'user'}
|
|
});
|
|
res.send();
|
|
});
|
|
|
|
return resource;
|
|
};
|