1 | var gulp = require('gulp'),
|
2 | coveralls = require('gulp-coveralls'),
|
3 | eslint = require('gulp-eslint'),
|
4 | jscs = require('gulp-jscs'),
|
5 | istanbul = require('gulp-istanbul'),
|
6 | mocha = require('gulp-mocha'),
|
7 | publish = require('gulp-gh-pages');
|
8 |
|
9 | var paths = {
|
10 | src: ['./lib/**/*.js'],
|
11 | testUnit: './test/unit/*.js',
|
12 | testFunc: './test/functional/*.js',
|
13 | site: ['./site/**/*']
|
14 | };
|
15 | paths.test = [].concat(paths.testUnit, paths.testFunc);
|
16 |
|
17 | gulp.task('jscs', function () {
|
18 | gulp.src(paths.src
|
19 | .concat(paths.test))
|
20 | .pipe(jscs());
|
21 | });
|
22 |
|
23 |
|
24 |
|
25 | gulp.task('lint', ['jscs'], function () {
|
26 | return gulp.src(paths.src
|
27 | .concat(paths.test)
|
28 | .concat('./gulpfile.js'))
|
29 | .pipe(eslint())
|
30 | .pipe(eslint.format());
|
31 | });
|
32 |
|
33 |
|
34 | gulp.task('istanbul', function (done) {
|
35 | gulp.src(paths.src)
|
36 | .pipe(istanbul())
|
37 | .on('finish', done);
|
38 | });
|
39 |
|
40 |
|
41 | gulp.task('test', ['istanbul'], function (done) {
|
42 |
|
43 |
|
44 | global.chai = require('chai');
|
45 | global.expect = global.chai.expect;
|
46 |
|
47 | gulp.src(paths.test, {read:false})
|
48 | .pipe(mocha({
|
49 | reporter: 'list'
|
50 | }))
|
51 | .pipe(istanbul.writeReports())
|
52 | .on('end', done);
|
53 | });
|
54 |
|
55 |
|
56 |
|
57 | gulp.task('plato', function () {
|
58 | var plato = require('gulp-plato');
|
59 | gulp.src(paths.src)
|
60 | .pipe(plato('report', {}));
|
61 | });
|
62 |
|
63 |
|
64 | gulp.task('jsdoc', function () {
|
65 | var jsdoc = require('gulp-jsdoc');
|
66 | gulp.src(paths.src.concat('README.md'))
|
67 | .pipe(jsdoc.parser({
|
68 | plugins: [
|
69 | 'plugins/escapeHtml',
|
70 | 'plugins/markdown'
|
71 | ],
|
72 | markdown: {
|
73 | parser: 'gfm',
|
74 | githubRepoOwner: 'htmllint',
|
75 | githubRepoName: 'htmllint'
|
76 | }
|
77 | }))
|
78 | .pipe(jsdoc.generator('./site/api', {
|
79 |
|
80 | path: 'ink-docstrap',
|
81 | theme: 'cerulean',
|
82 | systemName: 'htmllint',
|
83 | navType: 'vertical',
|
84 | linenums: true,
|
85 | inverseNav: true,
|
86 | outputSourceFiles: true
|
87 | }));
|
88 | });
|
89 |
|
90 | gulp.task('doc:gen', ['jsdoc']);
|
91 |
|
92 | gulp.task('doc:pub', ['doc:gen'], function () {
|
93 | gulp.src(paths.site)
|
94 | .pipe(publish({
|
95 | cacheDir: '.tmp'
|
96 | }));
|
97 | });
|
98 |
|
99 |
|
100 | gulp.task('travis', ['lint', 'test'], function () {
|
101 | gulp.src('coverage/**/lcov.info')
|
102 | .pipe(coveralls());
|
103 | });
|
104 |
|
105 | gulp.task('default', [
|
106 | 'lint',
|
107 | 'test'
|
108 | ]);
|