[Rake-devel] Task#timestamp

Ittay Dror ittay.dror at gmail.com
Tue Nov 4 01:43:53 EST 2008

Jim Weirich wrote:

> On Nov 3, 2008, at 10:08 AM, Ittay Dror wrote:
>> Task#timestamp returns Time.now when there are no prerequisites. This 
>> means that regardless of whether it executed or not, it will trigger 
>> tasks that depend on it. Is this intentional?
> yes, and tasks (non-file tasks) are always executed.
Only if #needed? returns true. Rake::Task#needed? does indeed return 
true, but if I create my own task class which extends it, then I can 
override #needed? to return false sometimes. However, #timestamp will 
still return Time.now. Overriding #timestamp without duplicating the 
code that checks prerequisites is not trivial.

Also, I think there's a mismatch: given two Rake::Task objects: task1 
and task2, where task1 has a prerequisite on a file and task2 is empty, 
task1 will return the timestamp of the file while task2 will return 
Time.now, although both will always be executed.


Ittay Dror <ittay.dror at gmail.com>

More information about the Rake-devel mailing list