James Britt
1/15/2007 11:58:00 PM
Joel VanderWerf wrote:
>
> No idea. One possible solution is to put a "stub" rakefile in the dir,
> and the stub requires the main rakefile. Then (IIRC) the pwd during the
> rake tasks will be that of the stub. But maybe you don't want to scatter
> stubs all over the place.
Right, that's the whole point. For example, I have a Rake task that
will do an svn commit. I've also aliased rake to r , so I can do this
to commit code:
$ r com This is my log message
and the :com task knows how to grab the message, do the commit, and run
a few other things (like svn status to alert if I missed adding any new
files).
Very handy, except as at stands, the invoked rake file thinks everything
happens relative where it lives, so I have to create a Rakefile
everyplace I want to use a location-Dependant task.
(Someone else mentioned using a "rake2" delegate; since I'm already
using 'r' as my rake invocation, maybe having a real r.rb that stores
the calling directory in ENV might work. That rake tasks that need the
caller dir can look for the value in ENV; these tasks could then assume
a default dir if this environment variable is empty.)
--
James Britt
"I have the uncomfortable feeling that others are making a religion
out of it, as if the conceptual problems of programming could be
solved by a single trick, by a simple form of coding discipline!"
- Edsger Dijkstra