From: Daniel Berger Date: 2009-02-19T03:58:33+09:00 Subject: Re: Rake post test task On Feb 18, 9:10 am, Tim Pease wrote: > On Feb 18, 2009, at 8:15 AM, Daniel Berger wrote: > > > > > > > Hi, > > > How do I run a task after the fact with Rake? > > > For example, I have a test task for a C extension. It looks something > > like this: > > > Rake::TestTask.new('test') do |test| > >   task :test => [:build] > >   test.libs << 'ext' > >   test.warning = true > >   test.verbose = true > > end > > > That works fine, but I'd like it to run the "clean" task after it's > > finished. > > > And no, simply sticking "task :test => [:clean]" at the bottom of the > > test task doesn't work. > > > Regards, > > > Dan > > task :test do >    Rake.application[:clean].execute > end > > You can append as many blocks of code to a task as you want. The   > blocks will be run in the order they were added. This block looks up   > the "clean" task in the application and then invokes the execute method. Thanks Tim, that will work. Regards, Dan