clean up a little more stuff

This commit is contained in:
John Bintz 2012-03-21 19:57:30 -04:00
parent 1b1c160639
commit 04854f42e4
3 changed files with 5 additions and 46 deletions

View File

@ -1,5 +1,4 @@
require 'sinatra' require 'sinatra'
require 'json'
require 'cgi' require 'cgi'
module Flowerbox module Flowerbox
@ -8,55 +7,12 @@ module Flowerbox
attr_accessor :runner, :sprockets attr_accessor :runner, :sprockets
end end
def runner
self.class.runner
end
def sprockets def sprockets
self.class.sprockets self.class.sprockets
end end
def data def runner
JSON.parse(request.body.string) self.class.runner
end
def self.command(*args, &block)
url, args = args
url = "/#{url}"
post(url, *args) do
instance_eval(&block)
""
end
end
command :results do
runner.finish!(data.flatten.first)
end
command :start_test do
runner.add_tests(data.flatten)
end
command :finish_test do
runner.add_results(data.flatten)
end
command :log do
runner.log(data.first)
end
command :ping do
end
command :pause_timer do
end
command :unpause_timer do
end
command :starting do
end end
get %r{^/__F__/(.*)$} do |file| get %r{^/__F__/(.*)$} do |file|

View File

@ -59,6 +59,8 @@ module Flowerbox
attempts = 3 attempts = 3
require 'flowerbox/server'
while true while true
begin begin
server.start server.start

View File

@ -4,6 +4,7 @@ require 'socket'
require 'rack/builder' require 'rack/builder'
require 'thin' require 'thin'
require 'em-websocket' require 'em-websocket'
require 'json'
module Flowerbox module Flowerbox
class Server class Server