mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
group task related files
Original commit: elastic/kibana-plugin-helpers@4a8ccce1ec
This commit is contained in:
parent
25a10c17d2
commit
ec965190d6
20 changed files with 49 additions and 61 deletions
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
require('../lib/command')('build', function (program) {
|
||||
|
||||
program
|
||||
.description('Build a distributable archive');
|
||||
|
||||
});
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
require('../lib/command')('start', function (program) {
|
||||
|
||||
program
|
||||
.description('Start kibana and have it include this plugin');
|
||||
|
||||
});
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
require('../lib/command')('test:browser', function (program) {
|
||||
|
||||
program
|
||||
.description('Run the browser tests in a real web browser');
|
||||
|
||||
});
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
require('../lib/command')('test:server', function (program) {
|
||||
|
||||
program
|
||||
.description('Run the server tests using mocha');
|
||||
|
||||
});
|
|
@ -1,12 +1,37 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var pkg = require('../package.json');
|
||||
var program = require('commander');
|
||||
|
||||
var pkg = require('../package.json');
|
||||
var run = require('../lib/run');
|
||||
var docs = require('../lib/docs');
|
||||
|
||||
program
|
||||
.version(pkg.version);
|
||||
|
||||
program
|
||||
.command('start')
|
||||
.description('Start kibana and have it include this plugin')
|
||||
.on('--help', docs('start'))
|
||||
.action(run('start'));
|
||||
|
||||
program
|
||||
.command('build')
|
||||
.description('Build a distributable archive')
|
||||
.on('--help', docs('build'))
|
||||
.action(run('build'));
|
||||
|
||||
program
|
||||
.command('test:browser')
|
||||
.description('Run the browser tests in a real web browser')
|
||||
.on('--help', docs('test/browser'))
|
||||
.action(run('test/browser'));
|
||||
|
||||
program
|
||||
.command('test:server')
|
||||
.description('Run the server tests using mocha')
|
||||
.on('--help', docs('test/server'))
|
||||
.action(run('test/server'));
|
||||
|
||||
program
|
||||
.version(pkg.version)
|
||||
.command('start', 'start the server')
|
||||
.command('test:browser', 'run the browser tests')
|
||||
.command('test:server', 'run the server tests')
|
||||
.command('build', 'build a distributable archive')
|
||||
.parse(process.argv);
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
module.exports = function (name, mod) {
|
||||
var pkg = require('../package.json');
|
||||
var program = require('commander');
|
||||
var docs = require('../docs');
|
||||
var idPlugin = require('./id_plugin');
|
||||
var task = require('../tasks/' + name);
|
||||
|
||||
program
|
||||
.version(pkg.version)
|
||||
.on('--help', docs(name));
|
||||
|
||||
mod(program);
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
task(idPlugin());
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
var join = require('path').join;
|
||||
var resolve = require('path').resolve;
|
||||
var readFileSync = require('fs').readFileSync;
|
||||
|
||||
function indent(txt, n) {
|
||||
|
@ -6,10 +6,10 @@ function indent(txt, n) {
|
|||
return space + txt.split('\n').join('\n' + space);
|
||||
}
|
||||
|
||||
module.exports = function (name) {
|
||||
return function () {
|
||||
var md = readFileSync(join(__dirname, name + '.md'), 'utf8');
|
||||
module.exports = function docs(name) {
|
||||
var md = readFileSync(resolve(__dirname, '../tasks', name, 'README.md'), 'utf8');
|
||||
|
||||
return function () {
|
||||
console.log('\n Docs:');
|
||||
console.log('');
|
||||
console.log(indent(md, 4));
|
10
packages/kbn-plugin-helpers/lib/run.js
Normal file
10
packages/kbn-plugin-helpers/lib/run.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
var idPlugin = require('./id_plugin');
|
||||
|
||||
module.exports = function run(name) {
|
||||
var action = require('../tasks/' + name);
|
||||
return function () {
|
||||
// call the action function with the plugin, then all
|
||||
// renaining arguments from commander
|
||||
action.apply(null, [idPlugin()].concat([].slice.apply(arguments)));
|
||||
};
|
||||
};
|
1
packages/kbn-plugin-helpers/tasks/build/index.js
Normal file
1
packages/kbn-plugin-helpers/tasks/build/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('./build_action');
|
1
packages/kbn-plugin-helpers/tasks/start/index.js
Normal file
1
packages/kbn-plugin-helpers/tasks/start/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('./start_action');
|
1
packages/kbn-plugin-helpers/tasks/test/browser/index.js
Normal file
1
packages/kbn-plugin-helpers/tasks/test/browser/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('./test_browser_action');
|
1
packages/kbn-plugin-helpers/tasks/test/server/index.js
Normal file
1
packages/kbn-plugin-helpers/tasks/test/server/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('./test_server_action');
|
Loading…
Add table
Add a link
Reference in a new issue