#!/usr/bin/env ruby require 'sbpanel' require 'sinatra' require 'optparse' options = { bind: "0.0.0.0", port: 8000, } OptionParser.new do |opts| opts.banner = "Usage: sbpanel [options] STARBOUND_LOG_PATH" opts.on("-v" end set :port, 8000 set :bind, "0.0.0.0" set :root, File.join(File.dirname(__FILE__), '..') panel = SBPanel::Game.load(ARGV[0]) Thread.new do begin panel.read_logs rescue Exception => e puts e.message puts e.backtrace.join("\n") end end helpers ActionView::Helpers::DateHelper get '/' do panel.update_status panel.instance_variables.each do |var| instance_variable_set var, panel.instance_variable_get(var) end erb :index end