-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.coffee
72 lines (63 loc) · 1.75 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
'use strict'
gulp = require 'gulp'
$ = (require 'gulp-load-plugins') lazy: false
del = require 'del'
es = require 'event-stream'
boolifyString = require 'boolify-string'
paths =
lint: [
'./gulpfile.coffee'
'./src/**/*.coffee'
]
watch: [
'./gulpfile.coffee'
'./src/**/*.coffee'
'./test/**/*.coffee'
'!test/{temp,temp/**}'
]
tests: [
'./test/**/*.coffee'
'!test/{temp,temp/**}'
]
source: [
'./src/**/*.coffee'
]
gulp.task 'lint', ->
gulp.src paths.lint
.pipe $.coffeelint('./coffeelint.json')
.pipe $.coffeelint.reporter()
gulp.task 'clean', del.bind(null, ['./compile'])
gulp.task 'clean:coverage', del.bind(null, ['./coverage'])
gulp.task 'compile', ['lint'], ->
es.merge(
gulp.src paths.source
.pipe $.sourcemaps.init()
.pipe($.coffee(bare: true).on('error', $.util.log))
.pipe $.sourcemaps.write()
.pipe gulp.dest('./compile/src')
gulp.src paths.tests
.pipe $.sourcemaps.init()
.pipe($.coffee({ bare: true }).on('error', $.util.log))
.pipe $.sourcemaps.write()
.pipe $.espower()
.pipe gulp.dest('./compile/test')
)
undefined
gulp.task 'istanbul', ['clean:coverage', 'compile'], (cb) ->
gulp.src ['./compile/src/**/*.js']
#Covering files
.pipe $.istanbul()
.on 'finish', ->
gulp.src ['./compile/test/**/*.js'], {cwd: __dirname}
.pipe $.if(!boolifyString(process.env.CI), $.plumber())
.pipe $.mocha()
#Creating the reports after tests runned
.pipe $.istanbul.writeReports()
.on 'finish', ->
process.chdir __dirname
cb()
undefined
gulp.task 'watch', ['test'], ->
gulp.watch paths.watch, ['test']
gulp.task 'default', ['test']
gulp.task 'test', ['lint', 'istanbul']