Skip to content

Commit

Permalink
Update Makefile for proper integration of git hooks script file check
Browse files Browse the repository at this point in the history
commit 78b88e98eb36458e3d89115d236b2170910aeb3a
Author: David Ferlay <[email protected]>
Date:   Mon Apr 8 19:37:50 2019 +0200

commit 160a6bb79a34efcd65bb4ffdd4e3d8efe17b8d06
Author: David Ferlay <[email protected]>
Date:   Wed Apr 3 17:48:30 2019 +0200
  • Loading branch information
David Ferlay committed Apr 9, 2019
1 parent 4adb410 commit 7f45423
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -150,3 +148,22 @@ 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:
ifneq ("$(wildcard scripts/git_hooks/pre-commit.sh)","")
@echo "Installing git hooks"
$(shell ln -sf ../../scripts/git_hooks/pre-commit.sh .git/hooks/pre-commit)
else
@echo "scripts/git_hooks/pre-commit.sh file does not exist"
endif


## Execute git hooks
hookexec:
ifneq ("$(wildcard scripts/git_hooks/pre-commit.sh)","")
@echo "Executing git hooks"
@/bin/sh ./scripts/git_hooks/pre-commit.sh
else
@echo "scripts/git_hooks/pre-commit.sh file does not exist"
endif

0 comments on commit 7f45423

Please sign in to comment.