How can I always run Ruby scripts with warnings turned on by default, by modifying my Unix or Windows environment variables?
Ideally this should work even when I'm running a script indirectly such as through Rake, not just when I'm running it directly.
Based on a comment in this answer.
The RUBYOPT environment variable defines default options like warnings, etc.
Unix/OS X/etc:
export RUBYOPT=-w
You can put this in your startup script in Unix so it's set for new shells.
Windows:
set RUBYOPT=-w
Use the system properties dialog to set it for new shells/command windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With