buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Assaf Arkin" <ar...@intalio.com>
Subject Re: question about recursive_task
Date Thu, 31 Jul 2008 18:41:53 GMT
On Thu, Jul 31, 2008 at 11:27 AM, Ittay Dror <ittay.dror@gmail.com> wrote:
>
>
> Assaf Arkin wrote:
>>
>> On Thu, Jul 31, 2008 at 1:37 AM, Ittay Dror <ittay.dror@gmail.com> wrote:
>>
>>>
>>> Hi,
>>>
>>> Looking at the code of 'recursive_task', it has this code:
>>> 'parent.task(task_name).enhance [task] if parent'.
>>>
>>> This seems to mean to me that when the parent task is invoked, it will
>>> invoke this task, not that when this task is invoked, it will invoke all
>>> children.
>>>
>>
>> recursive_task doesn't really do anything interesting, it doesn't hide
>> a complex algorithm, or abstract something that could change over
>> time.  Its sole purpose to help identify, when working with the source
>> code, which tasks are recursive.  The compile task is recursive,
>> invoking the compile task will invoke all its children, recursively.
>>
>
> But doesn't the code just create a task in the *parent* and make it
> dependent on the current task? So now the parent has a task that depends on
> a task in the current project.
>
> If the method is called for all projects (as in an extension) then it
> creates the right behavior.  But I think that called on a single project it
> will not. Am I wrong?

You're right about that part.  What it captures is the semantics of
"compile", the general compile, being a recursive task, a task which
exists in every project.  If you want to say
"foo:compile"=>"foo:bar:compile", specifically wiring two tasks
together, Rake's enhance method already takes care of that.

Assaf

>
> I tried this, and it seems that it doesn't create nor call any children if
> defined once.
>
> Ittay
>>
>> Assaf
>>
>>
>>>
>>> Putting it in other words, if I want to use an extension in the form:
>>>
>>> define 'foo' do
>>>  extend MyExtension
>>>
>>>  define 'bar' do  ...
>>>  end
>>> end
>>>
>>> (That is, it is called only in one project)
>>>
>>> Then if I call foo:my_recursive_task, will it call foo:bar:my_recursive
>>> task?
>>>
>>> Thanks,
>>> Ittay
>>>
>>>
>>> --
>>> --
>>> Ittay Dror <ittay.dror@gmail.com>
>>>
>>>
>>>
>>>
>
> --
> --
> Ittay Dror <ittay.dror@gmail.com>
>
>

Mime
View raw message