-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·72 lines (62 loc) · 1.57 KB
/
Gruntfile.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
module.exports = function(grunt) {
var settings = {};
var settingsPath = 'Config/settings.json';
if (!grunt.file.exists(settingsPath)) {
settingsPath += '.install';
}
/**
* Config
*/
var initConfig = {
pkg: grunt.file.readJSON('package.json'),
settings: grunt.file.readJSON(settingsPath),
rootPath: __dirname,
shell: {
options: {
stdout: true
},
cachePluginPaths: {
command: './Console/cake vamshop cachePluginPaths'
}
}
};
var buildTasks = [
'shell:cachePluginPaths'
];
/**
* Vamshop plugins config
*/
var pluginPaths = grunt.file.readJSON('tmp/plugin_paths.json');
for (var plugin in pluginPaths) {
var pluginPath = pluginPaths[plugin];
gruntHookFile = pluginPath + '/Grunthookfile.js';
if (grunt.file.exists(gruntHookFile)) {
var pluginConfig = require(gruntHookFile)(grunt, initConfig);
for (var gruntPlugin in pluginConfig) {
var pluginTargets = pluginConfig[gruntPlugin];
for (var target in pluginTargets) {
var targetConfig = pluginTargets[target];
// Add plugin to InitConfig
if (typeof initConfig[gruntPlugin] === 'undefined') {
initConfig[gruntPlugin] = {};
}
initConfig[gruntPlugin][target] = targetConfig;
// Register in build tasks
if (target.indexOf('build-') == 0) {
buildTasks.push(gruntPlugin + ':' + target);
}
}
}
}
}
//console.log(JSON.stringify(initConfig, undefined, 2));
grunt.initConfig(initConfig);
/**
* Load tasks
*/
require('load-grunt-tasks')(grunt);
/**
* Register tasks
*/
grunt.registerTask('build', buildTasks);
};