8 cattr_accessor :running
12 tail_thread = tail(Options.log_file)
13 Rack::Handler::Mongrel.run(Dispatcher.new, :Port => Options.port) do |server|
14 puts "== Sinatra has taken the stage on port #{server.port}!"
17 self.class.running = false
18 puts "\n== Sinatra has ended his set (crowd applauds)"
21 self.class.running = true
22 rescue Errno::EADDRINUSE => e
23 puts "== Someone is already performing on port #{Options.port}!"
28 tail_thread.kill if tail_thread
35 FileUtils.touch(log_file)
36 cursor = File.size(log_file)
37 last_checked = Time.now
38 tail_thread = Thread.new do
39 File.open(log_file, 'r') do |f|
42 if f.mtime > last_checked
43 last_checked = f.mtime
45 cursor += contents.length