|
1 | 1 | # Add utility functions and scripts to the container
|
2 | 2 | include scripts/makefile/*.mk
|
3 | 3 |
|
4 |
| -.PHONY: all provision si exec exec0 down clean dev info phpcs phpcbf drush cinsp |
| 4 | +.PHONY: all provision si exec exec0 down clean dev info phpcs phpcbf drush cinsp hooksymlink hookexec |
5 | 5 | .DEFAULT_GOAL := help
|
6 | 6 |
|
7 | 7 | # https://stackoverflow.com/a/6273809/1826109
|
@@ -41,11 +41,9 @@ phpcsexec = docker run --rm \
|
41 | 41 | --ignore=*.css,libraries/*,dist/*,styleguide/* \
|
42 | 42 | .
|
43 | 43 |
|
44 |
| -$(info Installing git hooks) |
45 |
| -$(shell ln -sfn ../../scripts/git_hooks/pre-commit.sh .git/hooks/pre-commit) |
46 | 44 |
|
47 | 45 | ## Full site install from the scratch
|
48 |
| -all: | provision composer si info |
| 46 | +all: | provision composer si hooksymlink info |
49 | 47 |
|
50 | 48 | ## Provision enviroment
|
51 | 49 | provision:
|
@@ -151,11 +149,31 @@ phpcs:
|
151 | 149 | phpcbf:
|
152 | 150 | @$(call phpcsexec, phpcbf)
|
153 | 151 |
|
| 152 | +## Add symbolic link from custom script(s) to /.git/hooks/pre-commit |
| 153 | +hooksymlink: |
| 154 | +ifneq ("$(wildcard scripts/git_hooks/pre-commit.sh)","") |
| 155 | + @echo "Installing git hooks" |
| 156 | + $(shell ln -sf ../../scripts/git_hooks/pre-commit.sh .git/hooks/pre-commit) |
| 157 | +else |
| 158 | + @echo "scripts/git_hooks/pre-commit.sh file does not exist" |
| 159 | +endif |
| 160 | + |
| 161 | +## Execute git hooks |
| 162 | +hookexec: |
| 163 | +ifneq ("$(wildcard scripts/git_hooks/pre-commit.sh)","") |
| 164 | + @echo "Executing git hooks" |
| 165 | + @/bin/sh ./scripts/git_hooks/pre-commit.sh |
| 166 | +else |
| 167 | + @echo "scripts/git_hooks/pre-commit.sh file does not exist" |
| 168 | +endif |
| 169 | + |
| 170 | +## Inspect configuration |
154 | 171 | cinsp:
|
155 | 172 | @echo "Config schema validation..."
|
156 | 173 | @$(call php, drush -y en config_inspector)
|
157 | 174 | @$(eval SCHEMA_ERRORS = $(shell docker-compose exec -T --user $(CUID):$(CGID) php drush inspect_config --only-error))
|
158 | 175 | @$(call php, drush -y pmu config_inspector)
|
159 | 176 | @if [ ! -z "$(SCHEMA_ERRORS)" ]; then echo "Error(s) in config schemas"; exit 1; fi
|
160 | 177 |
|
| 178 | +## Full inspection |
161 | 179 | insp: | cinsp phpcs
|
0 commit comments