-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (43 loc) · 1.58 KB
/
Copy pathMakefile
File metadata and controls
55 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
COMMIT := $(shell git rev-parse --short=8 HEAD)
ZIP_FILENAME := $(or $(ZIP_FILENAME), $(shell echo "$${PWD\#\#*/}.zip"))
BUILD_DIR := $(or $(BUILD_DIR),"build")
BASENAME := $(shell basename $(PWD))
VENDOR_AUTOLOAD := vendor/autoload.php
help: ## Print the help documentation
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: build
build: ## Build
git archive --format=zip --output=${ZIP_FILENAME} $(COMMIT)
mkdir ${BUILD_DIR} && mv ${ZIP_FILENAME} ${BUILD_DIR}/
.PHONY: clean
clean: ## clean
rm -rf build dist
$(VENDOR_AUTOLOAD):
composer install --prefer-dist --no-progress
.PHONY: composer
composer: $(VENDOR_AUTOLOAD) ## Runs composer install
.PHONY: lint
lint: composer ## PHP Lint
vendor/squizlabs/php_codesniffer/bin/phpcs
.PHONY: fmt
fmt: composer ## PHP Fmt
vendor/squizlabs/php_codesniffer/bin/phpcbf
.PHONY: dev
dev: ## Docker up
docker-compose up
.PHONY: mysql
mysql: ## Runs mysql cli in mysql container
docker exec -it $(BASENAME)-db-1 mariadb -u root -psomewordpress wordpress
.PHONY: bash
bash: ## Runs bash shell in wordpress container
docker exec -it -w /var/www/html $(BASENAME)-wordpress-1 bash
.PHONY: makepot
makepot: ## Generate POT translation template (requires wp-cli)
wp i18n make-pot . languages/fetch-jft.pot --domain=fetch-jft --exclude=vendor,build,dist
.PHONY: msgfmt
msgfmt: ## Compile all .po files in languages/ to .mo binaries
@for po in languages/*.po; do \
mo="$${po%.po}.mo"; \
echo "Compiling $$po -> $$mo"; \
msgfmt -o "$$mo" "$$po"; \
done