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|
      rm_f f
    end
  end
end


And now the clean_tmp task will always execute in the /tmp directory.

-Matt

Attachment: dirspace.rb
Description: application/ruby

_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to