kibana/tasks/build/shasums.js
Court Ewing 834f56392e Apply -snapshot suffix during build task
The default behavior of the build task is to now apply the -snapshot
suffix dynamically rather than us manually hardcoding and managing it
within the source code itself. The `--release` flag will drop the
-snapshot suffix on a build, which should be used for any release
candidate.

The default behavior of the build task has also changed to create
rpm/deb packages as well. Since we've only confirmed that this works on
linux, you can override that behavior by passing `skip-os-packages`.

If you do not want to create any zip or tar.gz archives, you can pass
`--skip-archives`.
2016-06-11 15:57:30 -04:00

26 lines
792 B
JavaScript

var { promisify } = require('bluebird');
var readdir = promisify(require('fs').readdir);
var exec = promisify(require('child_process').exec);
var platform = require('os').platform();
var cmd = /^win/.test(platform) ? 'sha1sum ' : 'shasum ';
module.exports = function (grunt) {
grunt.registerTask('_build:shasums', function () {
var targetDir = grunt.config.get('target');
// for when shasums is run but archives and ospackages was not
grunt.file.mkdir(targetDir);
readdir(targetDir)
.map(function (archive) {
// only sha the archives and packages
if (!archive.match(/\.zip$|\.tar.gz$|\.deb$|\.rpm$/)) return;
return exec(cmd + archive + ' > ' + archive + '.sha1.txt', {
cwd: targetDir
});
})
.nodeify(this.async());
});
};