I need to
- run ant remotelly
- create/modify xml files for ant
- pass back results from ant's execution
so I thought I am going to write a web/application server in ruby. But I do not know where to start.
The computer that will run ant is Win XP SP3 and there is no web server or anything else running.
I found this code but not sure which part to modify so I does what I want. Let's say I want to run "dir" command and send back to the browser result of that command.
require 'socket'
webserver = TCPServer.new('127.0.0.1', 7125)
while (session = webserver.accept)
session.print "HTTP/1.1 200/OK\r\nContent-type:text/html\r\n\r\n"
request = session.gets
trimmedrequest = request.gsub(/GET\ \//, '').gsub(/\ HTTP.*/, '')
filename = trimmedrequest.chomp
if filename == ""
filename = "index.html"
end
begin
displayfile = File.open(filename, 'r')
content = displayfile.read()
session.print content
rescue Errno::ENOENT
session.print "File not found"
end
session.close
end