Is there a “method_missing” for rake tasks?

后端 未结 1 1438
暗喜
暗喜 2021-02-20 02:15

If my Rakefile does not find a task with a particular name, I\'d like rake to instead create a new task by that name according to certain rules, if a file with the

相关标签:
1条回答
  • 2021-02-20 02:43

    I haven't tried it, but a quick search revealed this.

    If you define a rule with an empty string, you can catch any task that hasn’t been defined elsewhere. This makes it easy to dynamically create rake tasks. Essentially, this is method_missing for rake!

    rule "" do |t|
      t.name 
      # ... do something with the name of the task  
    end
    
    0 讨论(0)
提交回复
热议问题