Cheer with Ruby Rake

Firstly thanks to the creator of Rake, Jim Weirich, provided this great and powerful tool to the world.

Have you ever had to perform boring, repetitive tasks while building up the project or doing daily computer tasks?

Also wanna to do automate these kind of typing works to better the life? If yes, you may find the fit solution in this tool.

Following that will briefly describe Rake with Ruby via 5W1H method.

1) What is Rake?

Rake was initially implemented as a Ruby version of Make, which is a commonly used build utility.

However, it can also make use as an automation tool that allow to put all the required tasks into one formatted place.

The following is the mindmap about Rake obtained from the post,

ruby-rake-mindmap

2) Why choose Rake?

  • provides one neat and tidy place for all software management tasks for a project

  • gives task dependencies for tasks to enable run task on the sequence

  • works with files easily as it contains built-in Ruby file utilities

  • allows to run tasks in parallel by built-in multitask methods

3) Who are Rake’s target?

  • Developer who want to use make-like build tool to automate the tasks inside projects

  • Site Administrator who have to maintain and troubleshoot the service through many tasks

  • Project itself which contains a set of tasks, e.g. Rails

4) When use Rake?

  • need a powerful, understandable tool to manage a set of project management tasks

  • need to centralize and manipulate the tasks in the server by one console

  • need to automate numbers of boring, repetitive computer tasks in a clear and elegant way

5) Where use Rake?

  • Compile to source code to binary

  • Package the binary

  • Run various of tests or checking

  • Build and deploy the project to production

  • Create documentation or release notes

    … and more tasks wanna to execute

6) How to get start to use Rake?

To use Rake you have to install Ruby in the host first, there are many ways to install Ruby but the best is using RVM,

a command-line tool which manage multiple ruby versions with own sets of gems that useful for Ruby development.

As Rake is default installed in Ruby since version 1.9, such that can call command rake directly.

To use rake, you need to have Rake file, there are four variants of its name which can use either one.

  • rakefile
  • Rakefile
  • rakefile.rb
  • Rakefile.rb

Let’s define a default rake test and try to call, create a file Rakefile in directory with content,

desc "Says 'Hello, Rake'"
task :default do
  puts 'Hello Rake'
end

Now can run rake with command,

$ rake	# OR rake default
Hello, Rake

A simple Rakefile is created then can get started to work out your own set!

Comments