-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (68 loc) · 3.21 KB
/
Copy pathMakefile
File metadata and controls
90 lines (68 loc) · 3.21 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.PHONY: help up down restart init ssl-cert example-install library-install scope xdebug-log xdebug-wp wp-cli logs shell psql clean test\:unit
PLUGIN_DIR := /var/www/html/wp-content/plugins/framework
LIBRARY_DIR := /var/www/html/framework-library
SCOPED_DIR := $(PLUGIN_DIR)/libraries/themeum/framework
help:
@echo "Framework playground commands:"
@echo " make up Start all services in the background (generates SSL cert if needed)"
@echo " make ssl-cert Generate the local self-signed HTTPS certificate"
@echo " make init Run the one-shot WordPress installer (first run)"
@echo " make example-install Composer install for the example plugin (example/composer.json)"
@echo " make library-install Composer install for the framework library (repo root composer.json)"
@echo " make scope Generate the prefixed Themeum\\\\Framework\\\\ tree (CI/release only)"
@echo " make xdebug-log Tail the Xdebug connection log inside the php container"
@echo " make xdebug-wp CMD=\"...\" Run WP-CLI with Xdebug trigger (IDE must be listening)"
@echo " make test:unit Run library unit tests inside the php container"
@echo " make wp CMD=\"...\" Run a WP-CLI command (e.g. CMD=\"plugin list\")"
@echo " make logs Tail php and nginx logs"
@echo " make shell Open a bash shell in the php container"
@echo " make down Stop all services"
@echo " make clean Stop all services and remove volumes"
ssl-cert:
chmod +x docker/scripts/generate-ssl-cert.sh
./docker/scripts/generate-ssl-cert.sh
up: ssl-cert
docker compose up -d
down:
docker compose down
restart:
docker compose restart
init:
docker compose run --rm wordpress-init
docker compose up -d --force-recreate php
example-install: example-composer-install
example-composer-install:
docker compose run --rm php composer install --working-dir=$(PLUGIN_DIR)
example-composer-update:
docker compose run --rm php composer update --working-dir=$(PLUGIN_DIR)
example-dump-autoload:
docker compose run --rm php composer dump-autoload --working-dir=$(PLUGIN_DIR)
library-install: library-composer-install
library-composer-install:
docker compose run --rm php composer install --working-dir=$(LIBRARY_DIR)
library-composer-update:
docker compose run --rm php composer update --working-dir=$(LIBRARY_DIR)
scope:
docker compose run --rm php sh -c 'set -e; \
mkdir -p $(SCOPED_DIR); \
[ -f $(SCOPED_DIR)/helpers.php ] || printf "<?php\n" > $(SCOPED_DIR)/helpers.php; \
composer run scope --working-dir=$(PLUGIN_DIR); \
composer dump-autoload --working-dir=$(PLUGIN_DIR)'
xdebug-log:
docker compose exec php sh -c '\
echo "Tailing /tmp/xdebug.log — start Listen for Xdebug, then run a web or wp-cli request"; \
touch /tmp/xdebug.log; \
tail -F /tmp/xdebug.log'
wp:
docker compose run --rm php wp --allow-root $(CMD)
xdebug-wp:
docker compose run --rm -e XDEBUG_TRIGGER=PHPSTORM php wp --allow-root $(CMD)
logs:
docker compose logs -f php nginx
shell:
docker compose exec php bash
test\:unit:
docker compose exec php bash -lc \
'cd $(LIBRARY_DIR) && composer install --no-interaction && vendor/bin/phpunit --testsuite Unit --testdox'
clean:
docker compose down -v