-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
128 lines (83 loc) · 2.27 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# https://stackoverflow.com/a/14061796/2237879
#
# This hack allows you to run make commands with any set of arguments.
#
# For example, these lines are the same:
# > make g devise:install
# > bundle exec rails generate devise:install
# And these:
# > make add-migration add_deleted_at_to_users deleted_at:datetime
# > bundle exec rails g migration add_deleted_at_to_users deleted_at:datetime
# And these:
# > make add-model Order user:references record:references{polymorphic}
# > bundle exec rails g model Order user:references record:references{polymorphic}
#
RUN_ARGS := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
CONTAINER_NAME=ghcr.io/gambala/rubyshow
PORT=3000
ID_FILE=.container_id
.PHONY: test
add-migration:
bundle exec rails g migration $(RUN_ARGS)
add-model:
bundle exec rails g model $(RUN_ARGS)
db-create:
bundle exec rake db:create
db-migrate:
bundle exec rake db:migrate
db-rollback:
bundle exec rake db:rollback
docker-build:
docker build -t $(CONTAINER_NAME) .
docker-run:
@echo "Running Docker container..."
@docker run -dp $(PORT):$(PORT) $(CONTAINER_NAME) > $(ID_FILE)
@echo "Container started: $$(cat $(ID_FILE))"
docker-stop:
@if [ -f $(ID_FILE) ]; then \
CONTAINER_ID=$$(cat $(ID_FILE)); \
echo "Stopping Docker container: $$CONTAINER_ID"; \
docker stop $$CONTAINER_ID; \
rm $(ID_FILE); \
echo "Container stopped."; \
else \
echo "No container ID file found. Is the container running?"; \
fi
lint-js:
./node_modules/.bin/eslint frontend --fix
lint-ruby-setup:
bundle exec rubocop --auto-gen-config
lint-ruby:
bundle exec rubocop -a
lint-security:
brakeman
run-bundle-install:
MAKE="make --jobs 8" bundle install
run-bundle-update-setup:
gem install bundle_update_interactive
run-bundle-update:
bundle ui
run-command:
$(RUN_ARGS)
run-console:
bundle exec rails console
run-frontend-update:
pnpm update --interactive --latest
run-frontend-upgrade:
pnpm update
run-generate:
bundle exec rails generate $(RUN_ARGS)
run-rails:
bundle exec puma -t 1:1 -b tcp://0.0.0.0:3000
run-sidekiq:
bundle exec sidekiq -q critical,9 -q default,5 -q low,1
test:
rails test
bi: run-bundle-install
bu: run-bundle-update
c: run-console
fu: run-frontend-update
fuu: run-frontend-upgrade
g: run-generate
s:
bin/dev