-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGulpfile.coffee
More file actions
65 lines (55 loc) · 1.56 KB
/
Copy pathGulpfile.coffee
File metadata and controls
65 lines (55 loc) · 1.56 KB
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
gulp = require 'gulp'
mocha = require 'gulp-mocha'
shell = require 'gulp-shell'
coffeelint = require 'gulp-coffeelint'
spawn = require('child_process').spawn
istanbul = require 'gulp-coffee-istanbul'
paths =
serverBin: './bin/server.coffee'
test: './test/**/*.coffee'
cover: [
'./**/*.coffee'
'!./node_modules/**/*'
'!./bin/**/*'
'!./Gulpfile.coffee'
]
coffee: [
'./**/*.coffee'
'!./node_modules/**/*'
]
gulp.task 'default', ['dev']
gulp.task 'dev', ['watch:dev']
gulp.task 'watch', ->
gulp.watch paths.coffee, ['watch:test']
gulp.task 'watch:test', shell.task [
'./bin/test.sh'
]
gulp.task 'watch:dev', ['dev:server'], ->
gulp.watch paths.coffee, ['dev:server']
gulp.task 'dev:server', do ->
devServer = null
process.on 'exit', -> devServer?.kill()
->
devServer?.kill()
devServer = spawn 'coffee', [paths.serverBin], {stdio: 'inherit'}
devServer.on 'close', (code) ->
if code is 8
gulp.log 'Error detected, waiting for changes'
gulp.task 'test', (if process.env.LINT is '1' then ['lint'] else []), ->
if process.env.COVERAGE is '1'
gulp.src paths.cover
.pipe istanbul includeUntested: true
.pipe istanbul.hookRequire()
.on 'finish', ->
gulp.src paths.test
.pipe mocha(timeout: 5000, useColors: true)
.pipe istanbul.writeReports()
.once 'end', -> process.exit()
else
gulp.src paths.test
.pipe mocha(timeout: 5000, useColors: true)
.once 'end', -> process.exit()
gulp.task 'lint', ->
gulp.src paths.coffee
.pipe coffeelint()
.pipe coffeelint.reporter()