Search This Blog

May 7, 2011

... the gem has no specification file. Run 'rake gems:refresh_specs' to fix this.


Did you happen to vendorized gem and get a warning message like, "... the gem has no specification file. Run 'rake gems:refresh_specs' to fix this."? Afterr looking at the warning message did you try running the suggested rake command - rake gems:refresh_specs - to no avail? What next? How the heck do I get rid of this warning message?

Well, in times when gems for some reason doesn't vendorize the requisite specification file for that vendorized gem. You may have to run the following command in the respective gem's vendorized directory:

gem specification gem_name_without_version_number > .specification

Here is an example of my case wherein, I vendorized the factory girl post my installing it in my gemset and tried running the server. I got a warning message as below:

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


kartz@desktop:~/MyRubyProjects/my_project$ cd vendor/gems/factory_girl-1.3.3/

kartz@desktop:~/MyRubyProjects/my_project/vendor/gems/factory_girl-1.3.3/$ gem specification factory_girl > .specification

After this I tried running the server or any rake task, and yeah as told earlier the warning message vanished....

Recommended reading:
Serious about learning and appreciating Ruby? Then, I strongly recommend reading