From: mikshir Date: 2006-09-09T02:00:14+09:00 Subject: Rake: Looking for shortcut to file targets list from within a rakefile I have several projects that are growing and I'm using rake to manage the builds. These are NOT C builds and I cannot use patterns or globs or suffixes to reliably collect all of the built files and intermediates. So right now, for every file target that I specify I have to manually add it to the CLOBBER list if I hope to completely clean out the build to pristine condition. I'm looking for a shortcut to all file targets from within a rakefile. It has to be in there somewhere but looking through the rdoc, it doesn't seem to be exposed. I guess it's akin to using the results of "rake -T" but from within the rakefile and keeping only targets of type "file". That way I can simply do a "CLOBBER.include(ALL_FILE_TARGETS_ARY_OR_METHOD)" at the end of the rakefile and be done with it and not have to remember to push every file target on the clobber list. Secondary hope: Sometimes I don't want to do a complete clean/clobber and I'd like to prune all file targets that are in the dependency "ancestor" tree of a specific target. short example: # rakefile file f1 => [f_source1]do ... end file f2 => [f1,f_source2] do ... end file f3 => [f2] do ... end file g1 do ... end file g2 => [g1,g_source1] do ... end file g3 => [g2] do ... end CLOBBER.include(meth_that_returns_file_task_ancestors(g3)) # will clobber g3, g2, g1 but not any of the f's and not g_source1 since it's a dependency but not a file target task :clean_f_also CLOBBER.include(meth_that_returns_file_task_ancestors(f3)) # adds f3, f2, f1 only end # end rakefile then from shell #removes only g items > rake clobber # removes both f and g items > rake clean_f_also clobber I know this example hardly motivates the desire but for a large growing build where I can't rely on globs or suffixes, such a shortcut would be a godsend. SCons has some functionality like this but I wish to use Rake.