kibana/tasks/create_shasums.js
Spencer Alger a5ffd91277 [lodash] audit _() usage to ensure compatibility with lodash 3.0
Starting in lodash 3.0 _() chains are lazily evaluated and therefor usage of the pattern had to be checked for side effects. Where it made more sense to just use Array methods, the code was updated. In other places the code was already calling .value() on the chain, so no changes were needed. Finally, there were places where the chain was not designed to produce a value, but to modify a value that was already in scope (like this/self), in those senarios .commit() was added to force evaluation of the chain.
2015-06-11 18:27:18 -07:00

25 lines
656 B
JavaScript

var child_process = require('child_process');
var Promise = require('bluebird');
var fs = require('fs');
var readdir = Promise.promisify(fs.readdir);
var exec = Promise.promisify(child_process.exec);
var _ = require('lodash');
module.exports = function (grunt) {
grunt.registerTask('create_shasums', function () {
var targetDir = grunt.config.get('target');
readdir(targetDir)
.map(function (archive) {
// only sha the archives
if (!archive.match(/\.zip$|\.tar.gz$/)) return;
return exec('shasum ' + archive + ' > ' + archive + '.sha1.txt', {
cwd: targetDir
});
})
.nodeify(this.async());
});
};