Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Rake. 2 Automated Build Any non-trivial project needs facility to automate builds –Routine common tasks that need to be carried out several times a.

Similar presentations


Presentation on theme: "1 Rake. 2 Automated Build Any non-trivial project needs facility to automate builds –Routine common tasks that need to be carried out several times a."— Presentation transcript:

1 1 Rake

2 2 Automated Build Any non-trivial project needs facility to automate builds –Routine common tasks that need to be carried out several times a day Not very efficient to do manually and also error prone Rake is the make utility for Rails

3 3 What does a make file have? Typically a make file has –Commands or tasks –Dependency between the tasks –A way to specify which tasks to execute (selectively or all) –Tasks only execute if necessary

4 4 make vs. ant Even though similar quite some differences ant is task based –You specify tasks and instructions to execute make allows file type based specification –You can say that a type of file needs to be built based on another type of file –make will check for timestamp of these files and decide if it should be built

5 5 What’s special about Rake? Ant for Java (NAnt for.NET) uses xml Jim Weirich’s Rake uses ruby! Makes it easier to write – you are not switching languages – feels natural If you know Ruby, you simply read it and you get it! Rake is a internal Domain Specific Language which uses the Ruby syntax Rake is very easy to extend – write Ruby code

6 6 Let’s Give It a Try

7 7 Rake Conventions Rake uses rakefile.rb by default when you type rake => is used for dependency/pre-requisites :default is the task that will be executed, err, by default

8 8 Rake Dry Run Allows you to see what Rake will do -- trace option will trace the task calls as it executes

9 9 Rake prerequisites You can find what the pre-requisite for tasks are using the -P option

10 10 Task and description You can write a description for task and check those out using –T option

11 11 Prerequisite Specification You can specify when you define a task You can also specify separately

12 12 file tasks In addition to tasks like we saw so far, you can define file tasks File tasks (like good old make) specify the input output file and pre-requisite input file Checks time stamp of output file and if it is earlier than input file, task is executed

13 13 Using file

14 14 Rake and Rails Rails make great use of Rake Allows you to run different tasks –Tests –Cloning database –… One way to learn rake is to study the rake files in Rails


Download ppt "1 Rake. 2 Automated Build Any non-trivial project needs facility to automate builds –Routine common tasks that need to be carried out several times a."

Similar presentations


Ads by Google