UNPKG

926 Btext/coffeescriptView Raw
1path = require('path')
2gulp = require('gulp')
3mocha = require('gulp-mocha')
4gutil = require('gulp-util')
5coffeelint = require('gulp-coffeelint')
6coffee = require('gulp-coffee')
7
8OPTIONS =
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
16gulp.task 'coffee', ->
17 gulp.src(OPTIONS.files.app)
18 .pipe(coffee(bare: true)).on('error', gutil.log)
19 .pipe(gulp.dest('build/'))
20
21gulp.task 'test', ->
22 gulp.src(OPTIONS.files.tests, read: false)
23 .pipe(mocha({
24 reporter: 'landing'
25 }))
26
27gulp.task 'lint', ->
28 gulp.src(OPTIONS.files.coffee)
29 .pipe(coffeelint({
30 optFile: OPTIONS.config.coffeelint
31 }))
32 .pipe(coffeelint.reporter())
33
34gulp.task 'build', [
35 'lint'
36 'test'
37 'coffee'
38]
39
40gulp.task 'watch', [ 'build' ], ->
41 gulp.watch([ OPTIONS.files.coffee ], [ 'build' ])