-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
52 lines (42 loc) · 1.29 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
var gulp = require('gulp');
var gutil = require('gulp-util');
var server = require('gulp-develop-server');
var mocha = require('gulp-mocha');
var exit = require('gulp-exit');
var less = require('gulp-less');
gulp.task('server:start', function(cb) {
server.listen( {
path: 'server.js',
env: { NODE_ENV: 'development' }
}, cb);
});
gulp.task('server:restart', function(cb) {
server.restart(cb);
});
gulp.task('test', function() {
return gulp.src(['test/*.js'], { read: false })
.pipe(mocha({ reporter: 'spec' }))
.on('error', gutil.log);
});
gulp.task('less', function () {
return gulp.src('assets/screen.less')
.pipe(less())
.pipe(gulp.dest('assets'));
});
gulp.task('watch:daemon', function() {
gulp.watch(['server.js', 'daemon.js', 'lib/*.js'], ['server:restart', 'test'] );
});
gulp.task('watch:test', function() {
gulp.watch(['test/*.js'], ['test']);
});
gulp.task('watch:less', function() {
gulp.watch(['assets/*.less'], ['less']);
});
gulp.task('watch', ['watch:daemon', 'watch:test']);
// doesn't call server.kill() but ok for travis!
gulp.task('travis', function(){
return gulp.src(['test/*.js'], { read: false })
.pipe(mocha({ reporter: 'spec' }))
.pipe(exit());
});
gulp.task('default', ['server:start', 'test', 'less', 'watch']);