[Rake-devel] backwards dependency?
Jim Weirich
jim at weirichhouse.org
Sat Feb 10 14:40:26 EST 2007
TRANS wrote:
> I'm confused. I'm trying to alter the dependencies of a premade rake
> task, and while it accepts it, it's actully running the dependcy after
> the task rather than before it. With this:
>
> Rake::GemPackageTask.new(spec) do |pkg|
> ...
> end
>
> # Don't show the clobber task, just always clobber when
> # creating packages. Maybe in future ask to make sure.
> Rake::Task['clobber_package'].comment = nil
> Rake::Task['repackage'].comment = nil
> task :package => [:clobber_package]
>
> Shouldn't it invoke clobber_package BEFORE package? I ran it with --
> trace and it's clearly doing the opposite. What's up?
It does. But the package task body is entirely empty. So after it has
satisfied all of its other dependencies (which do the work of building
the packaages), then it invokes its last dependency (your
clobber_package). Finally it runs the body (which is empty).
The trick is to get clobber_package to be first in the list of package's
dependencies. Just move the task :package line to be before the
creation of the Rake::GemPackageTask.
--
-- Jim Weirich jim at weirichhouse.org http://onestepback.org
-- In theory, practice and theory are the same.
-- In practice, they are different.
More information about the Rake-devel
mailing list