-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (80 loc) · 2.47 KB
/
Makefile
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
91
92
93
94
##
## DEPENDENCIES
## ================
## * UNIX operating system
## * GNU Make >= 4.3
## * GNU Bash >= 3.2.57
## -- Phoenix Targets --
## install js dependencies for vue app
install_js_deps:
@docker-compose exec web sh -c "cd /app/vue_app/ && npm i"
## Checks linting on elixir files with formatter
lint:
@docker-compose exec web mix format --check-formatted && docker-compose exec web mix credo --strict
## Lints the project and replaces in place the linted files.
lint_fix:
@docker-compose exec web mix format
## run application automated tests
mix_test:
@docker-compose exec --env MIX_ENV=test web mix test
## create new phoenix project: make new_project APP=example
new_project:
@docker run \
-v "/$$(pwd)":/app \
-w /app \
--rm \
elixir:1.13-alpine \
sh -c "mix local.hex --force && mix archive.install hex phx_new --force && mix phx.new ${APP} --install --binary-id"
## project release and tag using conventional commit
release:
@docker-compose exec web mix git_ops.release
## restart web container so phoenix server can rebuild/restart
restart:
@docker-compose restart web
## seed development database
seed:
@docker-compose exec web mix run priv/repo/seeds.exs
## setup initial development evvironment
setup:
@docker-compose run --rm web sh -c "cd /app/vue_app/ && npm i" && \
docker-compose run --rm web mix setup && \
- @make start
## start development environment with docker-compose
start:
@docker-compose down && \
docker-compose -f docker-compose.yml up -d --remove-orphans
## stop development environment with docker-compose
stop:
@docker-compose down
# Credit: https://gist.github.com/prwhite/8168133#gistcomment-2749866
help:
@printf "Usage\n";
@awk '{ \
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
helpCommand = substr($$0, index($$0, ":") + 2); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
helpCommand = substr($$0, 0, index($$0, ":")); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^##/) { \
if (helpMessage) { \
helpMessage = helpMessage"\n "substr($$0, 3); \
} else { \
helpMessage = substr($$0, 3); \
} \
} else { \
if (helpMessage) { \
print "\n "helpMessage"\n" \
} \
helpMessage = ""; \
} \
}' \
$(MAKEFILE_LIST)