Rake Has Never Been Easier

Monkey with a rake

RailsEnvy has posted a long and really excellent article (filled with their trademark wit) on how to use Rake in Ruby on Rails. They give a history of Make and Rake, then walk you through the concepts and steps of creating your own Rake tasks. After their tutorial, you’ll be using Rake all the time. I know I will.

Here are a few of the built-in Rake tasks that might ease some development pain. (A full list is available by typing rake ––tasks from inside the root directory of your Rails application.

  • rake log:clear # Truncates all *.log files in log/ to zero bytes
  • rake tmp:clear # Clear session, cache, and socket files from tmp/
  • rake tmp:cache:clear # Clears all files and directories in tmp/cache
  • rake tmp:pids:clear # Clears all files in tmp/pids
  • rake tmp:sockets:clear # Clears all files in tmp/sockets
  • rake tmp:sessions:clear # Clears all files in tmp/sessions
  • rake db:sessions:clear # Clear the sessions table

Make sure you check out the links at the bottom of their article to see some of the custom Rake tasks that are already out there just waiting for you to take advantage of them.

Leave a Reply