Re: rake: undefined method `to_sym' for [:first_name, :last_name]:Array



This appears to be a 0.8.1 problem -- at least, it went away when I I
did a "gem update rake" (and was updated to 0.8.3).

--wpd




On Tue, Sep 30, 2008 at 9:17 AM, Patrick Doyle <wpdster@xxxxxxxxx> wrote:
When I run the example given in the rake documentation under "Tasks
that expect parameters", namely:

task :name, [:first_name, :last_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

I get the following error:

$ rake -f foo.rb
(in C:/home/wpd/ruby/gdsii)
rake aborted!
undefined method `to_sym' for [:first_name, :last_name]:Array
C:/home/wpd/ruby/gdsii/foo.rb:1
(See full trace by running task with --trace)

Any clues where to start to track this down? I am running rake
version 0.8.1 on top of Ruby 1.8.6 (on an XP platform, if that
matters).

Also, as long as I'm in the neighborhood, the documentation on
rake.rubyforge.org states:

"Tasks that use parameters have a slightly different format for
prerequisites. Use the :needs keyword to specify the prerequisites for
tasks with arguments. For example: " ... but the example that follows
doesn't show the use of the ":needs" keyword".

(This hasn't been an issue for me yet, but I happened to notice that
as I read the docs and wondered about it at the time.)

--wpd



.



Relevant Pages

  • Re: Rake dependencies unknown prior to running tasks
    ... portions were already built. ... need a build tool, such as Rake. ... puts "setup_a" ... puts "setup phase complete. ...
    (comp.lang.ruby)
  • Re: Problem with rake and dependencies
    ... it's probably time for me to start learning about rake". ... My rakefile does what I would like, ... importing/loading my dependency files correctly. ... #puts "source file: #" ...
    (comp.lang.ruby)
  • Re: Problem with rake and dependencies
    ... I am new to rake, and I am stuck on a problem with incremental building. ... My rakefile does what I would like, ... importing/loading my dependency files correctly. ... #puts "source file: #" ...
    (comp.lang.ruby)
  • rake: undefined method `to_sym for [:first_name, :last_name]:Array
    ... When I run the example given in the rake documentation under "Tasks ... puts "First name is #" ... Use the:needs keyword to specify the prerequisites for ...
    (comp.lang.ruby)
  • Re: raven, rake, ant and ruby
    ... I'm inclined to go with rake and ruby, but don't know how to get started ... What would be the first step in creating a rake compile task ... def Tasks.compile ...
    (comp.lang.ruby)