Skip to content

Instantly share code, notes, and snippets.

@ahmednuaman
Created December 12, 2014 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmednuaman/592405f8a0b9ac561306 to your computer and use it in GitHub Desktop.
Save ahmednuaman/592405f8a0b9ac561306 to your computer and use it in GitHub Desktop.
Grunt githash grabber
// use like <%= commitsha1 %>
grunt.registerTask('githash', function () {
var done = this.async(),
config;
config = {
cmd: 'git',
args: ['rev-parse', '--verify', 'HEAD']
};
grunt.util.spawn(config, function (err, result) {
grunt.config('commitsha1', result.stdout);
grunt.log.ok('Setting `commitsha1` to ' + result.stdout);
done();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment