forked from maliceio/malice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
55 lines (47 loc) · 1.36 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var gulp = require('gulp');
var path = require('path');
var shell = require('gulp-shell');
var notifier = require('node-notifier');
var child = require('child_process');
var reload = require('gulp-livereload');
var sync = require('gulp-sync')(gulp).sync;
var util = require('gulp-util');
var goPath = process.env.GOPATH + "/src/github.com/maliceio/malice/**/*.go";
gulp.task('server:build', function() {
var build = child.spawnSync('go', ['install']);
if (build.stderr.length) {
var lines = build.stderr.toString()
.split('\n').filter(function(line) {
return line.length;
});
for (var l in lines)
util.log(util.colors.red(
'Error (go install): ' + lines[l]
));
notifier.notify({
title: 'Error (go install)',
message: lines
});
}
return build;
});
gulp.task('server:watch', function() {
/* Restart application server */
gulp.watch([
'.views/**/*.tmpl',
'locales/*.json'
], ['server:spawn']);
/* Rebuild and restart application server */
gulp.watch(['*/**/*.go', goPath],
sync(['server:build', ], 'server'));
});
gulp.task('build', ['server:build']);
/*
* Start asset and server watchdogs and initialize livereload.
*/
gulp.task('watch', ['server:build'], function() {
reload.listen();
console.log(goPath);
return gulp.start(['server:watch', ]);
});
gulp.task('default', ['build']);