|
1
|
|
|
var gulp = require('gulp'), |
|
2
|
|
|
mocha = require('gulp-mocha'), |
|
3
|
|
|
jshint = require('gulp-jshint'), |
|
4
|
|
|
jshStylish = require('jshint-stylish'), |
|
5
|
|
|
concat = require('gulp-concat'), |
|
6
|
|
|
insert = require('gulp-insert'), |
|
7
|
|
|
documentation = require('gulp-documentation'), |
|
8
|
|
|
docTheme = require('documentation-theme-node'), |
|
9
|
|
|
coveralls = require('gulp-coveralls'); |
|
10
|
|
|
|
|
11
|
|
|
gulp.task('watch', function () { |
|
12
|
|
|
gulp.watch('lib/**/*.js', ['build', 'test-min', 'lint']); |
|
13
|
|
|
}); |
|
14
|
|
|
|
|
15
|
|
|
gulp.task('build', function () { |
|
16
|
|
|
return gulp.src('lib/run.js') |
|
17
|
|
|
.pipe(concat('app.js')) |
|
18
|
|
|
.pipe(insert.prepend('#! /usr/bin/env node \r\n\r\n')) |
|
19
|
|
|
.pipe(gulp.dest('bin')); |
|
20
|
|
|
}); |
|
21
|
|
|
|
|
22
|
|
|
gulp.task('test', function() { |
|
23
|
|
|
return gulp.src('test/*.js', {read: false}) |
|
24
|
|
|
.pipe(mocha({reporter: 'spec'})); |
|
25
|
|
|
}); |
|
26
|
|
|
|
|
27
|
|
|
gulp.task('test-min', function() { |
|
28
|
|
|
return gulp.src('test/*.js', {read: false}) |
|
29
|
|
|
.pipe(mocha({reporter: 'min'})); |
|
30
|
|
|
}); |
|
31
|
|
|
|
|
32
|
|
|
gulp.task('coverage', function() { |
|
33
|
|
|
return gulp.src('test/coverage/**/lcov.info') |
|
34
|
|
|
.pipe(coveralls()); |
|
35
|
|
|
}); |
|
36
|
|
|
|
|
37
|
|
|
gulp.task('lint', function() { |
|
38
|
|
|
return gulp.src('lib/**/*.js') |
|
39
|
|
|
.pipe(jshint({node:true})) |
|
40
|
|
|
.pipe(jshint.reporter(jshStylish)); |
|
41
|
|
|
}); |
|
42
|
|
|
|
|
43
|
|
|
gulp.task('doc', function () { |
|
44
|
|
|
gulp.src('lib/**/*.js') |
|
45
|
|
|
.pipe(documentation({ |
|
46
|
|
|
format: 'html', |
|
47
|
|
|
theme: docTheme |
|
48
|
|
|
})) |
|
49
|
|
|
.pipe(gulp.dest('doc')); |
|
50
|
|
|
}); |
|
51
|
|
|
|
|
52
|
|
|
gulp.task('default', ['test']); |