# Rake Task (or rule) dependency check tweaking

**URL:** <https://www.ruby-forum.com/t/rake-task-or-rule-dependency-check-tweaking/157822>\
**Category:** Ruby\
**Created:** [January 15, 2009, 5:39pm UTC](https://www.ruby-forum.com/t/rake-task-or-rule-dependency-check-tweaking/157822 "2009-01-15T17:39:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7993a0/32.png) [@peterk](https://www.ruby-forum.com/u/peterk)\
**Post date:** [January 15, 2009, 5:39pm UTC](https://www.ruby-forum.com/t/rake-task-or-rule-dependency-check-tweaking/157822/1 "2009-01-15T17:39:36Z")

</div>

Given there may be a complex task -  
ie: spawns a shell process running “make”, “vcbuild”, “ant” or  
whatever  
or invokes a large ruby subroutine

Given that the module is opaque to ruby and needs to be invoked to  
determine whether it does or does not need to rebuild it’s (file)  
target. How might one have the dependent task invoke this check in this  
ancestor during the traversing of the dependencies, and if the ancestor  
task decides it is “up to date” _not_ execute it’s block, triggering all  
it’s dependents to rebuild.

Something like overriding an “is\_up\_to\_date” method on a file task which  
is invoked during checking the graph of dependencies?

ie: inside ancestor

def is\_up\_to\_date  
sh “checkAndMaybeBuildIt …” # may or may not build it’s targets  
return(no\_targets\_updated)  
end

and if this task may or may not update multiple target files?

(should I get the Rake source code? How to get it? via Gems?)  
???

---

<div class="post-metadata">

**Author:** ![peterk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7993a0/32.png) [@peterk](https://www.ruby-forum.com/u/peterk)\
**Post date:** [January 16, 2009, 12:48am UTC](https://www.ruby-forum.com/t/rake-task-or-rule-dependency-check-tweaking/157822/2 "2009-01-16T00:48:38Z")

</div>

I got the source to Rake. Pardon the prior post 🙂

It seems what one does is to subclass a FileTask and overide the

needed? and timestamp methods

Source code is often the best doc 🙂

Peter Pk wrote:

> Given there may be a complex task -  
> ie: spawns a shell process running “make”, “vcbuild”, “ant” or  
> whatever  
> or invokes a large ruby subroutine
> 
> Given that the module is opaque to ruby and needs to be invoked to  
> determine whether it does or does not need to rebuild it’s (file)  
> target. How might one have the dependent task invoke this check in this  
> ancestor during the traversing of the dependencies, and if the ancestor  
> task decides it is “up to date” _not_ execute it’s block, triggering all  
> it’s dependents to rebuild.
> 
> Something like overriding an “is\_up\_to\_date” method on a file task which  
> is invoked during checking the graph of dependencies?
> 
> ie: inside ancestor
> 
> def is\_up\_to\_date  
> sh “checkAndMaybeBuildIt …” # may or may not build it’s targets  
> return(no\_targets\_updated)  
> end
> 
> and if this task may or may not update multiple target files?
> 
> (should I get the Rake source code? How to get it? via Gems?)  
> ???
