2013-11-12 20:57:20 +01:00
|
|
|
/* jshint node:true */
|
|
|
|
'use strict';
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
|
|
|
var config = {
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2013-11-15 05:26:20 +01:00
|
|
|
baseDir: './kibana',
|
|
|
|
srcDir: 'kibana/src',
|
2013-11-12 20:57:20 +01:00
|
|
|
destDir: 'dist',
|
2013-11-15 05:26:20 +01:00
|
|
|
tempDir: 'tmp'
|
2013-11-12 20:57:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// load plugins
|
2013-11-15 05:26:20 +01:00
|
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
|
|
|
|
// load task definitions
|
|
|
|
grunt.loadTasks('tasks');
|
|
|
|
|
|
|
|
// Utility function to load plugin settings into config
|
|
|
|
function loadConfig(config,path) {
|
|
|
|
require('glob').sync('*', {cwd: path}).forEach(function(option) {
|
|
|
|
var key = option.replace(/\.js$/,'');
|
2013-11-15 15:32:20 +01:00
|
|
|
// Merge duplicate plugin configs. It is your responsibility to avoid naming collisions
|
|
|
|
// in tasks
|
2013-11-15 05:26:20 +01:00
|
|
|
config[key] = config[key] || {};
|
|
|
|
grunt.util._.extend(config[key], require(path + option)(config));
|
|
|
|
});
|
|
|
|
// technically not required
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Merge that object with what with whatever we have here
|
|
|
|
loadConfig(config,'./tasks/options/');
|
|
|
|
|
2013-11-15 15:32:20 +01:00
|
|
|
if (grunt.file.exists(config.baseDir)) {
|
|
|
|
grunt.loadTasks(config.baseDir+'/tasks');
|
|
|
|
loadConfig(config,config.baseDir+'/tasks/options/');
|
2013-11-15 05:26:20 +01:00
|
|
|
}
|
2013-11-12 20:57:20 +01:00
|
|
|
|
|
|
|
// pass the config to grunt
|
|
|
|
grunt.initConfig(config);
|
|
|
|
|
|
|
|
};
|