mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Closes #355 - Make bin/kibana executable in the tar and zip archives
grunt-compress is broken it does not honor the `mode` option when tyring to set the permissions on a file. This is broken through out the entire Grunt project (grunt-contrib-copy doesn't honor it, grunt-replace doesn't honor it... as far as I can tell nothing does). SO instead of wasting more time trying to get it to work (I already wasted an hour on it) I decided to fall back to just writing a 10 minute script that actually works. If you are intent on using a pure Grunt task to make it work feel free to go do that rabit hole.
This commit is contained in:
parent
47b353fbcc
commit
5d39d334ea
7 changed files with 65 additions and 11 deletions
|
@ -16,7 +16,6 @@ module.exports = function (grunt) {
|
|||
'copy:dist',
|
||||
'compile_dist_readme',
|
||||
'chmod_kibana',
|
||||
'compress:build_zip',
|
||||
'compress:build_tarball'
|
||||
'create_packages'
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ var join = require('path').join;
|
|||
module.exports = function (grunt) {
|
||||
grunt.registerTask('chmod_kibana', 'Chmods bin/kibana', function () {
|
||||
var done = this.async();
|
||||
var path = join(grunt.config.get('build'), 'dist', 'bin', 'kibana');
|
||||
var path = join(grunt.config.get('build'), 'dist', 'kibana', 'bin', 'kibana');
|
||||
fs.chmod(path, 0755, done);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -27,10 +27,10 @@ module.exports = function (grunt) {
|
|||
var build = grunt.config.get('build');
|
||||
|
||||
var srcReadme = join(root, 'README.md');
|
||||
var distReadme = join(build, 'dist', 'README');
|
||||
var distReadme = join(build, 'dist', 'kibana', 'README.txt');
|
||||
|
||||
var srcLicense = join(root, 'LICENSE.md');
|
||||
var distLicense = join(build, 'dist', 'LICENSE');
|
||||
var distLicense = join(build, 'dist', 'kibana', 'LICENSE.txt');
|
||||
|
||||
marked.setOptions({
|
||||
renderer: new TextRenderer(),
|
||||
|
|
|
@ -14,11 +14,34 @@ module.exports = function (grunt) {
|
|||
archive: filename
|
||||
},
|
||||
files: [
|
||||
{
|
||||
flatten: true,
|
||||
src: '<%= build %>/dist/bin/kibana',
|
||||
dest: '<%= pkg.name %>/bin/kibana',
|
||||
mode: 755
|
||||
},
|
||||
{
|
||||
flatten: true,
|
||||
src: '<%= build %>/dist/bin/kibana.bat',
|
||||
dest: '<%= pkg.name %>/bin/kibana.bat'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: '<%= build %>/dist/config',
|
||||
src: ['**/*'],
|
||||
dest: '<%= pkg.name %>/config'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: '<%= build %>/dist/lib',
|
||||
src: ['**/*'],
|
||||
dest: '<%= pkg.name %>/lib'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: '<%= build %>/dist',
|
||||
src: ['**/*'],
|
||||
dest: '<%= pkg.name %>' + (task === 'plugin' ? '/_site' : '')
|
||||
src: ['*.txt'],
|
||||
dest: '<%= pkg.name %>'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
@ -50,13 +50,13 @@ module.exports = function (grunt) {
|
|||
expand: true,
|
||||
cwd: '<%= build %>/kibana/',
|
||||
src: '*.jar',
|
||||
dest: '<%= build %>/dist/lib/'
|
||||
dest: '<%= build %>/dist/kibana/lib/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: '<%= src %>/server/config/',
|
||||
src: 'kibana.yml',
|
||||
dest: '<%= build %>/dist/config/'
|
||||
dest: '<%= build %>/dist/kibana/config/'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -13,11 +13,12 @@ module.exports = function (grunt) {
|
|||
files: [
|
||||
{
|
||||
src: [join(src, 'server', 'bin', 'kibana.sh')],
|
||||
dest: join(build, 'dist', 'bin', 'kibana')
|
||||
dest: join(build, 'dist', 'kibana', 'bin', 'kibana'),
|
||||
mode: 0755
|
||||
},
|
||||
{
|
||||
src: [join(src, 'server', 'bin', 'kibana.bat')],
|
||||
dest: join(build, 'dist', 'bin', 'kibana.bat')
|
||||
dest: join(build, 'dist', 'kibana', 'bin', 'kibana.bat')
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
31
tasks/create_packages.js
Normal file
31
tasks/create_packages.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
var child_process = require('child_process');
|
||||
var Promise = require('bluebird');
|
||||
var exec = Promise.promisify(child_process.exec);
|
||||
var join = require('path').join;
|
||||
var mkdirp = Promise.promisifyAll(require('mkdirp'));
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('create_packages', function () {
|
||||
var done = this.async();
|
||||
var target = grunt.config.get('target');
|
||||
var packageName = grunt.config.get('pkg.name');
|
||||
var version = grunt.config.get('pkg.version');
|
||||
var archiveName = join(target, packageName + '-' + version);
|
||||
var distPath = join(grunt.config.get('build'), 'dist');
|
||||
|
||||
var tgzCmd = 'tar -zcvf ' + archiveName + '.tar.gz kibana';
|
||||
var zipCmd = 'zip -r ' + archiveName + '.zip kibana';
|
||||
|
||||
var options = { cwd: distPath };
|
||||
|
||||
mkdirp.mkdirpAsync(target)
|
||||
.then(function (arg) {
|
||||
return exec(tgzCmd, options);
|
||||
})
|
||||
.then(function (arg) {
|
||||
return exec(zipCmd, options);
|
||||
})
|
||||
.finally(done);
|
||||
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue