From a1fd6263d5c874f7c7466f0e3774ed229d5bcad5 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 3 Feb 2026 18:37:00 +0100 Subject: [PATCH 1/3] Add ImageMagick pre-flight check to db:seed Validates ImageMagick (convert or magick) is installed before attempting to seed the database. Fails fast with clear installation instructions instead of silently producing incomplete data. --- db/seeds.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index adc65b06f..d0bd05459 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,4 +1,25 @@ if Rails.env.development? + # Check for ImageMagick before seeding + imagemagick_available = system('convert --version > /dev/null 2>&1') || + system('magick --version > /dev/null 2>&1') + + unless imagemagick_available + Rails.logger.error "=" * 80 + Rails.logger.error "ERROR: ImageMagick is required to run db:seed" + Rails.logger.error "=" * 80 + Rails.logger.error "" + Rails.logger.error "The seed task processes sponsor logo images, which requires ImageMagick." + Rails.logger.error "" + Rails.logger.error "Install ImageMagick:" + Rails.logger.error " macOS: brew install imagemagick" + Rails.logger.error " Ubuntu/Debian: apt-get install imagemagick" + Rails.logger.error " Windows: https://imagemagick.org/script/download.php" + Rails.logger.error "" + Rails.logger.error "See native-installation-instructions.md for details." + Rails.logger.error "=" * 80 + exit 1 + end + begin Rails.logger.info 'Running migrations...' Rails.application.config.log_level = :info From d9d2c8b162917e82b37f00ba77922a1a59937a32 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 3 Feb 2026 18:47:50 +0100 Subject: [PATCH 2/3] Emphasize ImageMagick is required for db:seed Add comment explaining ImageMagick is required for image processing and that db:seed will fail without it. --- native-installation-instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native-installation-instructions.md b/native-installation-instructions.md index 2112065b1..c876a778d 100644 --- a/native-installation-instructions.md +++ b/native-installation-instructions.md @@ -47,7 +47,7 @@ brew install postgresql brew services start postgresql ``` -Install other dependencies: +Install required dependencies: ``` brew install imagemagick ``` From f975359b148383c07884ddbc444d9a12a06308dc Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 3 Feb 2026 18:44:30 +0100 Subject: [PATCH 3/3] Document ImageMagick difference between Docker and native Clarify that Docker includes ImageMagick automatically, but native installation requires manual installation. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 06c0a6d5b..0c0ac1de9 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ Before you start, you will need to have Docker installed and running. You can [d Run `bin/dup` to build and create the docker container. This will also set up the Rails application within the container and start the container. You will only have to run this command once. After initial setup, use `bin/dstart` to start an existing container - using `bin/dup` will recreate an existing container and reset the database. +**Note:** The Docker setup includes ImageMagick automatically. If you're using native installation, you must install ImageMagick separately (see [native-installation-instructions.md](./native-installation-instructions.md)). + ### 4. Start the app Run `bin/dserver` to start the Rails server.