mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-03-12 23:10:01 +00:00
move projects to data dir
This commit is contained in:
parent
79003d2885
commit
8652b97543
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,4 +4,4 @@ static/css/**/*.css
|
|||||||
static/fonts
|
static/fonts
|
||||||
static/js/libs
|
static/js/libs
|
||||||
static/js/templates
|
static/js/templates
|
||||||
projects/**/workspace
|
data/projects/**/workspace
|
||||||
|
3
app.js
3
app.js
@ -3,6 +3,7 @@
|
|||||||
var http = require('http');
|
var http = require('http');
|
||||||
var nodeStatic = require('node-static');
|
var nodeStatic = require('node-static');
|
||||||
var jade = require('jade');
|
var jade = require('jade');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
var staticServer = new nodeStatic.Server('./static');
|
var staticServer = new nodeStatic.Server('./static');
|
||||||
var server = http.createServer(function(req, res, next) {
|
var server = http.createServer(function(req, res, next) {
|
||||||
@ -23,6 +24,8 @@ var socketio = require('socket.io')(server);
|
|||||||
var dataio = require('./dataio')(socketio);
|
var dataio = require('./dataio')(socketio);
|
||||||
|
|
||||||
var app = {
|
var app = {
|
||||||
|
// path to root dir (with projects, builds etc)
|
||||||
|
dir: path.join(process.cwd(), 'data'),
|
||||||
server: server,
|
server: server,
|
||||||
dataio: dataio
|
dataio: dataio
|
||||||
};
|
};
|
||||||
|
@ -4,39 +4,41 @@ var Steppy = require('twostep').Steppy,
|
|||||||
_ = require('underscore'),
|
_ = require('underscore'),
|
||||||
project = require('../lib/project'),
|
project = require('../lib/project'),
|
||||||
Distributor = require('../lib/distributor').Distributor,
|
Distributor = require('../lib/distributor').Distributor,
|
||||||
db = require('../db');
|
db = require('../db'),
|
||||||
|
path = require('path');
|
||||||
var projects, projectsHash;
|
|
||||||
|
|
||||||
project.loadAll('projects', function(err, loadedProjects) {
|
|
||||||
if (err) throw err;
|
|
||||||
projects = loadedProjects;
|
|
||||||
projectsHash = _(projects).indexBy(function(project) {
|
|
||||||
return project.config.name;
|
|
||||||
});
|
|
||||||
console.log(
|
|
||||||
'Loaded projects: ',
|
|
||||||
_(projects).chain().pluck('config').pluck('name').value()
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
var distributor = new Distributor({
|
|
||||||
nodes: [{type: 'local', maxExecutorsCount: 1}],
|
|
||||||
saveBuild: function(build, callback) {
|
|
||||||
Steppy(
|
|
||||||
function() {
|
|
||||||
db.builds.put(build, this.slot());
|
|
||||||
},
|
|
||||||
function() {
|
|
||||||
this.pass(build);
|
|
||||||
},
|
|
||||||
callback
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
|
|
||||||
|
var projectsDir = path.join(app.dir, 'projects'),
|
||||||
|
projects, projectsHash;
|
||||||
|
|
||||||
|
project.loadAll(projectsDir, function(err, loadedProjects) {
|
||||||
|
if (err) throw err;
|
||||||
|
projects = loadedProjects;
|
||||||
|
projectsHash = _(projects).indexBy(function(project) {
|
||||||
|
return project.config.name;
|
||||||
|
});
|
||||||
|
console.log(
|
||||||
|
'Loaded projects: ',
|
||||||
|
_(projects).chain().pluck('config').pluck('name').value()
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
var distributor = new Distributor({
|
||||||
|
nodes: [{type: 'local', maxExecutorsCount: 1}],
|
||||||
|
saveBuild: function(build, callback) {
|
||||||
|
Steppy(
|
||||||
|
function() {
|
||||||
|
db.builds.put(build, this.slot());
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
this.pass(build);
|
||||||
|
},
|
||||||
|
callback
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
distributor.on('buildUpdate', function(build, changes) {
|
distributor.on('buildUpdate', function(build, changes) {
|
||||||
var buildsResource = app.dataio.resource('builds');
|
var buildsResource = app.dataio.resource('builds');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user