Silencing Rails 2.2 "gem has no specification" messages

升级到Rails2.2后,可能会频繁遇到宝石没有规范文件的警告。本文介绍如何通过修改配置文件来消除这些警告,提升开发体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Since upgrading to Rails 2.2, you might be seeing lots of messages like this:

config.gem: Unpacked gem blah-1.0.0 in vendor/gems
has no specification file. Run 'rake gems:refresh_specs' to fix this.


Running 'rake gems:refresh_specs" takes care of most of these, and upgrading any remaining gems will usually take care of the rest. But it seems like most of the projects I'm on still have one or three home-grown, really old, or really odd gems that just don't have specs. I should write specs for these, I know. So I let Rails complain... but...

But now, months later, I'm realizing there are just a few gems I'm never going to upgrade. And I'm seeing these messages... A LOT. Every time I run a test in TextMate. Every time I run tests from rake. Every time I run almost any rake task, period. It's driving me MAD!

So, if you've been a good boy or girl and taken care of most your gems, and a few are still hanging around, here's the magic to make those messages go away:

In your config/environment.rb file:

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

# Add this line at your own risk!
Rails::VendorGemSourceIndex.silence_spec_warnings = true

Rails::Initializer.run do |config|


url:http://tech.hickorywind.org/articles/2009/02/02/silencing-rails-2-2-gem-has-no-specification-messages
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值