Skip to content

Commit da9a213

Browse files
committed
build: Update dev setup
1 parent 9aa9a51 commit da9a213

File tree

8 files changed

+36
-52
lines changed

8 files changed

+36
-52
lines changed

.dockerignore

Lines changed: 0 additions & 15 deletions
This file was deleted.

Makefile

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
11
include extra/.env
22

33
help:
4-
@echo "Main targets: build / specs / up / server / specs / shell"
4+
@echo -e "${COMPOSE_PROJECT_NAME} - Main project commands:\n\
5+
make up # starts the dev services (optional env vars: RUBY / RAILS / ACTIVEADMIN)\n\
6+
make specs # run the tests (after up)\n\
7+
make lint # run the linters (after up)\n\
8+
make server # run the server (after up)\n\
9+
make shell # open a shell (after up)\n\
10+
make down # cleanup (after up)\n\
11+
Example: RUBY=3.2 RAILS=7.1.0 ACTIVEADMIN=3.2.0 make up"
512

6-
# Docker commands
13+
# System commands
714

815
build:
9-
@rm -f Gemfile.lock
16+
@rm -f Gemfile.lock spec/dummy/db/*.sqlite3
1017
@docker compose -f extra/docker-compose.yml build
1118

12-
up: build
19+
db_reset:
20+
@docker compose -f extra/docker-compose.yml run --rm app bin/rails db:reset db:test:prepare
21+
22+
up: build db_reset
1323
@docker compose -f extra/docker-compose.yml up
1424

15-
cleanup:
25+
shell:
26+
@docker compose -f extra/docker-compose.yml exec app bash
27+
28+
down:
1629
@docker compose -f extra/docker-compose.yml down --volumes --rmi local --remove-orphans
1730

1831
# App commands
1932

20-
server:
21-
@docker compose -f extra/docker-compose.yml exec app bin/rails s -b 0.0.0.0 -p ${SERVER_PORT}
22-
23-
specs:
24-
@docker compose -f extra/docker-compose.yml exec app bin/rspec --fail-fast
33+
console:
34+
@docker compose -f extra/docker-compose.yml exec app bin/rails console
2535

2636
lint:
2737
@docker compose -f extra/docker-compose.yml exec app bin/rubocop
2838

29-
shell:
30-
@docker compose -f extra/docker-compose.yml exec app bash
39+
server:
40+
@docker compose -f extra/docker-compose.yml exec app bin/rails server -b 0.0.0.0 -p ${SERVER_PORT}
41+
42+
specs:
43+
@docker compose -f extra/docker-compose.yml exec app bin/rspec --fail-fast

extra/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENV DEVEL=1
66
ENV LANG=C.UTF-8
77

88
RUN apt-get update -qq
9-
RUN apt-get install -yqq --no-install-recommends build-essential chromium libyaml-dev nano netcat-traditional pkg-config
9+
RUN apt-get install -yqq --no-install-recommends build-essential chromium less libyaml-dev nano netcat-traditional pkg-config
1010

1111
ARG BUNDLER_VERSION
1212
RUN gem install bundler -v ${BUNDLER_VERSION}
@@ -26,6 +26,6 @@ ENV ACTIVEADMIN_VERSION=$ACTIVEADMIN_VERSION
2626
WORKDIR /app
2727
COPY . /app
2828
RUN bundle install
29-
RUN chown -R app:app /app/spec/dummy/db /usr/local/bundle
29+
RUN mkdir -p /app/spec/dummy/db && chown -R app:app /app/spec/dummy/db /usr/local/bundle
3030

3131
RUN ln -s /app/extra/.bashrc /home/app/.bashrc

extra/Dockerfile.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ignore everything but the required files for bundle install
2+
/**/*
3+
4+
!/*.gemspec
5+
!/Gemfile
6+
!/lib

extra/dev_setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export DEVEL=1
44

5-
export RAILS_VERSION=8.0.2
5+
export RAILS_VERSION=7.2.2.1
66
export ACTIVEADMIN_VERSION=3.3.0
77

88
export RAILS_ENV=development

extra/development.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### Dev setup
44

5-
There 3 ways to interact with this project:
5+
There 2 ways to interact with this project:
66

77
1) Using Docker:
88

@@ -24,19 +24,7 @@ RUBY=3.2 RAILS=7.1.0 ACTIVEADMIN=3.2.0 make up
2424
# For more commands please check the Makefile
2525
```
2626

27-
2) Using Appraisal:
28-
29-
```sh
30-
export RAILS_ENV=development
31-
# Install dependencies:
32-
bin/appraisal
33-
# Run server (or any command):
34-
bin/appraisal rails s
35-
# Or with a specific configuration:
36-
bin/appraisal rails80-activeadmin rails s
37-
```
38-
39-
3) With a local setup:
27+
2) With a local setup:
4028

4129
```sh
4230
# Dev setup (set the required envs):

extra/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ services:
1717
- ..:/app
1818
stdin_open: true
1919
tty: true
20-
command: ${COMMAND:-extra/init.sh}

extra/init.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)