forked from krg7880/json-schema-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
58 lines (46 loc) · 1.22 KB
/
gulpfile.js
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
var markdox = require("gulp-markdox");
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var concat = require("gulp-concat");
var Stubby = require('node-stubby-server-cli').CLI;
var Events = Stubby.Events;
var path = require('path');
var stubbyHelper = require(path.normalize(__dirname + '/test/helpers/stubby-cli'));
gulp.task('start:stubby', function(next) {
var cli = new Stubby();
cli.admin(stubbyHelper.ports.admin)
.stubs(stubbyHelper.ports.stubs)
.tls(stubbyHelper.ports.tls)
.data(path.normalize(__dirname + '/test/fixtures/stubby/routes.json'))
.unmute()
cli.once('LISTENING', function() {
next();
}).start();
});
gulp.task('test', ['start:stubby'], function() {
return gulp.src('test/**/*-test.js')
.pipe(mocha({reporter: 'nyan'}))
.once('error', function(e) {
process.exit(1);
})
.once('end', function() {
process.exit(0)
});
});
gulp.task('stop:stubby', ['test'], function(next) {
cli.kill();
next();
});
gulp.task("doc", function(){
gulp.src("./lib/*.js")
.pipe(markdox())
.pipe(concat("README.md"))
.pipe(gulp.dest("./doc"));
});
// Default tasks to run
gulp.task('default', [
'start:stubby',
'test',
'stop:stubby',
'doc'
]);