[Rake-devel] Suggestion: allow passing of extra command-lineargsto the task

Bennett, Patrick Patrick.Bennett at inin.com
Tue Jun 15 08:37:58 EDT 2004

> -----Original Message-----
> From: rake-devel-bounces at rubyforge.org [mailto:rake-devel-
> bounces at rubyforge.org] On Behalf Of Martin DeMello
> Sent: Tuesday, June 15, 2004 6:07 AM
> To: Rake Development and Discussion
> Subject: RE: [Rake-devel] Suggestion: allow passing of extra command-
> lineargsto the task
> --- "Bennett, Patrick" <Patrick.Bennett at inin.com> wrote:
> > Wouldn't it be better to define a syntax where arbitrary 'named'
> > arguments can be specified? (like make)
> > Something like:
> > rake clean html html_file=foo.html -dtest -dFOO
> I don't like globally naming arguments. How about
> rake clean html {file:foo.html template:in.html} test {dir:test1}

[Bennett, Patrick] It's certainly an interesting idea, but I really
don't see the real advantage to having per-task arguments.  The syntax
also ends up being pretty much unusable for most users.  Have you *ever*
seen any command-line driven program work this way?  It has to be kept

> > Rake would then expose all defined parameters to rakefiles as a
> > Any xxx=yyy command line argument would be assumbed to be a
> > parameter.  -d could be used as a shortcut way of saying xxxx=true,
> > to simply make it a bit clear (-d html_file=foo.html).
> I like the -d idea, but I see the conceptual difference as having
> args like that modify behaviour for all targets, whereas args bound to
> particular target modify just that target.

[Bennett, Patrick] Correct.  I don't see how there could ever be enough
options to a single (or recursive) rakefile that we would need to define
argument namespacing.  IMO, xxxx=yyy or -d xxxx=yyyy would be more than

> > After rake finishes the current file, it then walks through a queue
> > subdirectories (that is modified by subdirs).  It clears out all
> > objects, then looks for a rakefile in the next directory off the
> I remember reading some arguments against recursive makefiles, though
> admit I didn't understand them at the time. Anyone?

[Bennett, Patrick] I don't see how there could be an argument against
them.  I implemented them as explicit commands, so it's under complete
user control (which can still be turned off with a command-line flag).
I would only be opposed to it if it was an automatic behavior where rake
automatically descended all directories looking for rakefiles.  That
would be very, very, bad.  It (IMO) pretty much has to be a command
within rakefile's which the user uses to explicitly name subdirectories
to be checked.
I implemented mine as a simple queue of directories (with the first
rakefile found upon launch inserting itself at the head) that the main
rake execution code just uses to iteratively walk.  Between rakefiles it
clears all tasks then pulls the next directory off the queue.
I added extensions to allow certain tasks to hang around (for caches),
but that's a separate discussion.

More information about the Rake-devel mailing list