[Rake-devel] Setting a task's working directory on task definition
mjcurry at gmail.com
Thu Jul 17 12:09:45 EDT 2008
Hello rake devs:
I wrote some code (as a redefinition of Rake classes) to support a new
function called dirspace. Give dirspace a directory and a block as
arguments, and each rake task defined until the end of the block will
invoke and/or execute itself within that directory.
I wrote it because I was including several .rake files into one large
Rakefile at the top of my project, but still wanted the tasks defined
within each .rake to be 'anchored' at that file's directory. Useless
for Rails people I suppose, but more helpful as a general Make
replacement as a way around respawning rake for each directory.
Obviously the code needs some cleaning up, but any comments are welcome.
Use similar to a namespace:
dirspace "/tmp" do
task :clean_tmp do
Dir.glob('*').each do |f|
And now the clean_tmp task will always execute in the /tmp directory.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1535 bytes
Desc: not available
More information about the Rake-devel