Projekt

Obecné

Profil

Stáhnout (2.93 KB) Statistiky
| Větev: | Revize:
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

    
23
import gulp from 'gulp';
24
import mocha from 'gulp-mocha';
25
import eslint from 'gulp-eslint';
26
import minimist from 'minimist';
27
import git from 'gulp-git';
28
import bump from 'gulp-bump';
29
import filter from 'gulp-filter';
30
import tagVersion from 'gulp-tag-version';
31
import 'babel-register';
32

    
33
const SOURCE = [
34
    '*.js'
35
];
36

    
37
let ESLINT_OPTION = {
38
    parser: 'babel-eslint',
39
    parserOptions: {
40
        'sourceType': 'module'
41
    },
42
    rules: {
43
        'quotes': 0,
44
        'eqeqeq': 0,
45
        'no-use-before-define': 0,
46
        'no-shadow': 0,
47
        'no-new': 0,
48
        'no-underscore-dangle': 0,
49
        'no-multi-spaces': 0,
50
        'no-native-reassign': 0,
51
        'no-loop-func': 0
52
    },
53
    env: {
54
        'node': true
55
    }
56
};
57

    
58
gulp.task('test', function() {
59
    let options = minimist(process.argv.slice(2), {
60
        string: 'test',
61
        default: {
62
            test: 'test/*.js'
63
        }
64
    }
65
    );
66
    return gulp.src(options.test).pipe(mocha({reporter: 'spec'}));
67
});
68

    
69
gulp.task('lint', () =>
70
    gulp.src(SOURCE)
71
    .pipe(eslint(ESLINT_OPTION))
72
    .pipe(eslint.formatEach('stylish', process.stderr))
73
    .pipe(eslint.failOnError())
74
);
75

    
76
let inc = importance =>
77
    gulp.src(['./package.json'])
78
        .pipe(bump({type: importance}))
79
        .pipe(gulp.dest('./'))
80
        .pipe(git.commit('Bumps package version'))
81
        .pipe(filter('package.json'))
82
        .pipe(tagVersion({
83
            prefix: ''
84
        }))
85
;
86

    
87
gulp.task('travis', [ 'lint', 'test' ]);
88
gulp.task('default', [ 'travis' ]);
89

    
90
gulp.task('patch', [ ], () => inc('patch'));
91
gulp.task('minor', [ ], () => inc('minor'));
92
gulp.task('major', [ ], () => inc('major'));
(4-4/5)