# File lib/mongrel_config/app.rb, line 155 155: def _pid 156: open($PID_FILE) {|f| f.read } if _running? 157: end
# File lib/mongrel_config/app.rb, line 151 151: def _running? 152: File.exist? $PID_FILE 153: end
# File lib/mongrel_config/win32_app.rb, line 237 237: def _running_procs 238: running = [] 239: W32Support.list.each {|s| running << s.service_name if s.current_state =~ /running/} 240: running 241: end
# File lib/mongrel_config/win32_app.rb, line 175 175: def info 176: div :id=>"viewport" do 177: @services.each do |s| 178: 179: h2 { "#{s.service_name} service information" } 180: table do 181: tr { th {"Attribute"}; th {"Value"} } 182: 183: s.each_pair do |memb,obj| 184: name = memb.to_s.tr("_"," ").capitalize 185: tr { 186: td { b { "#{name}: " } } 187: td { obj.inspect } 188: } 189: end 190: end 191: end 192: end 193: end
# File lib/mongrel_config/win32_app.rb, line 206 206: def install_form 207: div do 208: h2 { "Install New Mongrel Service" } 209: p { "Items with an * are mandatory. Leave an item blank to not specify it." } 210: form :action=>"/install", :method=>"POST" do 211: b { "* Service Name: "}; input :name => "service_name"; br 212: b { "* Root: "}; input :name => "root"; br 213: b { "* Environment: "}; input :name => "environment", :value => "development"; br 214: b { "*Address: "}; input :name => "address", :value => "0.0.0.0"; br 215: b { "*Port: "}; input :name => "port", :value => "4000", :size => 6; br 216: b { "Display Name: "}; input :name => "display_name"; br 217: b { "MIME Map File: "}; input :name => "mime"; br 218: b { "Number Processor Threads: "}; input :name => "num_procs", :size => 3; br 219: b { "Request Timeout: "}; input :name => "timeout", :size => 3; br 220: b { "Assigned CPU: " }; input :name => "cpu", :size => 2; br 221: 222: p { input :type=>"submit", :value => "INSTALL" } 223: end 224: end 225: end
# File lib/mongrel_config/win32_app.rb, line 228 228: def install_result 229: div :id=>"viewport" do 230: h2 { "Install Results"} 231: pre do 232: self << @result 233: end 234: end 235: end
# File lib/mongrel_config/app.rb, line 103 103: def kill 104: div do 105: p { @results } 106: 107: case @signal 108: when "HUP": 109: p { "A reload (HUP) does not stop the process, but may not be complete." } 110: when "TERM": 111: p { "Stopped with TERM signal. The process should exit shortly, but only after processing pending requests." } 112: when "USR2": 113: p { "Complete restart (USR2) may take a little while. Check status in a few seconds or read logs." } 114: when "KILL": 115: p { "Process was violently stopped (KILL) so pending requests will be lost." } 116: end 117: end 118: end
# File lib/mongrel_config/app.rb, line 65 65: def layout 66: body_content = yield 67: currently_running = _running? 68: pid = _pid 69: open(GemPlugin::Manager.instance.resource("mongrel_config", "/index.html")) do |f| 70: template = ERB.new(f.read) 71: template.result(binding) 72: end 73: end
# File lib/mongrel_config/win32_app.rb, line 130 130: def layout 131: links = [ 132: ["/config", "Status"], 133: ["/config/install", "Install"], 134: ["/config/logs", "Logs"] 135: ] 136: body_content = yield 137: currently_running = _running_procs 138: 139: open(GemPlugin::Manager.instance.resource("mongrel_config", "/index_win32.html")) do |f| 140: template = ERB.new(f.read) 141: self << template.result(binding) 142: end 143: end
# File lib/mongrel_config/win32_app.rb, line 146 146: def list 147: div :id=>"viewport" do 148: table do 149: tr { th { "Service"}; th { "Status"}; th { "Control" }; th { "Delete" } } 150: @services.each do |s| 151: status = W32Support.status(s.service_name) 152: tr { 153: td { a(s.service_name, :href => "/info/#{s.service_name}") } 154: td { status.capitalize } 155: td { 156: if status =~ /stopped/ 157: a("start",:href => "/start/#{s.service_name}") 158: elsif status =~ /running/ 159: a("stop",:href => "/stop/#{s.service_name}") 160: else 161: b { "in progress" } 162: end 163: } 164: td { 165: a("delete!",:href => "/delete/#{s.service_name}", 166: :onclick=>"return confirm('Delete #{s.service_name}?') == '1'") 167: } 168: } 169: end 170: end 171: end 172: end
# File lib/mongrel_config/app.rb, line 133 133: def logs 134: div do 135: h2 { "Logs" } 136: table do 137: tr do 138: th { "File"}; th { "Bytes" }; th { "Last Modified" } 139: end 140: @log_files.each do |file| 141: tr do 142: td { a file, :href => "../#{file}" } 143: td { File.size file } 144: td { File.mtime file } 145: end 146: end 147: end 148: end 149: end
# File lib/mongrel_config/win32_app.rb, line 195 195: def service_logs 196: h2 { "Latest Service Activity Logs" } 197: a("[clear logs]", :href => "/clear_logs") 198: 199: div :id=>"viewport" do 200: pre :style=>"font-size: 10pt;" do 201: self << $service_logs 202: end 203: end 204: end
# File lib/mongrel_config/app.rb, line 75 75: def show 76: div do 77: h2 { "Status" } 78: if _running? 79: p { "Currently running with PID #{_pid}." } 80: else 81: p { "Mongrel is not running." } 82: end 83: end 84: end
# File lib/mongrel_config/app.rb, line 86 86: def start 87: div do 88: form :action => "/start", :method => "POST" do 89: p { span { "Port:" }; input :name => "port", :value => "4000" } 90: p { span { "Environment:" }; input :name => "env", :value => "development" } 91: p { span { "Address:" }; input :name => "address", :value => "0.0.0.0" } 92: input :type => "submit", :value => "START" 93: end 94: end 95: end
# File lib/mongrel_config/app.rb, line 97 97: def start_done 98: div do 99: p { @results } 100: end 101: end
# File lib/mongrel_config/app.rb, line 120 120: def stop 121: if _running? 122: ul do 123: li { a "Stop (TERM)", :href => "/kill/term" } 124: li { a "Reload (HUP)", :href => "/kill/hup" } 125: li { a "Restart (USR2)", :href => "/kill/usr2" } 126: li { a "Kill (KILL)", :href => "/kill/kill" } 127: end 128: else 129: p { "Mongrel does not appear to be running (no PID file at #$PID_FILE)." } 130: end 131: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.