From 3e62902b23737fee1c4851b6808239f16eaa8035 Mon Sep 17 00:00:00 2001 From: Balazs Sipos Date: Fri, 7 Apr 2017 14:09:32 +0200 Subject: [PATCH] Module accepts shell command --- tasks/gitInfo.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tasks/gitInfo.js b/tasks/gitInfo.js index a094912..2addc52 100644 --- a/tasks/gitInfo.js +++ b/tasks/gitInfo.js @@ -24,7 +24,8 @@ module.exports = function (grunt) { // Retrieve our config object, filling in missing items with defaults. config = _.merge({ options: { - cwd: null + cwd: null, + sh: false }, commands : { 'local.branch.current.name' : ['rev-parse', '--abbrev-ref', 'HEAD'], @@ -42,11 +43,11 @@ module.exports = function (grunt) { work = function (conf_key, cb) { var spawn_args = config.commands[conf_key]; - + var sh = config.options.sh; grunt.util.spawn( { - cmd : 'git', - args : spawn_args, + cmd : sh?'sh':'git', + args : sh?['-c','git '+spawn_args.join(' ')]:spawn_args, opts : { cwd : config.options.cwd }