UNPKG

2.25 kBtext/coffeescriptView Raw
1# Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com>
2#
3# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions are met:
5#
6# * Redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer.
8# * Redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution.
11#
12# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15# ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
16# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
17# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23gulp = require 'gulp'
24mocha = require 'gulp-mocha'
25eslint = require 'gulp-eslint'
26minimist = require 'minimist'
27require 'coffee-script/register'
28
29SOURCE = [
30 '*.js'
31]
32
33ESLINT_OPTION =
34 rules:
35 'quotes': 0
36 'eqeqeq': 0
37 'no-use-before-define': 0
38 'no-shadow': 0
39 'no-new': 0
40 'no-underscore-dangle': 0
41 'no-multi-spaces': false
42 'no-native-reassign': 0
43 'no-loop-func': 0
44 env:
45 'node': true
46
47gulp.task 'test', ->
48 options = minimist process.argv.slice(2),
49 string: 'test',
50 default:
51 test: 'test/*.coffee'
52 return gulp.src(options.test).pipe(mocha reporter: 'spec')
53
54gulp.task 'lint', ->
55 return gulp.src(SOURCE)
56 .pipe(eslint(ESLINT_OPTION))
57 .pipe(eslint.formatEach('stylish', process.stderr))
58 .pipe(eslint.failOnError())
59
60gulp.task 'travis', [ 'lint', 'test' ]
61gulp.task 'default', [ 'travis' ]