[Rake-devel] Multiple Rakefile build

Leon Yeh leon at newavenue.net
Fri Dec 2 17:53:37 EST 2005


Hi All, I have just started using Rake, I usually use ant, but got 
caught the Ruby fever :-)

I have been using RoR for web development and in need rake to do data 
migration. I wanted to build a hirarchical build system similar to 
Makefile. Example below


\database_migration
	Rakefile
	\task_migrate_empTable
		Rakefile
		drop_empTable.rb
		create_empTable.rb
		..
	\task_migrate_salesTable
		Rakefile
		drop_salesTable.rb
		create_salesTable.rb



What I want to do is that the top-level Rakefile go thru the folders and 
  invoke each of Rakefile. Below is my first rakefile, but it was not 
working. What is the correct way to do this ? Any help are greatly 
appreciated.

require 'rake'


desc "Migrate Employee Table"
task :employeeTbl do	
	cd "task_empTbl"	
	Rake.application.load_rakefile()
	Rake.application.run()
	cd "../"
end

task :default => [
	:distributorTbl,
	:employeeTbl
]


Thanks in advance
Leon Yeh


More information about the Rake-devel mailing list