Skip to content

Warn when perron:build is not run in production mode#149

Merged
eelcoj merged 2 commits intoRails-Designer:mainfrom
ianyamey:ian/fix-production-env-passthrough
Feb 26, 2026
Merged

Warn when perron:build is not run in production mode#149
eelcoj merged 2 commits intoRails-Designer:mainfrom
ianyamey:ian/fix-production-env-passthrough

Conversation

@ianyamey
Copy link
Contributor

@ianyamey ianyamey commented Feb 24, 2026

Summary

  • The set_production_env rake task from Default RAILS_ENV to production for perron:build #121 set ENV["RAILS_ENV"] but couldn't change the memoized Rails.env (which is set before any rake tasks execute), so the build still ran in development mode
  • Replaces the env override with a warning message when not running in production, guiding the user to run RAILS_ENV=production bin/rails perron:build

Fixes the issue reported in #121 (comment)

Example output

❯ bin/rails perron:build
⚠️  Not running in production mode. Unpublished content will be included in the build.
 └─> Run in production mode using: RAILS_ENV=production bin/rails perron:build

🧹 Cleaning previous build…
📦 Precompiling and copying assets…
...

Test plan

  • Run bin/rails perron:build without RAILS_ENV — should print a warning with the correct command
  • Run RAILS_ENV=production bin/rails perron:build — should produce no warning

The previous set_production_env task set ENV["RAILS_ENV"] but couldn't
actually change the memoized Rails.env, so the build still ran in
development mode. Instead of fighting the Rails boot sequence, warn the
user when not running in production and let them decide.
@ianyamey ianyamey force-pushed the ian/fix-production-env-passthrough branch from cd76ce6 to 9149270 Compare February 24, 2026 17:38
@eelcoj
Copy link
Contributor

eelcoj commented Feb 26, 2026

I like this! Bonus points for the emojis! 😄 💯

Thanks! ❤️

@eelcoj eelcoj merged commit 90ea8c1 into Rails-Designer:main Feb 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants