Run rake tasks in emacs with rinari

I use emacs and rinari when I’m working on ChiliProject. I learned from reading Continuous Testing is that I should be able to run all of my tests with a single key command in an IDE. Unfortunately, ChiliProject’s full test suite takes about 20 minutes to run on my desktop (a whole different problem I’ll be fixing). To speed the tests up I’ve been using parallel_tests but in order to run them in rinari I’d need to type in the full command into the rake prompt.

C-c ; r

So with a bit of digging I was able to write an emacs function to run the rake command for me and also bind it to a key sequence in rinari.

(defun rails-parallel-tests ()
  (rinari-rake "parallel:test"))
(define-key rinari-minor-mode-map (kbd "C-c ; p") 'rails-parallel-tests)