kibana/Gruntfile.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

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 22:35:13 +01:00
baseDir: './kibana',
srcDir: 'kibana/src',
buildDir: 'build',
packageDir: 'packages',
destDir: 'build/_site',
tempDir: 'tmp',
port: {
dev : '"9200"',
dist : "(window.location.port !== '' ? ':'+window.location.port : '')"
}
2013-11-12 20:57:20 +01:00
};
2013-11-15 22:35:13 +01:00
// Utility function to load plugin settings into the above config object
2013-11-15 05:26:20 +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-15 22:35:13 +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-15 05:26:20 +01:00
2013-11-15 22:35:13 +01:00
// Load Kibana tasks if they exist. Should probably want the user if they don't.
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 22:35:13 +01:00
grunt.task.renameTask('build', 'build-kibana');
2013-11-15 05:26:20 +01:00
}
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');
loadConfig(config,'./tasks/options/');
2013-11-12 20:57:20 +01:00
// pass the config to grunt
grunt.initConfig(config);
};