-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (53 loc) · 1.5 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
APP_ENV := development
DB_NAME := my_new_app_$(APP_ENV) # FIXME: use desired database name
DB_USER := postgres
STEPS := 1
TEST_PATH := spec
PORT := 3000
WORKDIR := /usr/app
export PORT
export WORKDIR
db-connect:
@docker compose exec db psql -U $(DB_USER) -d $(DB_NAME)
db-create:
@docker compose exec app bundle exec rails db:create
db-generate-migration:
@docker compose exec app bundle exec rails g migration $(NAME)
db-migrate:
@docker compose exec app bundle exec rails db:migrate RAILS_ENV=$(APP_ENV)
db-rollback:
@docker compose exec app bundle exec rails db:rollback RAILS_ENV=$(APP_ENV) STEP=$(STEPS)
restart-server:
@docker compose exec app bundle exec rails restart
start:
@docker compose up -d $(SERVICES)
start-build:
@docker compose up --build -d $(SERVICES)
stop:
@docker compose stop
restart:
make stop
make start
restart-build:
make stop
make start-build
destroy:
@docker compose down
install:
@docker compose exec app bundle install
console:
@docker compose exec app bundle exec rails console -e $(APP_ENV)
routes:
@docker compose exec app bundle exec rails routes
test:
@docker compose exec app bundle exec rspec ${TEST_PATH}
lint:
@docker compose exec app bundle exec rubocop
logs:
@docker compose logs $(SERVICE) -f
# Do not run from integrated terminal in VSCodium
# control + p, control + q for ending the debugging session
debug:
@docker attach $$(docker compose ps -q app)
edit-credentials:
@docker compose exec app env EDITOR="vim" bundle exec rails credentials:edit