@@ -32,21 +32,29 @@ def parse_options(argv=nil)
3232
3333 Usage:
3434 resque-pool [options]
35-
36- where [options] are:
3735 EOS
36+
37+ opt . separator ""
38+ opt . separator "Basic Options:"
3839 opt . on ( '-c' , '--config PATH' , "Alternate path to config file" ) { |c | opts [ :config ] = c }
39- opt . on ( '-a' , '--appname NAME' , "Alternate appname" ) { |c | opts [ :appname ] = c }
40+ opt . on ( '-a' , '--appname NAME' , "Alternate appname (default is directory name)" ) { |c | opts [ :appname ] = c }
41+ opt . on ( "-E" , '--environment ENVIRONMENT' , "Set RAILS_ENV/RACK_ENV/RESQUE_ENV" ) { |c | opts [ :environment ] = c }
42+
43+ opt . separator ""
44+ opt . separator "Logging options:"
45+ opt . on ( '-o' , '--stdout FILE' , "Redirect stdout to logfile" ) { |c | opts [ :stdout ] = c }
46+ opt . on ( '-e' , '--stderr FILE' , "Redirect stderr to logfile" ) { |c | opts [ :stderr ] = c }
47+ opt . on ( '--nosync' , "Don't sync logfiles on every write" ) { opts [ :nosync ] = true }
48+
49+ opt . separator ""
50+ opt . separator "Daemon options:"
4051 opt . on ( "-d" , '--daemon' , "Run as a background daemon" ) {
4152 opts [ :daemon ] = true
4253 opts [ :stdout ] ||= "log/resque-pool.stdout.log"
4354 opts [ :stderr ] ||= "log/resque-pool.stderr.log"
4455 opts [ :pidfile ] ||= "tmp/pids/resque-pool.pid" unless opts [ :no_pidfile ]
4556 }
4657 opt . on ( "-k" , '--kill-others' , "Shutdown any other Resque Pools on startup" ) { opts [ :killothers ] = true }
47- opt . on ( '-o' , '--stdout FILE' , "Redirect stdout to logfile" ) { |c | opts [ :stdout ] = c }
48- opt . on ( '-e' , '--stderr FILE' , "Redirect stderr to logfile" ) { |c | opts [ :stderr ] = c }
49- opt . on ( '--nosync' , "Don't sync logfiles on every write" ) { opts [ :nosync ] = true }
5058 opt . on ( "-p" , '--pidfile FILE' , "PID file location" ) { |c |
5159 opts [ :pidfile ] = c
5260 opts [ :no_pidfile ] = false
@@ -55,20 +63,28 @@ def parse_options(argv=nil)
5563 opts [ :pidfile ] = nil
5664 opts [ :no_pidfile ] = true
5765 }
58- opt . on ( '-l' , '--lock FILE' , "Open a shared lock on a file" ) { |c | opts [ :lock_file ] = c }
66+ opt . on ( '-l' , '--lock FILE' , "Open a shared lock on a file" ) { |c | opts [ :lock_file ] = c }
5967 opt . on ( "-H" , "--hot-swap" , "Set appropriate defaults to hot-swap a new pool for a running pool" ) { |c |
6068 opts [ :pidfile ] = nil
6169 opts [ :no_pidfile ] = true
6270 opts [ :lock_file ] ||= "tmp/resque-pool.lock"
6371 opts [ :killothers ] = true
6472 }
65- opt . on ( "-E" , '--environment ENVIRONMENT' , "Set RAILS_ENV/RACK_ENV/RESQUE_ENV" ) { |c | opts [ :environment ] = c }
66- opt . on ( "-s" , '--spawn-delay MS' , Integer , "Delay in milliseconds between spawning missing workers" ) { |c | opts [ :spawn_delay ] = c }
73+ opt . on ( '--single-process-group' , "Workers remain in the same process group as the master" ) { opts [ :single_process_group ] = true }
74+
75+ opt . separator ""
76+ opt . separator "Signal handling options:"
6777 opt . on ( '--term-graceful-wait' , "On TERM signal, wait for workers to shut down gracefully" ) { opts [ :term_graceful_wait ] = true }
6878 opt . on ( '--term-graceful' , "On TERM signal, shut down workers gracefully" ) { opts [ :term_graceful ] = true }
6979 opt . on ( '--term-immediate' , "On TERM signal, shut down workers immediately (default)" ) { opts [ :term_immediate ] = true }
70- opt . on ( '--single-process-group' , "Workers remain in the same process group as the master" ) { opts [ :single_process_group ] = true }
71- opt . on ( "-h" , "--help" , "Show this." ) { puts opt ; exit }
80+
81+ opt . separator ""
82+ opt . separator "Worker options:"
83+ opt . on ( "-s" , '--spawn-delay MS' , Integer , "Delay in milliseconds between spawning missing workers" ) { |c | opts [ :spawn_delay ] = c }
84+
85+ opt . separator ""
86+ opt . separator "Other options:"
87+ opt . on ( "-h" , "--help" , "Show this help text." ) { puts opt ; exit }
7288 opt . on ( "-v" , "--version" , "Show Version" ) { puts "resque-pool #{ VERSION } (c) nicholas a. evans" ; exit }
7389 end
7490 parser . parse! ( argv || parser . default_argv )
0 commit comments