-
Notifications
You must be signed in to change notification settings - Fork 21
/
justfile
117 lines (96 loc) · 2.64 KB
/
justfile
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
116
117
# Bring system up to date after a pull
update: setup setup-tools db-migrate build lint test
# Initialize from a fresh clone
bootstrap: \
setup \
setup-tools \
setup-ngrok \
db-setup \
build \
lint \
test \
dotenv \
db-seed
# Create .env.development from .env.example, pulling secrets in AWS SSM
dotenv:
{ ./bin/make-ssm-m4; cat .env.example; } | m4 .env.development
# Drop dev and test DBs
db-drop:
PGPASSWORD=password dropdb --if-exists --user postgres --host localhost restyled
PGPASSWORD=password dropdb --if-exists --user postgres --host localhost restyled_test
# Create dev and test DBs
db-create:
PGPASSWORD=password createdb --user postgres --host localhost restyled
PGPASSWORD=password createdb --user postgres --host localhost restyled_test
# Migrate dev and test DBs
db-migrate:
db/migrate dev upgrade
db/migrate test upgrade
# Seed dev and test DBs
db-seed:
./bin/restyled.io-dev seed-db
# Setup dev and test DBs
db-setup: db-create db-migrate
# Reset dev and test DBs
db-reset: db-drop db-setup
# Open a console against dev DB
db-console:
PGHOST=localhost PGUSER=postgres PGPASSWORD=password psql restyled
# Open a console against Prod
db-console-prod:
heroku pg:psql --app restyled-io
# Setup for Haskell development
setup:
stack setup
stack build --dependencies-only --test --no-run-tests
# Setup for Haskell linting
setup-tools:
stack install --copy-compiler-tool \
apply-refact \
dhall \
fast-tags \
fourmolu \
hlint \
weeder
# Setup to use ngrok
setup-ngrok:
ngrok authtoken $$(pass ngrok/authtoken)
# Build the project
build:
stack build --pedantic --test --no-run-tests
# Lint
lint:
stack exec -- hlint . --ignore-glob src/Restyled/Widgets/Job.hs
stack exec -- weeder --require-hs-files
stack lint-extra-deps
# Test the project
test:
stack build --test
# Rebuild (and test) the project on file changes
watch:
stack build \
--fast --pedantic --test --file-watch \
--exec bin/restyled-restart \
--ghc-options -DDEVELOPMENT
# Rebuild the project on file changes
watch-no-test:
stack build \
--fast --pedantic --test --no-run-tests --file-watch \
--exec bin/restyled-restart \
--ghc-options -DDEVELOPMENT
# Run an ngrok process
ngrok-http:
ngrok http --subdomain restyled 3000
# Build the docker image
image:
docker build \
--build-arg "REVISION=testing" \
--tag restyled/restyled.io:testing \
.
# Check the build docker image
image-check: image
docker run -it --rm --net=host \
--volume "$HOME"/.aws:/root/.aws:ro \
--volume "$PWD"/.env.development:/app/.env:ro \
restyled/restyled.io:testing /app/restyled.io \
-e .env