Silencing Rails 2.2 "gem has no specification" messages

Posted by Larry Karnowski Mon, 02 Feb 2009 23:14:00 GMT

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|

Tags , , , ,  | 6 comments

Comments

  1. George Anderson said 22 days later:

    Thank you!

  2. Alastair Brunton said about 1 month later:

    Legend!

  3. Darejan Khetaguri said about 1 month later:

    Mountain Travel Agency from Kazbegi,Georgia offers tourist services.The prices will be lower in this year.Please see our web:www.mtainfo.ge.Thank you in advance.Please write to me.Daro Khetaguri.

  4. Larry Hannay said 3 months later:

    Thanks a bunch!

  5. picktorrent said 6 months later:

    Thanks from me as well.

  6. Ville said 7 months later:

    Legend - wait for it - dary!!

Comments are disabled