forked from OperationCode/operationcode_backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
102 lines (76 loc) · 2.19 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
RAILS_CONTAINER := web
DOCKER := docker
DOCKER_COMPOSE := docker-compose
.PHONY: all
all: run
.PHONY: nuke
nuke:
${DOCKER} system prune -a --volumes
.PHONY: minty-fresh
minty-fresh:
${DOCKER_COMPOSE} down --rmi all --volumes
.PHONY: rmi
rmi:
${DOCKER} images -q | xargs docker rmi -f
.PHONY: rmdi
rmdi:
${DOCKER} images -a --filter=dangling=true -q | xargs ${DOCKER} rmi
.PHONY: rm-exited-containers
rm-exited-containers:
${DOCKER} ps -a -q -f status=exited | xargs ${DOCKER} rm -v
.PHONY: fresh-restart
fresh-restart: minty-fresh setup test run
.PHONY: console-sandbox
console-sandbox:
docker-compose run ${RAILS_CONTAINER} bundle exec rails console --sandbox
.PHONY: run
run:
docker-compose up --build
.PHONY: bg
bg:
docker-compose up --build -d
.PHONY: open
open:
open http://localhost:3000
.PHONY: build
build:
docker-compose build
.PHONY: console
console:
docker-compose run ${RAILS_CONTAINER} bundle exec rails console
.PHONY: routes
routes:
docker-compose run ${RAILS_CONTAINER} bundle exec rake routes
.PHONY: db_create
db_create:
docker-compose run ${RAILS_CONTAINER} bundle exec rake db:create
.PHONY: db_migrate
db_migrate:
docker-compose run ${RAILS_CONTAINER} bundle exec rake db:migrate
.PHONY: db_status
db_status:
docker-compose run ${RAILS_CONTAINER} bundle exec rake db:migrate:status
.PHONY: db_rollback
db_rollback:
docker-compose run ${RAILS_CONTAINER} bundle exec rake db:rollback
.PHONY: db_seed
db_seed:
docker-compose run ${RAILS_CONTAINER} bundle exec rake db:seed
.PHONY: test
test: bg
docker-compose run operationcode-psql bash -c "while ! psql --host=operationcode-psql --username=postgres -c 'SELECT 1'; do sleep 5; done;"
docker-compose run ${RAILS_CONTAINER} bash -c 'export RAILS_ENV=test && bundle exec rake db:test:prepare && bundle exec rake test && bundle exec rubocop'
.PHONY: rubocop
rubocop:
docker-compose run ${RAILS_CONTAINER} bundle exec rubocop
.PHONY: rubocop_auto_correct
rubocop_auto_correct:
docker-compose run ${RAILS_CONTAINER} bundle exec rubocop -a --auto-correct
.PHONY: bundle
bundle:
docker-compose run ${RAILS_CONTAINER} bash -c 'cd /app && bundle'
setup: build db_create db_migrate
publish: build
bin/publish
upgrade: publish
bin/deploy