by mars on 2011-04-16 0 Comments
filed in with tags , ,

Confounded by the inability of Ruby on Rails' rake gems:install to do its work? Rake FAIL?

My specific experience is that gems:install depends on the gems it tries to install!

I found some answers at Stack Overflow, but none fix my situation.

Ends up this Rails app had quite a few tasks defined in lib/tasks that began with require 'config/environment'. Since rake loads all those tasks on start-up, it was trying to boot the whole Rails environment every time.

The Fix

Swap out require 'config/environment' with proper task dependencies, like task :make_me_coffee => :environment do … end.

Epilog

Rails' rake task files are all loaded on each call to rake. Use require carefully, perhaps putting the statement inside the tasks' do … end block or declaring a task dependency.

Leave a Reply

Markdown is in effect.



Everything is here.