diff --git a/app.js b/app.js index d52f1f5..2e3f143 100644 --- a/app.js +++ b/app.js @@ -236,8 +236,6 @@ Steppy( require('./projectsWatcher').init(app, this.slot()); - require('./scheduler').init(app, this.slot()); - // init resources require('./resources')(app); }, diff --git a/data/config.yaml b/data/config.yaml index dac2790..1700166 100644 --- a/data/config.yaml +++ b/data/config.yaml @@ -2,6 +2,7 @@ # plugins: # - nci-mail-notification # - nci-jabber-notification +# - nci-scheduler nodes: - type: local diff --git a/package.json b/package.json index 5bbf4e1..50004ce 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "dependencies": { "chokidar": "1.0.3", "colors": "1.1.2", - "cron": "1.0.9", "data.io": "0.3.0", "nlevel": "1.0.3", "node-static": "0.7.6", diff --git a/scheduler.js b/scheduler.js deleted file mode 100644 index 83de8e0..0000000 --- a/scheduler.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -var _ = require('underscore'), - CronJob = require('cron').CronJob; - -exports.init = function(app, callback) { - - var logger = app.lib.logger('scheduler'), - projectJobs = {}; - - app.projects.on('projectLoaded', function(project) { - var time = project.buildEvery && project.buildEvery.time; - if (time) { - logger.log( - 'Start job for loaded project "%s" by schedule "%s"', - project.name, - time - ); - projectJobs[project.name] = {}; - projectJobs[project.name].job = new CronJob({ - cronTime: time, - onTick: function() { - logger.log('Run project "%s"', project.name); - app.builds.create({ - projectName: project.name, - withScmChangesOnly: project.buildEvery.withScmChangesOnly, - initiator: {type: 'scheduler'} - }); - }, - start: true - }); - } - }); - - app.projects.on('projectUnloaded', function(project) { - if (project.name in projectJobs) { - logger.log('Stop job for unloaded project "%s"', project.name); - projectJobs[project.name].job.stop(); - delete projectJobs[project.name]; - } - }); - - callback(); -};