Skip to content

Commit 2ec7b5c

Browse files
committed
build: Update Docker dev setup (2)
1 parent d1bbf09 commit 2ec7b5c

28 files changed

+195
-73
lines changed

.dockerignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/Makefile
2+
/LICENSE.txt
3+
/Gemfile.lock
4+
/extra/init.sh
5+
6+
/app
7+
/bin
8+
/coverage
9+
/gemfiles
10+
/spec/dummy/db/*.sqlite3
11+
/spec/dummy/log
12+
/spec/dummy/tmp
13+
/spec/dummy/**/*_spec.rb
14+
15+
/**/*.md

.env

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

.github/workflows/specs_rails70.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
ruby-version: ${{ matrix.ruby }}
3030
bundler-cache: true
3131

32+
- name: Database setup
33+
run: bin/rails db:reset db:test:prepare
34+
3235
- name: Run tests
3336
run: bundle exec rspec --profile
3437

.github/workflows/specs_rails71.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
ruby-version: ${{ matrix.ruby }}
3030
bundler-cache: true
3131

32+
- name: Database setup
33+
run: bin/rails db:reset db:test:prepare
34+
3235
- name: Run tests
3336
run: bundle exec rspec --profile
3437

.github/workflows/specs_rails72.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
ruby-version: ${{ matrix.ruby }}
3030
bundler-cache: true
3131

32+
- name: Database setup
33+
run: bin/rails db:reset db:test:prepare
34+
3235
- name: Run tests
3336
run: bundle exec rspec --profile
3437

.github/workflows/specs_rails80.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
ruby-version: ${{ matrix.ruby }}
3030
bundler-cache: true
3131

32+
- name: Database setup
33+
run: bin/rails db:reset db:test:prepare
34+
3235
- name: Run tests
3336
run: bundle exec rspec --profile
3437

Gemfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@
33
source 'https://rubygems.org'
44

55
if ENV['DEVEL'] == '1'
6-
rails_ver = ENV.fetch('RAILS_VERSION')
7-
gem 'rails', rails_ver
6+
rails_ver = ENV.fetch('RAILS_VERSION', '')
7+
activeadmin_ver = ENV.fetch('ACTIVEADMIN_VERSION', '')
8+
9+
if rails_ver.empty?
10+
gem 'rails'
11+
else
12+
gem 'rails', "~> #{rails_ver}"
13+
end
14+
15+
if activeadmin_ver.empty?
16+
gem 'activeadmin'
17+
else
18+
gem 'activeadmin', "~> #{activeadmin_ver}"
19+
end
820

9-
gem 'activeadmin', ENV.fetch('ACTIVEADMIN_VERSION')
1021
gem 'activeadmin_dynamic_fields', path: './'
1122
gem 'appraisal', '~> 2.4'
1223

Makefile

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,59 @@
1+
include extra/.env
2+
13
help:
2-
@echo "Main targets: up / down / console / shell"
4+
@echo "Main targets: build / specs / up / console / shell"
35

46
# Docker commands
5-
down:
6-
docker compose down
7-
8-
up:
9-
docker compose up
107

11-
attach:
12-
docker compose attach app
8+
build:
9+
@rm -f Gemfile.lock
10+
@docker compose -f extra/docker-compose.yml build
1311

14-
up_attach:
15-
docker compose up -d && docker compose attach app
12+
up: build
13+
@docker compose -f extra/docker-compose.yml up
1614

1715
cleanup:
18-
docker container rm -f activeadmin_dynamic_fields_app && docker image rm -f activeadmin_dynamic_fields-app
16+
@docker compose -f extra/docker-compose.yml down -v --rmi local --remove-orphans
1917

20-
# Rails specific commands
21-
console:
22-
docker compose exec -e "PAGER=more" app bin/rails console
18+
# App commands
2319

24-
routes:
25-
docker compose exec app bin/rails routes
20+
server:
21+
@docker compose -f extra/docker-compose.yml exec app bin/rails s -b 0.0.0.0 -p ${SERVER_PORT}
2622

2723
specs:
28-
docker compose exec app bin/rspec --fail-fast
24+
@docker compose -f extra/docker-compose.yml exec app bin/rspec --fail-fast
25+
26+
shell:
27+
@docker compose -f extra/docker-compose.yml exec app bash
28+
29+
30+
# Docker commands
31+
# down:
32+
# docker compose down
33+
34+
# up:
35+
# docker compose up
36+
37+
# attach:
38+
# docker compose attach app
39+
40+
# up_attach:
41+
# docker compose up -d && docker compose attach app
42+
43+
# cleanup:
44+
# docker container rm -f activeadmin_dynamic_fields_app && docker image rm -f activeadmin_dynamic_fields-app
45+
46+
# Rails specific commands
47+
# console:
48+
# docker compose exec -e "PAGER=more" app bin/rails console
49+
50+
# specs:
51+
# docker compose exec app bin/rspec --fail-fast
2952

3053
# Other commands
31-
bundle:
32-
docker compose exec app bundle
3354

34-
shell:
35-
docker compose exec -e "PAGER=more" app bash
55+
# shell:
56+
# docker compose exec -e "PAGER=more" app bash
3657

37-
lint:
38-
docker compose exec app bin/rubocop
58+
# lint:
59+
# docker compose exec app bin/rubocop

Rakefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# frozen_string_literal: true
22

3+
begin
4+
require 'bundler/setup'
5+
rescue LoadError
6+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7+
end
8+
9+
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
10+
load 'rails/tasks/engine.rake'
11+
12+
load 'rails/tasks/statistics.rake'
13+
314
require 'bundler/gem_tasks'
415

516
begin

activeadmin_dynamic_fields.gemspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# frozen_string_literal: true
22

3-
lib = File.expand_path('lib', __dir__)
4-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3+
$:.push File.expand_path('lib', __dir__)
54
require 'activeadmin/dynamic_fields/version'
65

76
Gem::Specification.new do |spec|

0 commit comments

Comments
 (0)