How do I execute Rake tasks with arguments multiple times?

前端 未结 4 1236
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-19 04:39

It\'s not possible to invoke the same rake task from within a loop more than once. But, I want to be able to call rake first and loop through an array

4条回答
  •  既然无缘
    2021-02-19 05:11

    This worked for me, it's quite easy to understand you just need to loop you bash command.

    task :taskname, [:loop] do |t, args|
            $i = 0
            $num = args.loop.to_i
            while $i < $num  do
            sh 'your bash command''
            $i +=1
            end
        end
    

提交回复
热议问题