30 April 2009

Interactive Rake

I often find myself using rake -T. I always have a vague idea of the name of the Rake task I’d like to run but often tasks with long names slip my mind. I’m also incredibly lazy and don’t want to type the entire name of the task if I don’t have to.
That’s why I decided I needed Interactive Rake. The ability to search though my tasks and then choose the one I’d like to run from a list.

For example, to search your tasks for the name “create”, then run rake tmp:create

1 craig:themoves.co.uk craig$ rake -i create
2 (in /Users/craig/rails_sites/themoves.co.uk)
3 0) rake db:create           # Create the database defined in config/database.yml for the current RAILS_ENV
4 1) rake db:create:all       # Create all the local databases defined in config/database.yml
5 2) rake db:sessions:create  # Creates a sessions migration for use with ActiveRecord::SessionStore
6 3) rake tmp:create          # Creates tmp directories for sessions, cache, sockets, and pids
7 Choose a task: 3

Sadly Jim Weirich is being elusive so I’m having trouble getting my fork merged back in to the trunk. If you’d like to use Interactive Rake it’s hosted at github.com/craigmarksmith/rake