mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Merge pull request #302 from w33ble/abort-grunt-on-error
Abort grunt on error
This commit is contained in:
commit
00cf2b5945
4 changed files with 26 additions and 12 deletions
|
@ -1,5 +1,4 @@
|
|||
module.exports = function (grunt) {
|
||||
|
||||
// set the config once before calling load-grunt-config
|
||||
// and once durring so that we have access to it via
|
||||
// grunt.config.get() within the config files
|
||||
|
|
|
@ -3,19 +3,26 @@ module.exports = function (grunt) {
|
|||
var jruby = jrubyPath + '/bin/jruby';
|
||||
var cmd = grunt.config.get('src') + '/server/bin/initialize';
|
||||
|
||||
// config:
|
||||
// wait: should task wait until the script exits before finishing
|
||||
// ready: if not waiting, then how do we know the process is ready?
|
||||
// quiet: ignore stdout from the process
|
||||
// failOnError: the process is killed if output to stderr
|
||||
|
||||
var options = {
|
||||
wait: false,
|
||||
ready: /kibana server started/i,
|
||||
quiet: true,
|
||||
failOnError: true
|
||||
};
|
||||
|
||||
var config = {
|
||||
mri_server: {
|
||||
options: {
|
||||
wait: false,
|
||||
ready: /kibana server started/i
|
||||
},
|
||||
options: options,
|
||||
cmd: cmd
|
||||
},
|
||||
jruby_server: {
|
||||
options: {
|
||||
wait: false,
|
||||
ready: /kibana server started/i
|
||||
},
|
||||
options: options,
|
||||
cmd: jruby,
|
||||
args: [
|
||||
cmd
|
||||
|
@ -24,5 +31,4 @@ module.exports = function (grunt) {
|
|||
};
|
||||
|
||||
return config;
|
||||
|
||||
};
|
||||
|
|
|
@ -2,12 +2,15 @@ var request = require('request');
|
|||
module.exports = function (grunt) {
|
||||
grunt.registerTask('ruby_server', function () {
|
||||
var done = this.async();
|
||||
request.get('http://localhost:5601/config', function (err, resp, body) {
|
||||
|
||||
request.get('http://localhost:5601/config', function (err, resp, body) {
|
||||
// err is a failed response, no server is running
|
||||
if (err) {
|
||||
// run mri_server by default
|
||||
var tasks = ['run:mri_server'];
|
||||
grunt.config.set('ruby_server', 'mri_server');
|
||||
|
||||
// if jruby flag is set, use jruby
|
||||
if (grunt.option('use-jruby')) {
|
||||
tasks = [
|
||||
'download_jruby',
|
||||
|
@ -17,7 +20,10 @@ module.exports = function (grunt) {
|
|||
];
|
||||
grunt.config.set('ruby_server', 'jruby_server');
|
||||
}
|
||||
|
||||
grunt.task.run(tasks);
|
||||
|
||||
// response means server is already running
|
||||
} else {
|
||||
grunt.log.error('Another ruby server is running on localhost:5601.');
|
||||
}
|
||||
|
|
|
@ -6,7 +6,10 @@ module.exports = function (grunt) {
|
|||
|
||||
server.listen(8000).then(function () {
|
||||
console.log('visit http://localhost:8000');
|
||||
if (keepalive !== 'keepalive') done();
|
||||
|
||||
if (keepalive !== 'keepalive') {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue