[Rake-devel] Question about namespace

Jim Weirich jim at weirichhouse.org
Mon Dec 25 20:50:17 EST 2006

Leon Yeh wrote:
 > After Rails Edge event attending rake tutorial by Jim Weitich, I got
 > fired up to move all of my bash based cron script ( backup, database
 > cleanup, etc ) into rake, so I can chain more tasks together, and create
 > file dependencies between tasks.
 > Everythings looks good and appear to be working, however I found
 > that the namespace does not applied to the function. So when a func1
 > get called, it was executed at both place.

Really? I would have expected the last definition to override any

 > Can someone let me know on how to make the function is part of the
 > namespace and will not "collide" or get called twice ? I have not
 > checked if capistrano is the place to do this or I am just mis-using
 > rake.

Rake namespaces only control the names for non-file tasks (file tasks
are named for the file they represent and so namespaces make no sense
for file tasks). Function names do not participate in Rake task
namespaces, but can easily be placed in a module, which is the Ruby
provided mechanism for managing that.

-- Jim Weirich      jim at weirichhouse.org     http://onestepback.org
-- In theory, practice and theory are the same.
-- In practice, they are different.

More information about the Rake-devel mailing list