-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathgulpfile.js
53 lines (40 loc) · 1.46 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
var gulp = require('gulp');
var child_process = require('child_process');
var merge = require('merge-stream');
var mkdirp = require('mkdirp');
var to5 = require("gulp-babel");
var requireDir = require('require-dir');
mkdirp.sync('tasks');
var dir = requireDir('./tasks');
var DEST_CLIENT = 'public/';
var DEST_SERVER = 'lib/';
gulp.task('clean', function(cb) {
child_process.exec('rm -rf public/* lib/*', cb);
});
gulp.task('default', gulp.series('clean', function() {
var client = gulp.src('src/client/*')
.pipe(gulp.dest(DEST_CLIENT));
var vendor = gulp.src('vendor/**')
.pipe(gulp.dest(DEST_CLIENT));
var assets = gulp.src(['assets/**', '!assets/html/*'])
.pipe(gulp.dest(DEST_CLIENT));
var assets_html = gulp.src('assets/html/*')
.pipe(gulp.dest(DEST_CLIENT));
var server = gulp.src('src/server/*')
.pipe(to5())
.pipe(gulp.dest(DEST_SERVER));
mkdirp.sync('public/tmp');
mkdirp.sync('log');
return merge(client, vendor, assets, assets_html, server);
}));
gulp.task('test:server', gulp.series('default', function() {
var mocha = require('gulp-mocha');
return gulp.src('tests/mocha/test-server.js', {read: false})
.pipe(mocha({reporter: 'spec'}));
}, 'clean'));
gulp.task('test:client', gulp.series('default', function() {
var casperJs = require('gulp-casperjs');
return gulp.src('tests/yadda/main_test.js')
.pipe(casperJs()); //run casperjs test
}, 'clean'));
gulp.task('test', gulp.series('test:server', 'test:client'));