im trying to run a task 10 times in jake:
task 'default', (page) ->
page = process.env.page
running = 0
while running < 10
ex = jake.createExec(["casperjs test.coffee --page=#{page}"],
printStdout: true
)
ex.run()
running++
page++
this will run the test 10 times. which is deos fine. however i want it to run in order, so for instance page1 first, then page2, then page3 etc. so first page 1 has to finish before it deos page2. at the momment it runs them in parallel, or asynchronously. thanks for your help.
I use the Async library for this kind of thing. Something like:
async = require 'async'
pages = for i in [0...10]
do ->
j = i
->
ex = jake.createExec ["casperjs test.coffee --page=#{j}"],
printStdout: true
ex.run()
async.series pages
I wonder a bit, though, why you need them to run serially.