Mohit Sindhwani wrote:
> I was thinking of this on my way home, but could not come up with a good 
> answer... what is the extra bit that Rake gives me, which I don't get 
> from a Ruby script?
> I'm sorry it's a bit of a naive question, but I was wondering when would 
> it be more appropriate to use Rake compared to vanilla Ruby!


Off the top of my head:

* Dependency chain management
* Ability to re-use other people's *.rake files
* Handy means to get a list of commands


That last one is quite useful.   I have a habit of knocking out helper 
scripts for little project tasks, and I end up with a set files whose 
actual purpose or behavior is not entirely clear.   If I move the code 
into Rake tasks with a decent namespace then I can more easily see what 
helper code I have by running rake -T |  grep my-cool-namespace

And I have a global helper script, rt, that calls rake -T and if you 
pass an argument it will grep the output to filter the results:

   $ rt  # Same as rake -T
   $ rt jimbo # Same as rake -T | grep jimbo


Since your rake files can have plain old Ruby methods in them there's 
nothing you can do in vanilla Ruby you can't do in Rake, though calling 
Rake can have some start-up overhead. Oh, and passing command-line 
arguments in Rake sucks ass.  So there are trade-offs.



-- 
James Britt

www.jamesbritt.com           - Playing with Better Toys
www.ruby-doc.org             - Ruby Help & Documentation
www.rubystuff.com            - The Ruby Store for Ruby Stuff
www.neurogami.com            - Smart application development