Silencing Rails 2.2 "gem has no specification" messages

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

你可能感兴趣的:(REST,Rails,Go)