From: "Jesús Fuertes" Date: 2012-04-12T05:52:26+09:00 Subject: Doubt about rake and task Hello, I'm checking some implemented code and I've seen something like that: ----------------------- RAKEFIKE --------------------------------- $:.unshift File.dirname(__FILE__)+"/rake" require 'rake' require 'rakeTest' task :default => [:Where, RakeTasks.create ] task :Where do puts "Welcome to the rakefile" end ------------------- TESTFILE ------------------------------------ module RakeTasks def self.create puts "--Execute task1" Task1.create puts "--Execute task2" Task2.create task :end =>[:die] end module Task1 def self.create puts "Hello World" task :die do puts "I want to die" end end end module Task2 def self.create puts "I'm growing" end end end --------------------------------------------------------------- The output for that is: c:\Programs\checkingRuby>rake (in c:/Programs/checkingRuby) --Execute task1 Hello World --Execute task2 I'm growing Welcome to the rakefile I want to die But with the same test file only modifying the Rakefile as follows: ----------------------- RAKEFIKE --------------------------------- $:.unshift File.dirname(__FILE__)+"/rake" require 'rake' require 'rakeTest' task :default => [:Where,RakeTasks.create,RakeTasks::Task1.create ] task :Where do puts "Welcome to the rakefile" end ------------------------------------------------------------------- The output is: c:\Programs\checkingRuby>rake (in c:/Programs/checkingRuby) --Execute task1 Hello World --Execute task2 I'm growing Hello World Welcome to the rakefile I want to die I want to die So, I don't understand how the calls are queued before being executed. In both cases it starts with the classes task1 and task2 but the task Where is executed always after the classes even though the call inside the hash is declared before, same case is happening with the execution of the task die although it is defined at the end of the hash. Could anybody explain me how ruby is queuing or organizing the tasks or just attach a reference to be reviewed? The only documentation I found didn't take into account nested tasks execution. Thanks a lot! -- Posted via http://www.ruby-forum.com/.