-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
executable file
·77 lines (56 loc) · 1.85 KB
/
gulpfile.coffee
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
gulp = require 'gulp'
del = require 'del'
runSequence = require 'run-sequence'
developServer = require 'gulp-develop-server'
notify = require 'gulp-notify'
mocha = require('gulp-mocha')
coffee = require('gulp-coffee')
gutil = require('gulp-util')
exit = require('gulp-exit')
gulp.task 'default',(callback) ->
runSequence(['clean'],['coffee'],['copyFiles'],['serve','watch','test'],['mochaSequence'],callback)
gulp.task 'travis',(callback) ->
runSequence(['clean'],['coffee'],['copyFiles'],['serve'],['mochaSequenceWillExit'],callback)
gulp.task 'build',(callback) ->
runSequence(['clean'],['coffee'],['copyFiles'],callback)
gulp.task('coffee', ->
gulp.src(['./src/**/*.coffee','./**/*.coffee'])
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(gulp.dest('./dist/'))
)
gulp.task 'clean',(callback) ->
del ['./dist/'], callback
gulp.task 'copyFiles', ->
gulp.src(['./src/*/*.db','./src/**/*.jpg','./deploy'])
.pipe(gulp.dest('./dist/'))
gulp.task 'serve', ->
developServer.listen({
path: './dist/index.js'
})
gulp.task 'watch', ->
gulp.watch(['./src/**/*.js'],['reload'])
gulp.task 'test', ->
gulp.watch(['./test/**/*.coffee'],['mochaSequence'])
gulp.task 'cleanDb',(callback) ->
del ['./dist/database/'],callback
gulp.task('mocha',->
gulp.src('./dist/test/**/*.js')
.pipe(mocha())
)
gulp.task('mochaWillExit',->
gulp.src('./dist/test/**/*.js')
.pipe(mocha())
.pipe(exit())
)
gulp.task('mochaSequence',(callback) ->
runSequence(['cleanDb'],['coffee'],['mocha'],callback)
)
gulp.task('mochaSequenceWillExit',(callback) ->
runSequence(['cleanDb'],['coffee'],['mochaWillExit'],callback)
)
gulp.task 'reload', (callback) ->
runSequence(['copyFiles'],['reload-node'],['mochaSequence'],callback)
gulp.task 'reload-node', ->
developServer.restart()
gulp.src('./dist/index.js')
.pipe(notify('Server restarted...'))