From 21ef36daefb51fa3d32fc28f6fd0737e61eb608b Mon Sep 17 00:00:00 2001 From: David Ferlay Date: Wed, 3 Apr 2019 17:48:30 +0200 Subject: [PATCH] Update Makefile for proper integration of git hooks script --- Makefile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 33ad3c0e6..04b94e2de 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Add utility functions and scripts to the container include scripts/makefile/*.mk -.PHONY: all provision si exec exec0 down clean dev info phpcs phpcbf drush check +.PHONY: all provision si exec exec0 down clean dev info phpcs phpcbf drush check hooksymlink hookexec .DEFAULT_GOAL := help # https://stackoverflow.com/a/6273809/1826109 @@ -41,11 +41,9 @@ phpcsexec = docker run --rm \ --ignore=*.css,libraries/*,dist/*,styleguide/* \ . -$(info Installing git hooks) -$(shell ln -sfn ../../scripts/git_hooks/pre-commit.sh .git/hooks/pre-commit) ## Full site install from the scratch -all: | provision composer si info +all: | provision composer si hooksymlink info ## Provision enviroment provision: @@ -150,3 +148,14 @@ phpcs: ## Fix codebase according to Drupal standards https://www.drupal.org/docs/develop/standards phpcbf: @$(call phpcsexec, phpcbf) + +## Add symbolic link from custom script(s) to /.git/hooks/pre-commit +hooksymlink: + @echo "Installing git hooks" + $(shell ln -sf ../../scripts/git_hooks/pre-commit.sh .git/hooks/pre-commit) + +## Execute git hooks +hookexec: + @echo "Executing git hooks" + /bin/sh ./scripts/git_hooks/pre-commit.sh +