forked from restyled-io/restyled.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
110 lines (90 loc) · 2.45 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
# Bring system up to date after a pull
update: setup setup.lint setup.tools db.migrate build lint test
# Initialize from a fresh clone
bootstrap: setup setup.lint setup.tools db.setup build lint test db.seed
.PHONY: db.drop
db.drop:
PGPASSWORD=password dropdb --if-exists --user postgres --host localhost restyled
PGPASSWORD=password dropdb --if-exists --user postgres --host localhost restyled_test
.PHONY: db.create
db.create:
PGPASSWORD=password createdb --user postgres --host localhost restyled
PGPASSWORD=password createdb --user postgres --host localhost restyled_test
.PHONY: db.migrate
db.migrate:
db/migrate dev upgrade
db/migrate test upgrade
.PHONY: db.seed
db.seed:
./bin/restyled.io-dev seed-db
.PHONY: db.setup
db.setup: db.create db.migrate
.PHONY: db.reset
db.reset: db.drop db.setup
.PHONY: db.console
db.console:
PGHOST=localhost PGUSER=postgres PGPASSWORD=password psql restyled
.PHONY: db.console.prod
db.console.prod:
heroku pg:psql --app restyled-io
.PHONY: setup
setup:
stack setup
stack build --dependencies-only --test --no-run-tests
stack install --copy-compiler-tool \
dbmigrations-postgresql
.PHONY: setup.lint
setup.lint:
stack install --copy-compiler-tool \
hlint \
weeder
.PHONY: setup.tools
setup.tools:
stack install --copy-compiler-tool \
dhall \
brittany \
fast-tags \
stylish-haskell
.PHONY: setup.ngrok
setup.ngrok:
if ! command -v ngrok; then \
aurget -S ngrok; \
ngrok authtoken $$(pass ngrok/authtoken); \
fi
.PHONY: build
build:
stack build --pedantic --test --no-run-tests
.PHONY: lint
lint:
find app src test -name '*.hs' \
-not -name 'Foundation.hs' \
-exec stack exec hlint {} +
stack exec weeder
.PHONY: test
test:
stack build --test
.PHONY: watch
watch:
stack build \
--fast --pedantic --test --file-watch \
--exec bin/restyled-restart \
--ghc-options -DDEVELOPMENT
.PHONY: ngrok.http
ngrok.http: setup.ngrok
ngrok http -subdomain restyled 3000
.PHONY: image
image:
docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(HOME)"/.docker/config.json:/root/.docker/config.json:ro \
--volume "$(PWD)":/build:ro \
--workdir /build \
restyled/ops:v5 docker-build-remote-cache \
restyled/restyled.io:testing \
--build-arg "REVISION=testing"
.PHONY: image.check
image.check: image
docker run -it --rm --net=host \
--volume "$(PWD)"/.env.development:/app/.env:ro \
restyled/restyled.io:testing /app/restyled.io \
-e .env web