Speedup your rake tasks!

I work in a Rails CRM application which has a fairly large number of files (.rb). - To run all the features error free - We need to eager load most files in Development mode!(Ouch!)

The app uses Sunspot gem to interact with Solr server. You can start your solr server by the following command

rake sunspot:solr:start

The Problem

Generally if this is a new app - Starting solr through rake does not take more than a few seconds. But here the problem is using rake in our App.

Running a rake tasks eager-loads a lot of Ruby files into the Run-time and it takes more than 5 seconds to complete

Workaround: We often keep rails console open in development mode - So whenever there is a need to start solr server and I am already inside a rails console I will Just do

require 'rake'
MyRailsApp::Application.load_tasks
Rake::Task['sunspot:solr:start'].invoke

And in just a few seconds solr server would be up and running!

enter image description here