|
| 1 | +# Development |
| 2 | + |
| 3 | +There 3 ways to interact with this project: |
| 4 | + |
| 5 | +1) Using Docker: |
| 6 | + |
| 7 | +```sh |
| 8 | +# Run rails server on the dummy app (=> http://localhost:3000 to access to ActiveAdmin): |
| 9 | +make up |
| 10 | +# Enter in a Rails console (with the dummy app started): |
| 11 | +make console |
| 12 | +# Enter in a shell (with the dummy app started): |
| 13 | +make shell |
| 14 | +# Run the linter on the project (with the dummy app started): |
| 15 | +make lint |
| 16 | +# Run the test suite (with the dummy app started): |
| 17 | +make specs |
| 18 | +# Remove container and image: |
| 19 | +make cleanup |
| 20 | +# To try different versions of Ruby/Rails/ActiveAdmin edit docker-compose.yml |
| 21 | +# For more commands please check the Makefile |
| 22 | +``` |
| 23 | + |
| 24 | +2) Using Appraisal: |
| 25 | + |
| 26 | +```sh |
| 27 | +export RAILS_ENV=development |
| 28 | +# Install dependencies: |
| 29 | +bin/appraisal |
| 30 | +# Run server (or any command): |
| 31 | +bin/appraisal rails s |
| 32 | +# Or with a specific configuration: |
| 33 | +bin/appraisal rails80-activeadmin rails s |
| 34 | +``` |
| 35 | + |
| 36 | +3) With a local setup: |
| 37 | + |
| 38 | +```sh |
| 39 | +# Dev setup (set the required envs): |
| 40 | +source extra/dev_setup.sh |
| 41 | +# Install dependencies: |
| 42 | +bundle update |
| 43 | +# Prepare the app |
| 44 | +bin/rails db:reset |
| 45 | +# Run server (or any command): |
| 46 | +bin/rails s |
| 47 | +# To try different versions of Rails/ActiveAdmin edit extra/dev_setup.sh |
| 48 | +``` |
| 49 | + |
| 50 | +Sample code to attach a file: |
| 51 | + |
| 52 | +```ruby |
| 53 | +# Create a test post in the dummy app |
| 54 | +post = Post.create!(title: "test1") |
| 55 | +post.some_file.attach(io: Rails.root.join("../../README.md").open, filename: "README.md") |
| 56 | +``` |
| 57 | + |
| 58 | +## Releases |
| 59 | + |
| 60 | +```sh |
| 61 | +# Update lib/active_storage_db/version.rb with the new version |
| 62 | +# Update the gemfiles: |
| 63 | +bin/appraisal |
| 64 | +``` |
| 65 | + |
| 66 | +## Old dev setup |
| 67 | + |
| 68 | +Local tests: |
| 69 | + |
| 70 | +```sh |
| 71 | +# Running tests on Rails 6.1: |
| 72 | +DB_TEST=postgres bin/appraisal rails-6_1-postgres rails db:test:prepare |
| 73 | +DB_TEST=postgres bin/appraisal rails-6_1-postgres rspec |
| 74 | + |
| 75 | +# Running tests on Rails 7.0: |
| 76 | +DB_TEST=postgres bin/appraisal rails-7_0-postgres rails db:test:prepare |
| 77 | +DB_TEST=postgres bin/appraisal rails-7_0-postgres rspec |
| 78 | + |
| 79 | +# Running tests on Rails 7.1: |
| 80 | +DB_TEST=postgres bin/appraisal rails-7_1-postgres rails db:test:prepare |
| 81 | +DB_TEST=postgres bin/appraisal rails-7_1-postgres rspec |
| 82 | + |
| 83 | +# Eventually recreate the DB: |
| 84 | +DB_TEST=postgres bin/appraisal rails-7_0-postgres rails db:drop db:create db:migrate |
| 85 | +``` |
| 86 | + |
| 87 | +Using docker: |
| 88 | + |
| 89 | +```sh |
| 90 | +# Run a specific test configuration |
| 91 | +docker compose up --abort-on-container-exit -- tests_30_mysql |
| 92 | +docker compose up --abort-on-container-exit -- tests_30_postgres |
| 93 | +# Cleanup (also removing local images): |
| 94 | +docker compose down --rmi local |
| 95 | +``` |
0 commit comments