-
Notifications
You must be signed in to change notification settings - Fork 232
/
gulpfile.js
91 lines (76 loc) · 2.5 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
var requireDir = require('require-dir');
var asciify = require('asciify');
var gulp = require('gulp');
var async = require('async');
var Table = require('cli-table');
var BuildTaskDoc = require('./build/BuildTaskDoc');
//Init colors
require('./build/COLORS');
//We retrieve the build-tasks
var buildTasksMap = requireDir('./build');
gulp.task('default', function (finishTask) {
async.series([
printWelcomeMessage,
printBanner,
printTasksHelpTable
],
finishTask
);
/*** Local functions ***/
function printWelcomeMessage(done) {
console.log("Welcome to MailOnline's new".info);
done();
}
function printBanner(done) {
asciify('Videojs Vast Vpaid', function (err, res) {
console.log(res.help);
done();
});
}
function printTasksHelpTable(done) {
var table = new Table({
head: ['Name', 'Description'],
colWidths: [25, 80],
chars: {
'top': '═',
'top-mid': '╤',
'top-left': '╔',
'top-right': '╗' ,
'bottom': '═',
'bottom-mid': '╧',
'bottom-left': '╚',
'bottom-right': '╝' ,
'left': '║',
'left-mid': '╟',
'mid': '─',
'mid-mid': '┼' ,
'right': '║',
'right-mid': '╢',
'middle': '│'
}
});
var buildTasks = getBuildTasks(buildTasksMap);
buildTasks.forEach(function (task) {
table.push([task.name, task.description]);
});
console.log('###### Below, you have the list of all the available build tasks ########');
console.log(table.toString());
console.log(' ');
console.log("NOTE: if a task is run with '--env production' it will execute the build task for production. Minifying scripts and so on".green);
console.log(' ');
done();
}
function getBuildTasks(tasksDir) {
var tasks = Object.keys(tasksDir)
.map(function mapTasks(taskName) {
return tasksDir[taskName];
})
.filter(function filterTasks(task) {
return task instanceof BuildTaskDoc;
})
.sort(function compareTasks(a, b) {
return a.order > b.order ? 1 : -1;
});
return tasks;
}
});