diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-25 12:09:29 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-25 12:22:17 +0100 |
commit | 5e634d62d599c60a34f405e26ef0c3037e9a37a3 (patch) | |
tree | b46460fff2593f1eb7d0e8ed86489910a5d55f93 /gulpfile.js | |
parent | 1b77c103b2fe6532ddf8f0625ebafeec8c1f5304 (diff) | |
download | diller-server-5e634d62d599c60a34f405e26ef0c3037e9a37a3.tar.gz diller-server-5e634d62d599c60a34f405e26ef0c3037e9a37a3.tar.bz2 diller-server-5e634d62d599c60a34f405e26ef0c3037e9a37a3.tar.xz diller-server-5e634d62d599c60a34f405e26ef0c3037e9a37a3.zip |
o Experimenting with grunt.
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']); |