What is the new format for rake tasks? (task :t, arg, :needs => [deps] versus task :t, [args] => [deps])

前端 未结 2 1398
名媛妹妹
名媛妹妹 2021-02-12 14:31

I\'m using Rails 3.1 beta with Ruby 1.9.2 and rake 0.9.2, and have a bunch of rake tasks I\'ve written. Here is an example:

namespace :data do
  desc \"dump the          


        
2条回答
  •  梦谈多话
    2021-02-12 14:59

    The usage which works for me is:

    task :task_name, [:argument] => :environment
    

    I guess if you had several dependencies to list, deps would need the array notation.

    I've no idea why a single argument requires the array notation - running the rake task with --trace gives an error about the :argument symbol not responding to the empty? method.

提交回复
热议问题