[Rake-devel] Tasks with arguments and dependencies - doc patch

Witold Rugowski rugowski at nhw.pl
Fri Oct 10 18:00:30 EDT 2008


Hi!
I was recently using tasks with arguments and have noticed issue with
docs. First, there is missing :needs key in example. Second - I'm using
rake 0.8.3 and enclosing arguments names into array in task definition
results with error when task is run (only when there is dependency on
this task).

In doc there is example:

task :name, [:first_name, :last_name] => [:pre_name] do |t, args|
     args.with_defaults(:first_name => "John", :last_name => "Dough")
     puts "First name is #{args.first_name}"
     puts "Last  name is #{args.last_name}"
   end

It is missng :needs key, but even with it rake name returns:
>rake name
(in E:/NB/devel/NetBeans)
rake aborted!
undefined method `to_sym' for [:first_name, :last_name]:Array
E:/NB/devel/NetBeans/rakefile:1
(See full trace by running task with --trace)

Changing task definition into
task :name, :first_name, :last_name, :needs => :pre_name do |t, args|
fixes problem.

I'm attaching patch to doc to make it clear and example rakefile which
render this error.

Best regards,

-- 
Witold Rugowski
Ruby on Rails freelancer
http://nhw.pl/wp/ (EN blog) http://nhw.pl/pl (PL blog)

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rakefile
URL: <http://rubyforge.org/pipermail/rake-devel/attachments/20081011/6e869295/attachment.pl>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: doc.patch
URL: <http://rubyforge.org/pipermail/rake-devel/attachments/20081011/6e869295/attachment-0001.pl>


More information about the Rake-devel mailing list