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-18 21:36:21 +01:00
|
|
|
kibanaCheckoutDir: './vendor/kibana',
|
2013-11-19 09:51:14 +01:00
|
|
|
exporterDir: 'exporter',
|
2013-11-18 21:36:21 +01:00
|
|
|
buildDir: 'build',
|
2013-11-15 22:35:13 +01:00
|
|
|
packageDir: 'packages',
|
2013-11-18 21:36:21 +01:00
|
|
|
esPort: {
|
|
|
|
dev: '"9200"',
|
|
|
|
dist: "(window.location.port !== '' ? ':'+window.location.port : '')"
|
|
|
|
},
|
|
|
|
kibanaPort: 5601,
|
|
|
|
kibanaHost: 'localhost'
|
|
|
|
|
2013-11-12 20:57:20 +01:00
|
|
|
};
|
|
|
|
|
2013-11-18 21:36:21 +01:00
|
|
|
// more detailed config
|
2013-11-20 13:59:43 +01:00
|
|
|
config['buildTempDir'] = config['buildDir'] + '/tmp'; // kibana and custom panels will be merged here
|
2013-11-18 21:36:21 +01:00
|
|
|
config['buildSiteDir'] = config['buildDir'] + '/_site'; // compressed minified marvel site will be outputted here
|
|
|
|
|
2013-11-15 22:35:13 +01:00
|
|
|
// Utility function to load plugin settings into the above config object
|
2013-11-18 21:36:21 +01:00
|
|
|
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] || {};
|
2013-11-18 21:36:21 +01:00
|
|
|
grunt.util._.extend(config[key], require(path + option)(config, grunt));
|
2013-11-15 05:26:20 +01:00
|
|
|
});
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
2013-11-15 22:35:13 +01:00
|
|
|
// load plugins
|
|
|
|
require('load-grunt-tasks')(grunt);
|
2013-11-12 20:57:20 +01:00
|
|
|
|
2013-11-15 22:35:13 +01:00
|
|
|
// Load Marvel tasks. Identical task names will override kibana tasks
|
|
|
|
grunt.loadTasks('tasks');
|
2013-11-18 21:36:21 +01:00
|
|
|
loadConfig(config, './tasks/options/');
|
2013-11-15 22:35:13 +01:00
|
|
|
|
2013-11-12 20:57:20 +01:00
|
|
|
// pass the config to grunt
|
|
|
|
grunt.initConfig(config);
|
|
|
|
|
|
|
|
};
|