require 'rubygems' require 'sinatra/base' require 'json' require 'coffee-script' require 'slim' require 'sass' module Miranda class CoffeeEngine < Sinatra::Base set :views, File.dirname(__FILE__) + '/public/coffeescript' get "/javascripts/*.js" do filename = params[:splat].first coffee filename.to_sym end end class SassEngine < Sinatra::Base set :views, File.dirname(__FILE__) + '/public/sass' get '/sass/*.css' do filename = params[:splat].first sass filename.to_sym end end class System < Sinatra::Base use CoffeeEngine use SassEngine enable :sessions set :dump_errors, false set :views, Proc.new { File.join(root, "views") } get '/' do slim :index end get '/users' do @users = Users.new $return_users = @users.parse content_type :json $return_users.to_json end get '/disk' do @disk = Disk.new content_type :json @disk.parse.to_json end get '/applications' do @applications = Application.new content_type :json @applications.parse.to_json end get '/ps' do @ps = Ps_Aux.new content_type :json @ps.parse.to_json end get '/cpu' do @cpu = Cpu.new content_type :json @cpu.parse.to_json end get '/os' do @os = Os.new content_type :json @os.parse.to_json end end end