Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Regenerates marketing screenshots against a throwaway OliveTin that runs
  2. # the fictional config in seed/. Run `make` here (or `make screenshots` from
  3. # the repo root); OliveTin is always stopped afterwards.
  4. #
  5. # OliveTin keeps all of its state in config files and memory, so there are
  6. # no database or broker containers to start.
  7. ROOT := $(abspath ../../..)
  8. HERE := $(abspath .)
  9. TMP := $(HERE)/tmp
  10. BASE_URL := http://127.0.0.1:18337
  11. API := $(BASE_URL)/api/olivetin.api.v1.OliveTinApiService
  12. .PHONY: all build up seed shoot manifest down clean
  13. all:
  14. @$(MAKE) build up seed shoot manifest; rc=$$?; $(MAKE) down; exit $$rc
  15. build:
  16. $(MAKE) -C $(ROOT) service webui-dist
  17. up: down
  18. @if curl -fsS --max-time 5 $(BASE_URL)/ >/dev/null 2>&1; then \
  19. echo "Port 18337 is already in use"; exit 1; fi
  20. rm -rf $(TMP)
  21. mkdir -p $(TMP)
  22. cp -r seed $(TMP)/config
  23. # Started from service/ so that OliveTin finds ../webui.
  24. cd $(ROOT)/service && { ./OliveTin -configdir $(TMP)/config > $(TMP)/service.log 2>&1 & echo $$! > $(TMP)/service.pid; }
  25. @for i in $$(seq 60); do curl -fsS --max-time 5 -X POST -H 'Content-Type: application/json' -d '{}' \
  26. $(API)/Init >/dev/null 2>&1 && exit 0; sleep 0.5; done; \
  27. echo "OliveTin did not start; see $(TMP)/service.log"; exit 1
  28. seed:
  29. ./seed.sh $(BASE_URL)
  30. shoot:
  31. repo-helper screenshot --config screenshots.ini
  32. manifest:
  33. ./generate-manifest.py
  34. down:
  35. -@[ -f $(TMP)/service.pid ] && kill $$(cat $(TMP)/service.pid) 2>/dev/null; rm -f $(TMP)/service.pid
  36. clean: down
  37. rm -rf $(TMP)