Files
intotheeast-com/Makefile
T
m038 fb28f09e0c test: add form config validator and HTTP integration test
test-config: static YAML validator for post-form.md — checks that the
add-page-by-form action name, pageconfig/pagefrontmatter blocks, and all
required fields are correctly wired. Fast, no server needed. Catches the
class of bug that caused silent post failures.

test-post: end-to-end HTTP test — logs in, submits the form, verifies an
entry.md was created on disk, then cleans up. Requires GRAV_TEST_USER and
GRAV_TEST_PASS in .env (see .env.example).

  make test-config   # fast, no credentials needed
  make test-post     # full e2e, needs .env credentials
  make test          # both

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 19:57:49 +02:00

100 lines
3.7 KiB
Makefile

-include .env
export
REMOTE_PORT ?= 22
SSH := ssh -p $(REMOTE_PORT) $(REMOTE_USER)@$(REMOTE_HOST)
WEBROOT ?= $(REMOTE_HOME)/public_html
SITE_CONFIG_DIR ?= $(REMOTE_HOME)/site-config
# ── Tests ─────────────────────────────────────────────────────────────────────
test-config:
@bash scripts/test-form-config.sh
test-post:
@bash scripts/test-post.sh
test: test-config test-post
# ── Local dev ──────────────────────────────────────────────────────────────────
start:
docker compose up -d
stop:
docker compose down
setup: start install-plugins
install-plugins:
docker exec -w /app/www/public intotheeast_grav php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y
# ── Demo content ──────────────────────────────────────────────────────────────
demo-load:
cp -r user/docs/demo/tracker/. user/pages/01.tracker/
docker exec intotheeast_grav bash -c "cd /app/www/public && php bin/grav clearcache"
demo-reset:
@for dir in user/docs/demo/tracker/*/; do \
folder=$$(basename "$$dir"); \
rm -rf "user/pages/01.tracker/$$folder"; \
done
docker exec intotheeast_grav bash -c "cd /app/www/public && php bin/grav clearcache"
# ── Content sync (user repo ↔ Gitea) ──────────────────────────────────────────
content-push:
git -C user push origin main
content-pull:
git -C user pull origin main
# ── Remote credentials ─────────────────────────────────────────────────────────
remote-env-setup:
@$(SSH) "printf 'GITEA_HOST=%s\nGITEA_USER=%s\nGITEA_TOKEN=%s\n' \
'$(GITEA_HOST)' '$(GITEA_USER)' '$(GITEA_TOKEN)' > ~/.env-intotheeast && chmod 600 ~/.env-intotheeast"
@echo "Credentials written to server. Run 'make remote-env-remove' when done."
remote-env-remove:
@$(SSH) "rm -f ~/.env-intotheeast"
@echo "Credentials removed from server."
# ── Remote: initial install ────────────────────────────────────────────────────
remote-wipe:
$(SSH) "cd $(WEBROOT) && rm -rf assets backup bin cache images logs system tmp vendor webserver-configs index.php .htaccess CHANGELOG.md LICENSE.txt README.md"
remote-install:
$(SSH) "WEBROOT=$(WEBROOT) \
SITE_CONFIG_DIR=$(SITE_CONFIG_DIR) \
USER_REPO=$(USER_REPO) \
MAIN_REPO=$(MAIN_REPO) \
GRAV_VERSION=$(GRAV_VERSION) \
PLUGINS='$(shell cat plugins.txt | tr '\n' ' ')' \
GITEA_HOST=$(GITEA_HOST) \
GITEA_USER=$(GITEA_USER) \
GITEA_TOKEN=$(GITEA_TOKEN) \
bash -s" < scripts/server-install.sh
# ── Remote: ongoing maintenance ────────────────────────────────────────────────
remote-fetch:
$(SSH) "git -C $(SITE_CONFIG_DIR) pull"
remote-install-plugins:
$(SSH) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y"
remote-upgrade-grav:
$(SSH) "cd $(WEBROOT) && php bin/grav upgrade"
remote-clean:
$(SSH) "cd $(WEBROOT) && php bin/grav clearcache"
remote-maintenance-on:
$(SSH) "bash -s on $(WEBROOT)" < scripts/server-maintenance.sh
remote-maintenance-off:
$(SSH) "bash -s off $(WEBROOT)" < scripts/server-maintenance.sh