From: Eric Armstrong Date: 2006-04-08T10:10:18+09:00 Subject: Re: Rake: Making "cleanup" task That's looking like a cool solution. What is that at_exit thing, btw? Is that a standard part of rake I should know about? Note: We've gotten as far as building Ruby on solaris, but seem to be missing the libraries. I'll looking to find a way to give the installation instructions back to the community, when I've finished figuring out the details. Since the libraries are missing, the rake install failed...but I look forward to getting the issues resolved soon. Rake is the reason I've begun taking a very serious look at Ruby. :_) Jim Weirich wrote: > Austin Ziegler wrote: >> On 4/7/06, Pistos Christou wrote: >>> Could you show some example code? I've never heard of this "END block" >>> thing. I thought __END__ in Perl made the interpreter stop and ignore >>> everything below that line. >> It does. >> >> However, that's not what Eric is talking about. >> >> He's talking about: >> >> END { >> # put your cleanup code here >> } >> > > The problem with this is that it will run every time, no matter what > tasks were invoked from the rake command line. It might work better to > do something like this: > > task :cleanup do > at_exit { > # cleanup code here > } > end > > task :main_task => [:other_prerequisites, :cleanup] do > # Task code that needs cleaning up > end > > -- > -- Jim Weirich >