# File lib/mongrel_config/app.rb, line 155 def _pid open($PID_FILE) {|f| f.read } if _running? end
# File lib/mongrel_config/app.rb, line 151 def _running? File.exist? $PID_FILE end
# File lib/mongrel_config/win32_app.rb, line 237 def _running_procs running = [] W32Support.list.each {|s| running << s.service_name if s.current_state =~ /running/} running end
# File lib/mongrel_config/win32_app.rb, line 175 def info div :id=>"viewport" do @services.each do |s| h2 { "#{s.service_name} service information" } table do tr { th {"Attribute"}; th {"Value"} } s.each_pair do |memb,obj| name = memb.to_s.tr("_"," ").capitalize tr { td { b { "#{name}: " } } td { obj.inspect } } end end end end end
# File lib/mongrel_config/win32_app.rb, line 206 def install_form div do h2 { "Install New Mongrel Service" } p { "Items with an * are mandatory. Leave an item blank to not specify it." } form :action=>"/install", :method=>"POST" do b { "* Service Name: "}; input :name => "service_name"; br b { "* Root: "}; input :name => "root"; br b { "* Environment: "}; input :name => "environment", :value => "development"; br b { "*Address: "}; input :name => "address", :value => "0.0.0.0"; br b { "*Port: "}; input :name => "port", :value => "4000", :size => 6; br b { "Display Name: "}; input :name => "display_name"; br b { "MIME Map File: "}; input :name => "mime"; br b { "Number Processor Threads: "}; input :name => "num_procs", :size => 3; br b { "Request Timeout: "}; input :name => "timeout", :size => 3; br b { "Assigned CPU: " }; input :name => "cpu", :size => 2; br p { input :type=>"submit", :value => "INSTALL" } end end end
# File lib/mongrel_config/win32_app.rb, line 228 def install_result div :id=>"viewport" do h2 { "Install Results"} pre do self << @result end end end
# File lib/mongrel_config/app.rb, line 103 def kill div do p { @results } case @signal when "HUP": p { "A reload (HUP) does not stop the process, but may not be complete." } when "TERM": p { "Stopped with TERM signal. The process should exit shortly, but only after processing pending requests." } when "USR2": p { "Complete restart (USR2) may take a little while. Check status in a few seconds or read logs." } when "KILL": p { "Process was violently stopped (KILL) so pending requests will be lost." } end end end
# File lib/mongrel_config/win32_app.rb, line 130 def layout links = [ ["/config", "Status"], ["/config/install", "Install"], ["/config/logs", "Logs"] ] body_content = yield currently_running = _running_procs open(GemPlugin::Manager.instance.resource("mongrel_config", "/index_win32.html")) do |f| template = ERB.new(f.read) self << template.result(binding) end end
# File lib/mongrel_config/win32_app.rb, line 146 def list div :id=>"viewport" do table do tr { th { "Service"}; th { "Status"}; th { "Control" }; th { "Delete" } } @services.each do |s| status = W32Support.status(s.service_name) tr { td { a(s.service_name, :href => "/info/#{s.service_name}") } td { status.capitalize } td { if status =~ /stopped/ a("start",:href => "/start/#{s.service_name}") elsif status =~ /running/ a("stop",:href => "/stop/#{s.service_name}") else b { "in progress" } end } td { a("delete!",:href => "/delete/#{s.service_name}", :onclick=>"return confirm('Delete #{s.service_name}?') == '1'") } } end end end end
# File lib/mongrel_config/app.rb, line 133 def logs div do h2 { "Logs" } table do tr do th { "File"}; th { "Bytes" }; th { "Last Modified" } end @log_files.each do |file| tr do td { a file, :href => "../#{file}" } td { File.size file } td { File.mtime file } end end end end end
# File lib/mongrel_config/win32_app.rb, line 195 def service_logs h2 { "Latest Service Activity Logs" } a("[clear logs]", :href => "/clear_logs") div :id=>"viewport" do pre :style=>"font-size: 10pt;" do self << $service_logs end end end
# File lib/mongrel_config/app.rb, line 75 def show div do h2 { "Status" } if _running? p { "Currently running with PID #{_pid}." } else p { "Mongrel is not running." } end end end
# File lib/mongrel_config/app.rb, line 86 def start div do form :action => "/start", :method => "POST" do p { span { "Port:" }; input :name => "port", :value => "4000" } p { span { "Environment:" }; input :name => "env", :value => "development" } p { span { "Address:" }; input :name => "address", :value => "0.0.0.0" } input :type => "submit", :value => "START" end end end
# File lib/mongrel_config/app.rb, line 97 def start_done div do p { @results } end end
# File lib/mongrel_config/app.rb, line 120 def stop if _running? ul do li { a "Stop (TERM)", :href => "/kill/term" } li { a "Reload (HUP)", :href => "/kill/hup" } li { a "Restart (USR2)", :href => "/kill/usr2" } li { a "Kill (KILL)", :href => "/kill/kill" } end else p { "Mongrel does not appear to be running (no PID file at #$PID_FILE)." } end end
Generated with the Darkfish Rdoc Generator 2.