Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Rake: Looking for shortcut to file targets list from within a rakefile

Thread Tools

Rake: Looking for shortcut to file targets list from within a rakefile

Posts: n/a
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_METHO D)" 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_ancest ors(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_ancest ors(f3))
# adds f3, f2, f1 only

# 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.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
rakefile help: rakefile calling a rakefile? John Gabriele Ruby 1 12-05-2006 08:04 PM
Presenting a fully automated DVD authoring rakefile Bira Ruby 1 10-13-2006 02:01 PM
Shortcut, And Re-Directing Of Shortcut Quest. ? Robert11 Computer Support 1 12-30-2004 03:13 PM
Don't know how to rake Rakefile T. Onoma Ruby 8 08-23-2004 04:30 PM
Rakefile under Cygwin: permission denied Jim Menard Ruby 6 06-14-2004 05:18 PM