On Feb 18, 9:10=A0am, Tim Pease <tim.pe... / gmail.com> 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|
> > =A0 task :test =3D> [:build]
> > =A0 test.libs << 'ext'
> > =A0 test.warning =3D true
> > =A0 test.verbose =3D 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 =3D> [:clean]" at the bottom of the
> > test task doesn't work.
>
> > Regards,
>
> > Dan
>
> task :test do
> =A0 =A0Rake.application[:clean].execute
> end
>
> You can append as many blocks of code to a task as you want. The =A0
> blocks will be run in the order they were added. This block looks up =A0
> the "clean" task in the application and then invokes the execute method.

Thanks Tim, that will work.

Regards,

Dan