This repository was archived by the owner on Jul 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
67 lines (51 loc) · 1.32 KB
/
index.js
File metadata and controls
67 lines (51 loc) · 1.32 KB
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
var config = require('./config');
var utils = require('./utils');
var data = require('./data');
var gutil = require('gulp-util');
module.exports.config = config;
module.exports.utils = utils;
module.exports.data = data;
utils.gulp = require('gulp');
// Load our own tasks
var tasks = require('require-dir')('./tasks');
// Activate our plugins
var plugins = utils.plugins();
function pad(value, width) {
if(value.length > width) return value.length + ' ';
return value + new Array(width - value.length).join(' ');
}
// Define a task for outputting some help info
utils.gulp.task('default', function() {
var taskList = [];
// Map the internal tasks
Object.keys(tasks).forEach(function(key) {
var task = tasks[key];
task.forEach(function(t) {
taskList.push(t);
});
});
// Map tasks of plugins
plugins.forEach(function(plugin) {
if(plugin.tasks) {
plugin.tasks.forEach(function(t) {
taskList.push(t);
});
}
});
taskList.sort(function(a, b) {
if(a.task < b.task) {
return -1;
} else if(a.task > b.task) {
return 1;
}
return 0;
});
gutil.log(gutil.colors.red('At least one task is required.'));
gutil.log('');
gutil.log('Available tasks:');
gutil.log('');
taskList.forEach(function(task) {
gutil.log(gutil.colors.bold(pad(task.task, 10)), task.description);
});
gutil.log('');
});