diff options
Diffstat (limited to 'gulpfile.js')
-rw-r--r-- | gulpfile.js | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..ae66565 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,75 @@ +var gulp = require('gulp-help')(require('gulp')); +var bower = require('gulp-bower'); +var nodemon = require('gulp-nodemon'); +var path = require('path'); +var spawn = require('child_process').spawn + +gulp.task('bower', function () { + return bower() +}); + +function readable(state, daemon) { + var bunyan = state.bunyan; + + // free memory + bunyan && bunyan.kill(); + + bunyan = state.bunyan = spawn('./node_modules/.bin/bunyan', [ + '--output', 'short', + '--color' + ]); + + //console.log('bunyan', bunyan); + bunyan.stdout.pipe(process.stdout); + bunyan.stderr.pipe(process.stderr); + + daemon.stdout.pipe(bunyan.stdin); + daemon.stderr.pipe(bunyan.stdin); +} + +gulp.task('diller-mqtt-reload', function () { +}); + +gulp.task('diller-mqtt', function () { + var state = {}; + + nodemon({ + script: 'diller-mqtt.js', + delay: 500, + ext: 'js', + watch: [ + 'src' + ], + ignore: [ + 'src/web/' + ], + env: {NODE_ENV: 'development'}, + tasks: ['diller-mqtt-reload'], + stdout: false, + //readable: false, + a: '' + }).on('readable', function () { + return readable(state, this); + }); +}); + +gulp.task('diller-web-reload', function () { +}); + +gulp.task('diller-web', ['bower'], function () { + nodemon({ + script: 'diller-web.js', + delay: 500, + ext: 'js', + watch: [ + 'src' + ], + ignore: [ + 'src/mqtt/' + ], + env: {NODE_ENV: 'development'}, + tasks: ['diller-web-reload'] + }); +}); + +gulp.task('default', ['bower']); |