-
Notifications
You must be signed in to change notification settings - Fork 41
/
gulpfile.js
41 lines (31 loc) · 997 Bytes
/
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
var gulp = require('gulp');
var watch = require('gulp-watch');
var mocha = require('gulp-mocha');
var mount = require('mount-routes');
var run = require('gulp-run');
var source_path = ['test/**/*.js', 'lib/*.js'];
gulp.task('watch', function () {
gulp.watch(source_path, ['mocha']);
});
gulp.task('mocha', function () {
return gulp.src(source_path, { read: false })
// gulp-mocha needs filepaths so you can't have any plugins before it
.pipe(mocha({ reporter: 'spec' }));
});
gulp.task('routes', function () {
var express = require('express');
var app = express();
// mount routes
mount(app, __dirname + '/routes', true);
});
gulp.task('kp', function () {
var kp = require("kp");
var is_sudo = false;
var pre = is_sudo == true ? 'sudo' : '';
kp(3010, pre);
});
gulp.task('nginx', function () {
var sh = "sudo nginx -c " + __dirname + '/config/nginx.conf'
run(sh).exec().pipe(gulp.dest('logs/nginx.log'));
});
gulp.task('default', ['mocha', 'watch']);