-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathgulpfile.js
More file actions
96 lines (88 loc) · 2.24 KB
/
gulpfile.js
File metadata and controls
96 lines (88 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*jslint browser: true, node: true, vars: true, esversion: 6*/
'use strict';
var gulp = require('gulp'),
mocha = require('gulp-mocha'),
gulpLoadPlugins = require('gulp-load-plugins'),
plugins = gulpLoadPlugins(),
jsdoc = require('gulp-jsdoc3'),
del = require('del'),
watch = require('gulp-watch'),
batch = require('gulp-batch'),
spawn = require('child_process').spawn;
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var watching = false;
gulp.task('mocha', function () {
return gulp.src(['test/**/*.js', '!test/models/*.js', '!test/integration/runner.js'], { read: false })
.pipe(mocha({
reporter: 'spec',
globals: {
should: require('should').noConflict()
}
}))
.once('error', function (err) {
console.log('mocha errored... ');
if (watching) {
this.emit('end');
} else {
process.exit(1);
}
})
.once('end', function () {
console.log('mocha ended...');
if (watching) {
this.emit('end');
} else {
process.exit(0);
}
});
});
gulp.task('waterline', function (done) {
var cp = spawn('node', ['test/integration/runner', '-R', 'spec', '-b'], {stdio: 'inherit'});
cp.on('close', (code) => {
console.log('waterline adapter tests completed rc:', code);
done();
});
});
gulp.task('test', ['mocha']);
gulp.task('testwdocs', ['mocha', 'docs']);
gulp.task('watch', function () {
watching = true;
watch([
'lib/**',
'test/**'
], {
ignoreInitial: false,
verbose: false,
readDelay: 1500 // filter duplicate changed events from Brackets
}, batch(function (events, done) {
gulp.start('testwdocs', done);
}));
});
gulp.task('default', ['watch']);
gulp.task('docs', function (cb) {
del(['./jsdocs/**']);
gulp.src(['lib/*.js', './README.md'])
.pipe(jsdoc(
{
opts: {
destination: './jsdocs'
},
plugins: [
'plugins/markdown'
],
templates: {
'cleverLinks': false,
'monospaceLinks': false,
'default': {
'outputSourceFiles': true
},
'path': 'ink-docstrap',
'theme': 'cerulean',
'navType': 'vertical',
'linenums': true,
'dateFormat': 'MMMM Do YYYY, h:mm:ss a'
}
},
cb
));
});