From b23fff1f0a325b6fa5ff5cb2b572f4754e4d6da6 Mon Sep 17 00:00:00 2001 From: Grayside Date: Tue, 8 Dec 2015 11:58:46 -0800 Subject: [PATCH] Add config option to specific command runner in git hook scripts. --- CONFIG.md | 7 +++++-- tasks/git.js | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index ce284a4d..d491b1a7 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -706,9 +706,12 @@ task. This version, specifically invoked by `validate:staged` attempts to minimize the number of files scanned by checking only those that have changed since the last successful commit. -#### Configuring Additional Tasks +#### Configuring Git Hooks -**config.git.hooks**: An array of grunt tasks to run on pre-commit. +**config.git.hooks**: An array of grunt tasks to run on pre-commit in addition to `validate:staged`. + +**config.git.hook-command**: A substitute for a simple `grunt` command to handle the individual grunt tasks. +Allows specification of more complex bin paths or execution wrappers such as `time` or `docker-compose`. #### Overriding a Commit Rejection diff --git a/tasks/git.js b/tasks/git.js index 79e134f7..fa0a1c03 100644 --- a/tasks/git.js +++ b/tasks/git.js @@ -25,6 +25,9 @@ module.exports = function(grunt) { // Githooks task may be configured via Gruntconfig. grunt.config('githooks', { + options: { + command: grunt.config('config.git.hook-command') || 'grunt' + }, gdt: { 'pre-commit': _.unique(tasks).join(' ') }