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.chai.use(require('chai-as-promised'));
|
46 | global.expect = global.chai.expect;
|
47 |
|
48 | gulp.src(paths.test, {read:false})
|
49 | .pipe(mocha({
|
50 | reporter: 'list'
|
51 | }))
|
52 | .pipe(istanbul.writeReports())
|
53 | .on('end', done);
|
54 | });
|
55 |
|
56 |
|
57 |
|
58 | gulp.task('plato', function () {
|
59 | var plato = require('gulp-plato');
|
60 | gulp.src(paths.src)
|
61 | .pipe(plato('report', {}));
|
62 | });
|
63 |
|
64 |
|
65 | gulp.task('jsdoc', function () {
|
66 | var jsdoc = require('gulp-jsdoc');
|
67 | gulp.src(paths.src.concat('README.md'))
|
68 | .pipe(jsdoc.parser({
|
69 | plugins: [
|
70 | 'plugins/escapeHtml',
|
71 | 'plugins/markdown'
|
72 | ],
|
73 | markdown: {
|
74 | parser: 'gfm',
|
75 | githubRepoOwner: 'htmllint',
|
76 | githubRepoName: 'htmllint'
|
77 | }
|
78 | }))
|
79 | .pipe(jsdoc.generator('./site/api', {
|
80 |
|
81 | path: 'ink-docstrap',
|
82 | theme: 'cerulean',
|
83 | systemName: 'htmllint',
|
84 | navType: 'vertical',
|
85 | linenums: true,
|
86 | inverseNav: true,
|
87 | outputSourceFiles: true
|
88 | }));
|
89 | });
|
90 |
|
91 | gulp.task('doc:gen', ['jsdoc']);
|
92 |
|
93 | gulp.task('doc:pub', ['doc:gen'], function () {
|
94 | gulp.src(paths.site)
|
95 | .pipe(publish({
|
96 | cacheDir: '.tmp'
|
97 | }));
|
98 | });
|
99 |
|
100 |
|
101 | gulp.task('travis', ['lint', 'test'], function () {
|
102 | gulp.src('coverage/**/lcov.info')
|
103 | .pipe(coveralls());
|
104 | });
|
105 |
|
106 | gulp.task('default', [
|
107 | 'lint',
|
108 | 'test'
|
109 | ]);
|