I thought this is a question better directed at the source instead of 
ruby-talk :).
Now, I have a script that generates HTML from XML for part of a site.
I use tasks to get the files from the source control repository, copy 
them to a directory that mirrors the structure of the actual site and 
then I scp the files over.

Now, I'm using the following code to find the files to copy:

#a file task for each target file
def to_target src,target_dir,trim=nil
        tgt=File.join(target_dir,src)
        tgt=File.join(target_dir,src.sub(trim,"")) if trim
        file tgt=>[src] do
                mkdir_p(File.dirname(tgt))
                cp(src,tgt) unless File.directory?(src)
        end
        return tgt
end

#lots of file tasks as prerequisites to :copy_generated
def create_list
        sitelist=FileList["/publish/generated/**/*"]
        sitelist.each{|src|
                        targeted=to_target(src,PUBLISH,/htdocs\//)
                        task :copy_generated=>[targeted]
                        @changed_files<<targeted if             
Rake::Task.lookup(targeted).needed?
        }
end

task :generate do
        #generate lots of files in /publish/generated/
end

task :post_generate=>[:generate] do
        create_list
end

task :copy_generated=>[:post_generate]

Now, the problem is that :copy_generated does not cause the file tasks 
added as requisites in :post_generate to be executed although the 
Task#lookup(..).needed? call returns true and gives me the proper task 
name.
This at the moment forces me to generate that part of the site 
everytime. The other workaround I have is rewrite the generator to use 
Rake filetasks, but that is not done in 10 minutes.

Obviously at the moment :copy_generated is called the prerequisites are 
evaluated and when we come back from any other tasks it is assumed that 
prerequisites have not changed.
Is this a reasonable feature request (re-evaluating the list of 
prerequisites when all prerequisite tasks are done)? Do I miss something?
Cheers,
V.-
-- 
http://www.braveworld.net/riva

____________________________________________________________________
http://www.freemail.gr - äùñåÜí õðçñåóßá çëåêôñïíéêïý ôá÷õäñïìåßïõ.
http://www.freemail.gr - free email service for the Greek-speaking.
_______________________________________________
Rake-devel mailing list
[EMAIL PROTECTED]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to