-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile
115 lines (78 loc) · 2.67 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package = moot
stack_yaml = STACK_YAML="stack.yaml"
stack = $(stack_yaml) stack
build: frontend-build
$(stack) build $(package)
build-fast:
$(stack) build -j4 --fast --no-terminal
build-dirty:
$(stack) build --force-dirty $(package)
build-profile:
$(stack) --work-dir .stack-work-profiling --profile build
backend-watch:
$(stack) exec -- yesod devel
frontend-build:
cd frontend && npm run-script build
frontend-watch:
cd frontend && npm start
backend-deps:
$(stack) install yesod-bin alex happy
frontend-deps:
cd frontend && npm install
deps: backend-deps frontend-deps
run:
$(stack) build --fast && $(stack) exec -- $(package)
install:
$(stack) install
ghci:
$(stack) ghci $(package):lib --ghci-options='-j4 +RTS -A128m'
test:
$(stack) test $(package)
test-ghci:
$(stack) ghci $(package):test:$(package)-tests
bench:
$(stack) bench $(package)
ghcid:
$(stack) exec -- ghcid -c "stack ghci $(package):lib --test --ghci-options='-fobject-code -fno-warn-unused-do-bind' --main-is $(package):$(package)"
dev-deps:
stack install ghcid
reset-database: destroy-create-db migration fixtures
reset-data: truncate-tables fixtures
drop-databases:
-sudo -u postgres dropdb moot_dev
-sudo -u postgres dropdb moot_test
create-db-user: drop-databases
-sudo -u postgres dropuser moot
sudo -u postgres bash ./scripts/create-db-users.sh
destroy-create-db: drop-databases
sudo -u postgres createdb -O moot moot_dev
sudo -u postgres createdb -O moot moot_test
# These variants should behave themselves better on Mac and Windows. You
# might need to setup a pgpass.conf for automatic authentication
# since you're not using sudo.
drop-databases-mac-windows:
-dropdb -U postgres moot_dev
-dropdb -U postgres moot_test
create-db-user-mac-windows: drop-databases-mac-windows
-dropuser -U postgres moot
bash ./scripts/create-db-users.sh
destroy-create-db-mac-windows: drop-databases-mac-windows
createdb -U postgres -O moot moot_dev
createdb -U postgres -O moot moot_test
recreate-db: create-db-user destroy-create-db
recreate-db-mac-windows: create-db-user-mac-windows destroy-create-db-mac-windows
psql:
sudo -u postgres psql moot_dev
psql-mac-windows:
psql -U postgres moot_dev
migration: build
stack exec -- migration
fixtures: build
stack exec -- fixtures
truncate-tables: build
stack exec -- truncate
docker-shell:
docker exec -e COLUMNS="`tput cols`" -e LINES="`tput lines`" -it $$(docker-compose ps -q moot_app) /bin/bash -c "reset -w && /bin/bash"
docker-pgshell:
docker exec -e COLUMNS="`tput cols`" -e LINES="`tput lines`" -it $$(docker-compose ps -q postgres) /bin/bash -c "reset -w && /bin/bash"
.PHONY : build build-dirty run install ghci test test-ghci ghcid dev-deps