Makefile 2.59 KB
Newer Older
Tifenn Guillas's avatar
Tifenn Guillas committed
1
2
UID := $(id -u)
GID := $(id -g)
François Agneray's avatar
François Agneray committed
3
4
5
6
7

list:
	@echo ""
	@echo "Useful targets:"
	@echo ""
François Agneray's avatar
François Agneray committed
8
9
10
11
12
	@echo "  install       > install php composer dependancies"
	@echo "  up            > build php image and start anis-v3-server containers for dev only (php + mailer)"
	@echo "  start         > start anis-v3-server containers"
	@echo "  restart       > restart anis-v3-server containers"
	@echo "  stop          > stop  and kill running anis-v3-server containers"
13
14
	@echo "  logs          > display anis-v3-server containers logs"
	@echo "  shell         > shell into php anis-v3-server container"
François Agneray's avatar
François Agneray committed
15
16
17
	@echo "  phpunit       > run php unit test suite"
	@echo "  phpcs         > run php code sniffer test suite"
	@echo "  init-db       > generate a new metadata database (anis-v3-server containers running needed)"
Tifenn Guillas's avatar
Tifenn Guillas committed
18
	@echo "  remove-db     > remove the metadata database"
François Agneray's avatar
François Agneray committed
19
20
	@echo "  validate-db   > validate the doctrine mapping entity files (anis-v3-server containers running needed)"
	@echo "  add-superuser > add an Anis server superuser. Example: make email=admin@anis.fr password=admin add-superuser"
21
	@echo "  gen-key       > generate a new encryption key that you can use to encrypt data (see anis server config file)"
François Agneray's avatar
François Agneray committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	@echo ""

install:
	@docker run --init -it --rm --user $(UID):$(GID) \
	-e COMPOSER_CACHE_DIR=/dev/null \
	-v $(CURDIR):/project \
	-w /project jakzal/phpqa composer install

up:
	@docker-compose up --build -d

start:
	@docker-compose up -d

restart: stop start

stop:
	@docker-compose kill
	@docker-compose rm -v --force

42
logs:
François Agneray's avatar
François Agneray committed
43
44
	@docker-compose logs -f -t

45
shell:
François Agneray's avatar
François Agneray committed
46
	@docker-compose exec php bash
François Agneray's avatar
François Agneray committed
47
48
49
50
51
52
53
54
55
56

phpunit:
	@docker run --init -it --rm --user $(UID):$(GID) \
	-v $(CURDIR):/project \
	-w /project jakzal/phpqa phpdbg -qrr ./vendor/bin/phpunit --bootstrap ./tests/bootstrap.php \
	--whitelist src --coverage-text --colors=never ./tests

phpcs:
	@docker run --init -it --rm --user $(UID):$(GID) \
	-v $(CURDIR):/project \
François Agneray's avatar
François Agneray committed
57
	-w /project jakzal/phpqa phpcs --standard=PSR2 --extensions=php --colors src
François Agneray's avatar
François Agneray committed
58

59
init-meta-db:
François Agneray's avatar
François Agneray committed
60
	@docker-compose exec php sh ./conf-dev/metamodel_init.sh
François Agneray's avatar
François Agneray committed
61

62
63
64
init-db-dev:
	@docker-compose exec php sh ./conf-dev/init-db-dev.sh

Tifenn Guillas's avatar
Tifenn Guillas committed
65
66
67
remove-db:
	@docker volume rm anis-server_pgdata

François Agneray's avatar
François Agneray committed
68
validate-db:
François Agneray's avatar
François Agneray committed
69
	@docker-compose exec php ./vendor/bin/doctrine orm:validate-schema
François Agneray's avatar
François Agneray committed
70

71
72
73
gen-key:
	@docker-compose exec php php ./conf-dev/generate_encryption_key.php

François Agneray's avatar
François Agneray committed
74
75
76
77
add-superuser:
	@[ "${email}" ] || ( echo ">> email is not set"; exit 1 )
	@[ "${password}" ] || ( echo ">> password is not set"; exit 1 )
	@docker-compose exec php curl -d '{"email":"${email}","password":"${password}"}' -H "Content-Type: application/json" -X POST http://localhost/metadata/superuser