Renamed merge folder to tmp. Removed symlinking the nodes_module folder of kibana build. Build now leaves a _site folder with marvel+kibana in it. Server command always creates a new config.js from template

This commit is contained in:
Boaz Leskes 2013-11-20 13:59:43 +01:00
parent e6a85d6032
commit b68dda7027
11 changed files with 40 additions and 58 deletions

View file

@ -8,7 +8,6 @@ module.exports = function (grunt) {
exporterDir: 'exporter', exporterDir: 'exporter',
buildDir: 'build', buildDir: 'build',
packageDir: 'packages', packageDir: 'packages',
tempDir: 'tmp',
esPort: { esPort: {
dev: '"9200"', dev: '"9200"',
dist: "(window.location.port !== '' ? ':'+window.location.port : '')" dist: "(window.location.port !== '' ? ':'+window.location.port : '')"
@ -19,7 +18,7 @@ module.exports = function (grunt) {
}; };
// more detailed config // more detailed config
config['buildMergeDir'] = config['buildDir'] + '/merge'; // kibana and custom panels will be merged here config['buildTempDir'] = config['buildDir'] + '/tmp'; // kibana and custom panels will be merged here
config['buildSiteDir'] = config['buildDir'] + '/_site'; // compressed minified marvel site will be outputted here config['buildSiteDir'] = config['buildDir'] + '/_site'; // compressed minified marvel site will be outputted here
// Utility function to load plugin settings into the above config object // Utility function to load plugin settings into the above config object

View file

@ -7,8 +7,9 @@ module.exports = function (grunt) {
'copy:merge_kibana', 'copy:merge_kibana',
'copy:merge_marvel', 'copy:merge_marvel',
'replace:dist_marvel_config', 'replace:dist_marvel_config',
'symlink:build_npm',
'shell:build_kibana', 'shell:build_kibana',
'copy:plugin_to_marvel', 'copy:kibana_build',
'copy:exporter_build',
'clean:build_tmp'
]); ]);
}; };

View file

@ -2,6 +2,7 @@ module.exports = function (config) {
return { return {
setup: [ '<%= kibanaCheckoutDir %>', '<%= buildDir %>' ], setup: [ '<%= kibanaCheckoutDir %>', '<%= buildDir %>' ],
build: [ '<%= buildDir %>' ], build: [ '<%= buildDir %>' ],
build_tmp: [ '<%= buildTempDir %>' ],
package: ['<%= packageDir %>'] package: ['<%= packageDir %>']
}; };
}; };

View file

@ -5,16 +5,10 @@ module.exports = function (config) {
archive: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.zip' archive: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.zip'
}, },
files: [ files: [
{
expand: true,
cwd: '<%= buildMergeDir %>/dist',
src: ['**/*'],
dest: '_site'
},
{ {
expand: true, expand: true,
cwd: '<%= buildDir %>', cwd: '<%= buildDir %>',
src: ['*.jar'], src: ['**/*'],
dest: '' dest: ''
} }
] ]
@ -24,16 +18,10 @@ module.exports = function (config) {
archive: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz' archive: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz'
}, },
files: [ files: [
{
expand: true,
cwd: '<%= buildMergeDir %>/dist',
src: ['**/*'],
dest: '_site'
},
{ {
expand: true, expand: true,
cwd: '<%= buildDir %>', cwd: '<%= buildDir %>',
src: ['*.jar'], src: ['**/*'],
dest: '' dest: ''
} }
] ]

View file

@ -1,24 +1,23 @@
module.exports = function(config) { module.exports = function (config) {
var rewriteRulesSnippet = require('grunt-connect-rewrite/lib/utils').rewriteRequest; var rewriteRulesSnippet = require('grunt-connect-rewrite/lib/utils').rewriteRequest;
return { return {
options: { options: {
port: '<%= kibanaPort %>', port: '<%= kibanaPort %>',
hostname: '<%= kibanaHost %>', hostname: '<%= kibanaHost %>',
base: '.', base: '.',
keepalive: true, keepalive: true,
middleware: function (connect, options) { middleware: function (connect, options) {
return [ return [
rewriteRulesSnippet, // RewriteRules support rewriteRulesSnippet, // RewriteRules support
connect.static(require('path').resolve(options.base)) // mount filesystem connect.static(require('path').resolve(options.base)) // mount filesystem
]; ];
} }
} },
,
rules: { rules: {
'^/app/dashboards/marvel/(.*)$': '/dashboards/$1', '^/app/dashboards/marvel/(.*)$': '/dashboards/$1',
'^/app/panels/marvel/(.*)$': '/panels/$1', '^/app/panels/marvel/(.*)$': '/panels/$1',
'^/config.js$': '/<%= buildMergeDir %>/config.js', '^/config.js$': '/<%= buildTempDir %>/config.js',
'^(.*)$': '<%= kibanaCheckoutDir %>/src/$1' '^(.*)$': '<%= kibanaCheckoutDir %>/src/$1'
} }
}; };
}; };

View file

@ -1,16 +1,22 @@
module.exports = function (config) { module.exports = function (config) {
return { return {
plugin_to_marvel: { exporter_build: {
cwd: '<%= exporterDir %>/target', cwd: '<%= exporterDir %>/target',
expand: true, expand: true,
src: ['<%= pkg.name %>-<%= pkg.version %>.jar'], src: ['<%= pkg.name %>-<%= pkg.version %>.jar'],
dest: '<%= buildDir %>' dest: '<%= buildDir %>'
}, },
kibana_build: {
cwd: '<%= buildTempDir %>/dist',
expand: true,
src: ['**'],
dest: '<%= buildSiteDir %>'
},
merge_kibana: { merge_kibana: {
expand: true, expand: true,
cwd: '<%= kibanaCheckoutDir %>', cwd: '<%= kibanaCheckoutDir %>',
src: [ '**', '.jshintrc'], src: [ '**', '.jshintrc'],
dest: '<%= buildMergeDir %>' dest: '<%= buildTempDir %>'
}, },
merge_marvel: { merge_marvel: {
files: [ files: [
@ -18,13 +24,13 @@ module.exports = function (config) {
expand: true, expand: true,
cwd: 'dashboards', cwd: 'dashboards',
src: '**', src: '**',
dest: '<%= buildMergeDir %>/src/app/dashboards/marvel' dest: '<%= buildTempDir %>/src/app/dashboards/marvel'
}, },
{ {
expand: true, expand: true,
cwd: 'panels', cwd: 'panels',
src: '**', src: '**',
dest: '<%= buildMergeDir %>/src/app/panels/marvel' dest: '<%= buildTempDir %>/src/app/panels/marvel'
} }
] ]
} }

View file

@ -11,7 +11,7 @@ module.exports = function (config) {
] ]
}, },
files: [ files: [
{expand: true, flatten: true, src: ['./config.js'], dest: '<%= buildMergeDir %>'} {expand: true, flatten: true, src: ['./config.js'], dest: '<%= buildTempDir %>'}
] ]
}, },
dist_marvel_config: { dist_marvel_config: {
@ -24,7 +24,7 @@ module.exports = function (config) {
] ]
}, },
files: [ files: [
{expand: true, flatten: true, src: ['./config.js'], dest: '<%= buildMergeDir %>'} {expand: true, flatten: true, src: ['./config.js'], dest: '<%= buildTempDir %>'}
] ]
} }
}; };

View file

@ -22,12 +22,12 @@ module.exports = function (config) {
}, },
}, },
build_kibana: { build_kibana: {
command: [ 'npm install', 'grunt build'].join("&&"), command: [ 'npm install', 'grunt build' ].join("&&"),
options: { options: {
stdout: true, stdout: true,
failOnError: true, failOnError: true,
execOptions: { execOptions: {
cwd: '<%= buildMergeDir %>', cwd: '<%= buildTempDir %>',
} }
} }
} }

View file

@ -1,12 +0,0 @@
module.exports = function (config) {
return {
build_npm: {
files: [
{
src: 'node_modules',
dest: '<%= buildMergeDir %>/node_modules'
}
]
}
};
};

View file

@ -1,6 +1,7 @@
module.exports = function (grunt) { module.exports = function (grunt) {
grunt.registerTask('server', function () { grunt.registerTask('server', function () {
grunt.task.run([ grunt.task.run([
'replace:dev_marvel_config',
'configureRewriteRules', 'configureRewriteRules',
'connect' 'connect'
]); ]);

View file

@ -1,7 +1,6 @@
module.exports = function (grunt) { module.exports = function (grunt) {
grunt.registerTask('setup', [ grunt.registerTask('setup', [
'clean:setup', 'clean:setup',
'gitclone:kibana', 'gitclone:kibana'
'replace:dev_marvel_config'
]); ]);
}; };