1 | path = require('path')
|
2 | gulp = require('gulp')
|
3 | mocha = require('gulp-mocha')
|
4 | gutil = require('gulp-util')
|
5 | coffeelint = require('gulp-coffeelint')
|
6 | coffee = require('gulp-coffee')
|
7 |
|
8 | OPTIONS =
|
9 | config:
|
10 | coffeelint: path.join(__dirname, 'coffeelint.json')
|
11 | files:
|
12 | coffee: [ 'lib/**/*.coffee', 'tests/**/*.spec.coffee', 'gulpfile.coffee' ]
|
13 | app: 'lib/**/*.coffee'
|
14 | tests: 'tests/**/*.spec.coffee'
|
15 |
|
16 | gulp.task 'coffee', ->
|
17 | gulp.src(OPTIONS.files.app)
|
18 | .pipe(coffee(bare: true)).on('error', gutil.log)
|
19 | .pipe(gulp.dest('build/'))
|
20 |
|
21 | gulp.task 'test', ->
|
22 | gulp.src(OPTIONS.files.tests, read: false)
|
23 | .pipe(mocha({
|
24 | reporter: 'landing'
|
25 | }))
|
26 |
|
27 | gulp.task 'lint', ->
|
28 | gulp.src(OPTIONS.files.coffee)
|
29 | .pipe(coffeelint({
|
30 | optFile: OPTIONS.config.coffeelint
|
31 | }))
|
32 | .pipe(coffeelint.reporter())
|
33 |
|
34 | gulp.task 'build', [
|
35 | 'lint'
|
36 | 'test'
|
37 | 'coffee'
|
38 | ]
|
39 |
|
40 | gulp.task 'watch', [ 'build' ], ->
|
41 | gulp.watch([ OPTIONS.files.coffee ], [ 'build' ])
|