Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run all Ruby scripts with warnings?

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.

like image 513
Andrew Grimm Avatar asked Apr 15 '26 01:04

Andrew Grimm


1 Answers

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.

like image 182
Dave Newton Avatar answered Apr 17 '26 15:04

Dave Newton