diff options
Diffstat (limited to 'gulpfile.js')
-rw-r--r-- | gulpfile.js | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/gulpfile.js b/gulpfile.js index ae66565..724a0b1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,7 +2,9 @@ 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 +var fs = require('fs'); +var spawn = require('child_process').spawn; +var _ = require('lodash'); gulp.task('bower', function () { return bower() @@ -19,7 +21,6 @@ function readable(state, daemon) { '--color' ]); - //console.log('bunyan', bunyan); bunyan.stdout.pipe(process.stdout); bunyan.stderr.pipe(process.stderr); @@ -72,4 +73,26 @@ gulp.task('diller-web', ['bower'], function () { }); }); +gulp.task('gen-systemd', function () { + var config = { + WorkingDirectory: process.cwd(), + User: process.env.USER, + Group: process.env.USER, + NODE_ENV: 'prod' + }; + + function gen(inPath, outPath) { + var content = '' + fs.readFileSync(inPath); + + _.each(config, function (value, key) { + content = content.replace('%' + key + '%', value); + }); + + fs.writeFileSync(outPath, content); + } + + gen('systemd/diller-mqtt.template.service', 'systemd/diller-mqtt.service'); + gen('systemd/diller-web.template.service', 'systemd/diller-web.service'); +}); + gulp.task('default', ['bower']); |