I encoded a small web application that runs ant (batch file). Processing time for a batch file can take up to several minutes.
index.haml list all available ant files and run.haml launches them. The flow of how it works now is that when I click the link from index.haml, the ant script is launched, and after it finishes, the entire run.haml page is sent to the browser. So after clicking the link to index.haml, I still see index.haml and nothing from run.haml
After I click the link from index.haml , I want
- show that the script will be run and then
- run ant script and then
- display its results.
I recommended using my other question
I did not understand how a separate workflow can help me. Will the delayed work results captured by the ruby call to the browser after the task is completed?
I also did not understand how I can use Ajax in the sinatra.
Can someone please tell me what solution could be for this? Please note that I know a little ruby, learned a little about sinatra and hamla yesterday. There is nothing about Ajax :-) I will learn by examples ... and am happy to learn something.
index.haml gives me html like
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Available test suits</title>
</head>
<body>
<h1>Available test suits</h1>
<br/><br/>
<a href='run?run=login_build'>login_build</a>
<br />
<a href='run?run=login_cycle_build'>login_cycle_build</a>
<br />
<a href='run?run=login_cycle_academicyear_build'>login_cycle_academicyear_build</a>
</body>
</html>
run.haml looks like
!!!
%html
%head
%title Running
%body
= "Starting test suite: #{params['run']}"
- output = %x[cd C:\\Program Files\\TestPro\\TestPro Automation Framework410 && ant -lib lib -f "C:\\Program Files\\TestPro\\TestPro Automation Framework410\\Output Files\\builds\\#{params['run']}.xml"]
-
%br
= output.split("\n")[-2,2].join("<BR>")
= "<br/>"*2
%a(href="/")back to suits list
source
share