As a Rails developer you're probably familiar with running "rake" to run your tests or maybe you've used "rake db:migrate" to run your migrations. But do you really understand what's going on under the hood of these Rake tasks? Did you realize that you can write your own tasks or create your own library of useful Rake files?

Here are a few examples of how I've used Rake tasks:

  • Pulling a list of members to send out an email.
  • Doing nightly data calculations and reporting.
  • Expiring and regenerating caches.
  • Making backups of my database and subversion repository.
  • Running any sort of data manipulation script.
  • Pouring drinks to get a good buzz on.

In this article we're going to discover why Rake was created, and how it can help our Rails applications. By the end you should be able to write your own tasks, and learn how to get piss drunk using rake in no less then three steps.

This article is also available in French, Russian, Chinese, Polish, and Spanish.

AddThis Social Bookmark Button Tags: rake tutorial  | permalink