-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgulpfile.js
66 lines (55 loc) · 1.72 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
59
60
61
62
63
64
65
66
'use strict';
var gulp = require('gulp'),
plugins = {},
params = {};
var spawn = require('child_process').spawn;
plugins.exec = function(cmd, args, cb) {
var proc = spawn(cmd, args);
proc.stdout.on('data', function(stdout) {
if(stdout) console.log(stdout);
});
proc.stderr.on('data', function(stderr) {
if(stderr) console.error(stderr);
});
proc.on('close', function(code) {
if(code != 0) cb(new Error('Command: "' + cmd + ' ' + args.join(' ') + '" exited with exit code: ' + code));
else cb();
});
};
plugins.async = require('async');
plugins.path = require('path');
plugins.runSequence = require('run-sequence');
plugins.istanbul = require('gulp-istanbul');
plugins.mocha = require('gulp-mocha');
plugins.plumber = require('gulp-plumber');
params.outputPath = 'artifacts/';
params.coveragePath = 'coverage/';
params.testReportsPath = 'test_reports/'
params.cli = require('minimist')(process.argv.slice(2), {});
// Get Tasks
require('./build_tasks/app_tasks')(gulp, plugins, params);
require('./build_tasks/api_tasks')(gulp, plugins, params);
require('./build_tasks/automation_tasks')(gulp, plugins, params);
gulp.task('clean:paths', function(cb) {
plugins.async.each([
params.outputPath,
params.coveragePath,
params.testReportsPath
], function(path, finished) {
plugins.exec('rm', ['-rf', plugins.path.join(__dirname, path)], finished);
}, cb);
});
gulp.task('build:paths', function(cb) {
plugins.async.each([
params.outputPath,
params.coveragePath,
params.testReportsPath
], function(path, finished) {
plugins.exec('mkdir', [plugins.path.join(__dirname, path)], finished);
}, cb);
});
gulp.task('default', [], function(cb) {
plugins.runSequence('clean:paths', 'build:paths', function() {
cb();
});
});