public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Colorize 'passenger-status' output for improved readability.
Hongli Lai (Phusion) (author)
Thu Jun 19 14:38:33 -0700 2008
commit  b3bf2bed39c229a297b51d97f3f9a393bea592d2
tree    ada5f8f4de28e8804bfe88d92ef8c42f6ee10568
parent  e6dbf9f1cdaa3567571d96010730900dbe62df97
...
20
21
22
 
 
 
 
 
 
23
24
25
...
60
61
62
63
 
 
 
 
 
64
65
66
...
20
21
22
23
24
25
26
27
28
29
30
31
...
66
67
68
 
69
70
71
72
73
74
75
76
0
@@ -20,6 +20,12 @@
0
 $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../lib")
0
 $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../ext")
0
 
0
+# ANSI color codes
0
+RESET = "\e[0m"
0
+BOLD = "\e[1m"
0
+YELLOW = "\e[33m"
0
+BLUE_BG = "\e[44m"
0
+
0
 class StatusFifo
0
   attr_accessor :filename
0
   attr_accessor :pid
0
@@ -60,7 +66,11 @@ end
0
 
0
 def show_status(status_fifo)
0
   begin
0
- puts File.read(status_fifo.filename)
0
+ text = File.read(status_fifo.filename)
0
+ # Colorize output
0
+ text.gsub!(/^(----)(.*)$/, YELLOW + BLUE_BG + BOLD + '\1\2' + RESET)
0
+ text.gsub!(/^( +in '.*? )(.*?)\(/, '\1' + BOLD + '\2' + RESET + '(')
0
+ puts text
0
   rescue => e
0
     STDERR.puts "*** ERROR: Cannot query status for Passenger instance #{status_fifo.pid}:"
0
     STDERR.puts e.to_s

Comments

    No one has commented yet.