[Rake-devel] Question about namespace

Leon Yeh leon at newavenue.net
Mon Dec 25 23:48:30 EST 2006

Thanks Jim, by putting the function into the module fixed my problem.

Leon Yeh
New Avenue Systems Inc.
Imagination Delivered. www.newavenue.net

Jim Weirich wrote:
> 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
> previous.
>  > 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.

More information about the Rake-devel mailing list