How do I return early from a rake task?

后端 未结 7 1441
一向
一向 2020-12-07 11:13

I have a rake task where I do some checks at the beginning, if one of the checks fails I would like to return early from the rake task, I don\'t want to execute any of the r

相关标签:
7条回答
  • 2020-12-07 11:49

    I tend to use abort which is a better alternative in such situations, for example:

    task :foo do
      something = false
      abort 'Failed to proceed' unless something
    end
    
    0 讨论(0)
提交回复
热议问题