-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgulpfile.js
50 lines (40 loc) · 1.85 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
'use strict';
var path = require('path');
var gulp = require('gulp');
var argv = require('minimist')(process.argv.slice(2));
var port = 5080;
var nconf = require('nconf');
nconf.argv().env().file({
file: 'settings.json'
});
var taskDirectory = [process.cwd(), 'scripts', 'task'].join(path.sep);
var srcDir = [process.cwd(), 'src'].join(path.sep);
var distDir = [process.cwd(), 'dist'].join(path.sep);
var scriptsDir = [process.cwd(), 'scripts'].join(path.sep);
var webappBuildScriptDir = [scriptsDir, 'task', 'webapp'].join(path.sep);
var deployWebappDir = nconf.get('red5pro-server-local')
? [nconf.get('red5pro-server-local'), 'webapps'].join(path.sep)
: [process.cwd(), 'red5pro-server', 'webapps'].join(path.sep);
var deployLibDir = nconf.get('red5pro-server-local')
? [nconf.get('red5pro-server-local'), 'lib'].join(path.sep)
: [process.cwd(), 'red5pro-server', 'lib'].join(path.sep);
// Import build task
var buildSetup = require([taskDirectory, 'build.js'].join(path.sep))(srcDir, distDir, webappBuildScriptDir, gulp); //eslint-disable-line no-unused-vars
// Import deploy task
var deploySetup = require([taskDirectory, 'deploy.js'].join(path.sep))(distDir, deployWebappDir, deployLibDir, gulp); //eslint-disable-line no-unused-vars
// Import watch task
var watchSetup = require([taskDirectory, 'watch.js'].join(path.sep))(srcDir, distDir, gulp, 'deploy'); //eslint-disable-line no-unused-vars
// Import launch task
var launchSetup = require([taskDirectory, 'launch.js'].join(path.sep))(port, gulp); //eslint-disable-line no-unused-vars
// Import new task
var newTask = require([taskDirectory, 'new.js'].join(path.sep))(srcDir, distDir, scriptsDir, gulp);
gulp.task('new', function(cb) {
var webappNameOption = argv.name;
if(webappNameOption) {
newTask(webappNameOption);
cb()
}
else {
console.log('You need to provide a --name option.');
}
});