-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
102 lines (81 loc) · 2.33 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
DOCKER_BIN=docker compose
# Check if the CI environment variable is set to "true"
ifeq ($(CI),true)
# If CI=true, define a variable with a Compose file that has a CI override
TEST_DOCKER_FILES = -f docker-compose.yml -f docker-compose.ci.yml -f docker-compose.test.yml
else
# If CI is not set to true or has a different value, use the normal Compose file
TEST_DOCKER_FILES=-f docker-compose.yml -f docker-compose.test.yml
endif
.PHONY: up
up:
$(DOCKER_BIN) up --build
.PHONY: build
build:
$(DOCKER_BIN) build
.PHONY: down
down:
$(DOCKER_BIN) $(TEST_DOCKER_FILES) down --remove-orphans --volumes
.PHONY: clean
clean:
$(DOCKER_BIN) $(TEST_DOCKER_FILES) down --remove-orphans --volumes --rmi all
.PHONY: test
test:
$(DOCKER_BIN) $(TEST_DOCKER_FILES) up -d --build
$(DOCKER_BIN) exec web bundle exec rake assets:precompile
$(DOCKER_BIN) exec -e RAILS_ENV=test web rails t
$(DOCKER_BIN) down
.PHONY: test-coverage
test-coverage:
$(DOCKER_BIN) $(TEST_DOCKER_FILES) up -d --build
$(DOCKER_BIN) exec web bundle exec rake assets:precompile
$(DOCKER_BIN) exec -e RAILS_ENV=test -e COVERAGE=true web rails t
$(DOCKER_BIN) down
.PHONY: lint
lint:
$(DOCKER_BIN) $(TEST_DOCKER_FILES) up -d --build
$(DOCKER_BIN) exec web bundle exec rake factory_bot:lint
$(DOCKER_BIN) exec web bundle exec standardrb
.PHONY: shell-dev
shell-dev:
$(DOCKER_BIN) up -d --build
$(DOCKER_BIN) exec -it web /bin/bash
.PHONY: shell-test
shell-test:
$(DOCKER_BIN) $(TEST_DOCKER_FILES) up -d --build
$(DOCKER_BIN) exec -it -e RAILS_ENV=test web /bin/bash
.PHONY: rails-console
rails-console:
$(DOCKER_BIN) exec web rails c
.PHONY: ruby-prepare
ruby-prepare:
bundle install
bundle exec rake assets:precompile
bundle exec rails db:prepare
.PHONY: ruby-console
ruby-console:
bin/rails c
.PHONY: ruby-postgres
ruby-postgres:
psql -U
.PHONY: ruby-test-prepare
ruby-test-prepare:
bundle exec rake assets:precompile
bundle exec rails db:create
bundle exec rails db:migrate
.PHONY: test
ruby-test: ruby-test-prepare
bin/rails t
.PHONY: ruby-lint
ruby-lint:
bundle exec rake factory_bot:lint
bundle exec standardrb
.PHONY: pg-shell
pg-shell:
$(DOCKER_BIN) exec -it db psql -U postgres -d budget-io-dev --
.PHONY: pg-bash
pg-bash:
$(DOCKER_BIN) exec -it db /bin/bash --
.PHONY: up-production
up-production:
$(DOCKER_BIN) --env-file ./.env.production.local up --build