bin/god in resurrected_god-0.14.0 vs bin/god in resurrected_god-1.0.0
- old
+ new
@@ -1,23 +1,23 @@
#!/usr/bin/env ruby
-STDOUT.sync = true
+$stdout.sync = true
-$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
require 'optparse'
require 'drb'
require 'yaml'
begin
# Save ARGV in case someone wants to use it later
ORIGINAL_ARGV = ARGV.dup
- options = {:daemonize => true, :port => 17165, :syslog => true, :events => true}
+ options = { daemonize: true, port: 17165, syslog: true, events: true }
- opts = OptionParser.new do |opts|
- opts.banner = <<-EOF
+ opts = OptionParser.new do |o|
+ o.banner = <<-BANNER
Usage:
Starting:
god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]
Querying:
@@ -40,61 +40,61 @@
quit stop god
terminate stop god and all tasks
check run self diagnostic
Options:
- EOF
+ BANNER
- opts.on("-cCONFIG", "--config-file CONFIG", "Configuration file") do |x|
+ o.on('-cCONFIG', '--config-file CONFIG', 'Configuration file') do |x|
options[:config] = x
end
- opts.on("-pPORT", "--port PORT", "Communications port (default 17165)") do |x|
+ o.on('-pPORT', '--port PORT', 'Communications port (default 17165)') do |x|
options[:port] = x
end
- opts.on("-b", "--auto-bind", "Auto-bind to an unused port number") do
- options[:port] = "0"
+ o.on('-b', '--auto-bind', 'Auto-bind to an unused port number') do
+ options[:port] = '0'
end
- opts.on("-PFILE", "--pid FILE", "Where to write the PID file") do |x|
+ o.on('-PFILE', '--pid FILE', 'Where to write the PID file') do |x|
options[:pid] = x
end
- opts.on("-lFILE", "--log FILE", "Where to write the log file") do |x|
+ o.on('-lFILE', '--log FILE', 'Where to write the log file') do |x|
options[:log] = x
end
- opts.on("-D", "--no-daemonize", "Don't daemonize") do
+ o.on('-D', '--no-daemonize', "Don't daemonize") do
options[:daemonize] = false
end
- opts.on("-v", "--version", "Print the version number and exit") do
+ o.on('-v', '--version', 'Print the version number and exit') do
options[:version] = true
end
- opts.on("-V", "Print extended version and build information") do
+ o.on('-V', 'Print extended version and build information') do
options[:info] = true
end
- opts.on("--log-level LEVEL", "Log level [debug|info|warn|error|fatal]") do |x|
+ o.on('--log-level LEVEL', 'Log level [debug|info|warn|error|fatal]') do |x|
options[:log_level] = x.to_sym
end
- opts.on("--no-syslog", "Disable output to syslog") do
+ o.on('--no-syslog', 'Disable output to syslog') do
options[:syslog] = false
end
- opts.on("--attach PID", "Quit god when the attached process dies") do |x|
+ o.on('--attach PID', 'Quit god when the attached process dies') do |x|
options[:attach] = x
end
- opts.on("--no-events", "Disable the event system") do
+ o.on('--no-events', 'Disable the event system') do
options[:events] = false
end
- opts.on("--bleakhouse", "Enable bleakhouse profiling") do
+ o.on('--bleakhouse', 'Enable bleakhouse profiling') do
options[:bleakhouse] = true
end
end
opts.parse!
@@ -113,22 +113,20 @@
God::CLI::Version.version
elsif !options[:config] && options[:info]
require 'god'
God::EventHandler.load
God::CLI::Version.version_extended
- elsif !options[:config] && command = ARGV[0]
+ elsif !options[:config] && (command = ARGV[0])
require 'god'
God::EventHandler.load
God::CLI::Command.new(command, options, ARGV)
else
require 'god/cli/run'
God::CLI::Run.new(options)
end
rescue Exception => e
- if e.instance_of?(SystemExit)
- raise
- else
- puts 'Uncaught exception'
- puts e.message
- puts e.backtrace.join("\n")
- end
+ raise if e.instance_of?(SystemExit)
+
+ puts 'Uncaught exception'
+ puts e.message
+ puts e.backtrace.join("\n")
end