如何运行带有警告的所有Ruby脚本? [英] How can I run all Ruby scripts with warnings?

查看:172
本文介绍了如何运行带有警告的所有Ruby脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



理想情况下,即使我在...时,我也可以运行Ruby脚本,默认情况下会打开警告通过Rake间接运行脚本,而不是直接在我直接运行时。



根据这个答案

解决方案

RUBYOPT 环境变量定义默认选项,如警告等。



Unix / OS X / etc:

  export RUBYOPT = -w 

您可以将其放在Unix的启动脚本中,以便它设置为新的shell。



Windows:

 设置RUBYOPT = -w 

使用系统属性对话框将其设置为新shell /命令窗口。


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.

这篇关于如何运行带有警告的所有Ruby脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆