2014-09-23 16:02:34 +02:00
|
|
|
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');
|
|
|
|
|
2014-10-03 19:16:29 +02:00
|
|
|
var tgzCmd = 'tar -zcvf ' + archiveName + '.tar.gz kibana-' + version;
|
|
|
|
var zipCmd = 'zip -r ' + archiveName + '.zip kibana-' + version;
|
2014-09-23 16:02:34 +02:00
|
|
|
|
|
|
|
var options = { cwd: distPath };
|
|
|
|
|
|
|
|
mkdirp.mkdirpAsync(target)
|
|
|
|
.then(function (arg) {
|
|
|
|
return exec(tgzCmd, options);
|
|
|
|
})
|
|
|
|
.then(function (arg) {
|
|
|
|
return exec(zipCmd, options);
|
|
|
|
})
|
|
|
|
.finally(done);
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|