What is Rake Anyway? (For Non-Developer’s Eyes Only)

To make my Boots on Sale app work, I needed to be able to run the code daily to make the price check. I was hosting with Heroku, and Heroku told me I needed to have a rake file in place.

So, I ended up having the following files for my app;

  • Wombat.rb – my little ruby file with the code to do the scrape and send the email
  • Gemfile 
  • Sale.rake – a rake file which did one thing – ran the wombat ruby file
  • Rakefile – which iterated through each .rake file in the directory and ran it.

(I’m not exactly sure if I needed both those rake files, but there you have it).

Note that in my Gemfile I didn’t even have the Rake Gem – but it worked. According to my Coder Friend, this because you can use Rake if it is installed in any app anywhere on your machine.

I had used the term rake before in my rails apps, but I guess I was never taught (or I never learnt) what it actually meant or did. When I started trying to research this, I got a lot of “Is the equivalent of Make” – because a lot of online resources are written for developers of other languages.

Anyway, what I have determined, as a non-developer, is that

Rake is just a programme which lets you run tasks automatically

We have some set up in Rails already e.g. $ rake db:migrate, or you can write your own rake files to run tasks you write yourself.

Rake is written in Ruby but there are some conventions on how you have to write them to run your tasks. Here is a tutorial from one of the teachers off TreeHouse, however unfortunately it isn’t all dumbed down and simple like on Treehouse :(

When you want to run your rake files (to run certain tasks), then in your terminal you can just write

$rake task_name (not the file name, the individual task name).


$rake (Which runs all the rake tasks you have in your Rakefile)

So, for my app, if I wanted to check the price of those boots right now, I would just open up the appropriate directory in my terminal and type

$ rake sale (which would execute all the necessary code).

So writing this down here is how I’m going to remember to do that ;)

Leave a reply