[Rake-devel] Rake DSL Commands are no long in top level

Jim Weirich jim.weirich at gmail.com
Thu Jun 4 17:10:52 EDT 2009

I've just pushed a new version of Rake to github under the branch  
'env'.  This version of rake has a number of changes from the latest  
released version, including better error reporting, Dave Thomas's  
"Ruby comments as Rake task comments" patch, task line number  
reporting and splitting the app out of the monolithic rake.rb file  
into one class per file.

However, the biggest change is that the Rake DSL methods (i.e. "task",  
"file", "dir", "import", etc) are no longer available at the top level  
scope of Ruby.  For one think, this means that we will no long  
conflict with JRuby's import statement.  Rakefiles (and .rake  
libraries) will be loaded in a special environment that enables the  
DSL methods, but regular Ruby code (in .rb files) will not.

This has the potential of breaking some rake libraries out there, so  
I'm leaving this change in the 'env' branch until I get more  
experience with it.  If you wish to check it out, please do so and  
report back there.

WIth this change, if you want to use the Rake DSL in regular Ruby  
code, you can:

(1) Include the module Rake::DSL into your class, or
(2) Run the code inside a Rake::DSL.environment do ... end block.


-- Jim Weirich
-- jim.weirich at gmail.com

More information about the Rake-devel mailing list