watch for config file changes and redeploy

This commit is contained in:
Iuri Matias 2016-09-23 02:45:21 -07:00
parent 89c0001dcb
commit df508e4e8d
1 changed files with 19 additions and 0 deletions

View File

@ -55,6 +55,25 @@ Watch.prototype.start = function() {
.on('unlink', path => this.logger.info(`File ${path} has been removed`)) .on('unlink', path => this.logger.info(`File ${path} has been removed`))
.on('ready', () => this.logger.info('ready to watch changes')); .on('ready', () => this.logger.info('ready to watch changes'));
var configWatcher = chokidar.watch("config/**/contracts.json", {
ignored: /[\/\\]\./, persistent: true, ignoreInitial: true, followSymlinks: true
});
configWatcher
.on('add', path => {
this.logger.info(`File ${path} has been added`)
this.trigger('redeploy', path);
})
.on('change', path => {
this.logger.info(`File ${path} has been changed`)
this.trigger('redeploy', path);
})
.on('unlink', path => {
this.logger.info(`File ${path} has been removed`)
this.trigger('redeploy', path);
})
.on('ready', () => this.logger.info('ready to watch changes'));
this.logger.info("done!"); this.logger.info("done!");
}; };