diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | diller-mqtt.js (renamed from diller.js) | 0 | ||||
-rw-r--r-- | gulpfile.js | 75 | ||||
-rw-r--r-- | package.json | 6 |
4 files changed, 85 insertions, 2 deletions
@@ -8,8 +8,10 @@ Create a database user and database called 'diller' with the password 'diller' a Run Diller: - node diller.js | node_modules/.bin/bunyan - + gulp diller-mqtt + +This assumes that you have `gulp` installed globally. If you don't you can run `./node_modules/.bin/gulp`. + # MQTT topics /diller diff --git a/diller.js b/diller-mqtt.js index db6fc2b..db6fc2b 100644 --- a/diller.js +++ b/diller-mqtt.js 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']); diff --git a/package.json b/package.json index 6f822ad..2c082af 100644 --- a/package.json +++ b/package.json @@ -19,5 +19,11 @@ "mqtt": "^1.4.3", "pg": "^4.4.2", "pg-promise": "^2.0.12" + }, + "devDependencies": { + "gulp": "^3.9.0", + "gulp-bower": "0.0.10", + "gulp-help": "^1.6.1", + "gulp-nodemon": "^2.0.4" } } |