Sha256: f4b79d9d7e3919ebfb755a7d6b5e3d0e1d9070428573fb3f60e68c0f2781087b
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
before do unless (GODWEB_CONFIG['username'].nil? && GODWEB_CONFIG['password'].nil?) || self.request.path_info == '/heartbeat' use Rack::Auth::Basic do |user, pass| [user, pass] == [GODWEB_CONFIG['username'], GODWEB_CONFIG['password']] end end GODWEB.ping end get '/' do @statuses = GODWEB.status @watches = [] @statuses.each do |watch, status| @watches << watch.to_s end @watches.sort! @groups = GODWEB.groups @host = `hostname` @footer = "GodWeb v0.2 - #{@host}" show(:status, @host) end get '/w/:watch' do @watch = params["watch"] @status = GODWEB.status[@watch][:state] @commands = GodWeb.possible_statuses(@status) @log = GODWEB.last_log(@watch) show(:watch, @watch) end get '/g/:group' do @watch = @group = params["group"] @status = nil @commands = GodWeb.possible_statuses(@status) show(:watch, "#{@group} [group]") end get '/w/:watch/:command' do @watch = params["watch"] @command = params["command"] @success = GODWEB.send(@command, @watch) @success = false if @success == [] @log = GODWEB.last_log(@watch) show(:command, "#{@command}ing #{@watch}") end get '/o' do @commands = %w{ quit restart } show(:watch, "god itself") end get '/i' do @text = `hostname` show(:icon) end get '/heartbeat' do @statuses = GODWEB.status 'OK' end private def show(template, title = 'GodWeb') @title = title erb(template) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nofxx-god_web-0.2.3 | lib/app.rb |