[Rake-devel] Task#prerequisites and Task#needed?
jim.weirich at gmail.com
Thu Oct 30 00:42:38 EDT 2008
On Oct 28, 2008, at 9:17 PM, James M. Lawrence wrote:
> When I saw commit 995b742d "fixed namespace task list bug" I was
> reminded of the problem I had in Drake where Task#prerequisites gave
> namespace-unqualified task names
> namespace :a do
> task :x
> task :y => :x
> task :default do
> p Rake::Task["a:y"].prerequisites #=> ["x"]
> # should be ["a:x"] ?
> Does this work as designed? I had initially conjectured that you
> wanted a task manager to have context-dependent behavior (where the
> "x" prereq can mean something different depending on the current
> namespace), but it doesn't look like Rake is designed this way.
Yes, this works as designed. The prerequisites are deliberately
stored as name references that are looked up in the tasks scope. It
is the lookup process that applies the namespace resolution, not the
Although your suggestions makes a lot of sense. I should reevaluate
> The other issue was that File#needed? does not look past its
> immediate prereqs.
Hmmm, interesting. I will confess that I'm not entirely sure why it
works that way, and yet it will correctly rebuild out of date files.
I'll take another look at this code when I'm not so tired and maybe
enlightenment will occur. (FYI, the needed? method was originally
within the first 1 hour of the creation of Rake)
-- Jim Weirich
-- jim.weirich at gmail.com
More information about the Rake-devel