Refactoring: reorganize files between client and server + initiate deployment

This commit is contained in:
2015-11-05 07:58:55 +00:00
parent fd483c0d27
commit 42e5a06750
11 changed files with 177 additions and 59 deletions

View File

@@ -0,0 +1,33 @@
Deployments = new Mongo.Collection('deployments');
DeploymentService = {
get: function(id) {
return Deployments.find({_id: id}, {date: 1});
},
appendLog: function(id, data, error) {
Deployments.update({ _id: id },{ $push: {
output: {
timestamp : new Date().getTime(),
data : data
}
}});
},
create: function(project, callback) {
return Deployment.insert({
project_id: projet._id,
timestamp: new Date().getTime(),
output: []
}, function(errors, deploymentId) {
_execSync(cmd, function(data) {
DeploymentService.appendLog(deploymentId, data, false);
}, function(data) {
DeploymentService.appendLog(deploymentId, data, true);
});
});
},
deploy: function(project) {
}
}