lib/smallcage/application.rb in smallcage-0.2.4 vs lib/smallcage/application.rb in smallcage-0.2.5
- old
+ new
@@ -1,9 +1,9 @@
class SmallCage::Application
require 'optparse'
VERSION_NOTE = "SmallCage #{SmallCage::VERSION} - a simple website generator"
-
+
@@signal_handlers = nil
def self.init_signal_handlers
@@signal_handlers = {
"INT" => [],
@@ -16,11 +16,11 @@
proc.call(signal)
end
end
end
end
-
+
def self.add_signal_handler(signal, handler)
init_signal_handlers if @@signal_handlers.nil?
signal.to_a.each do |s|
@@signal_handlers[s] << handler
end
@@ -74,11 +74,11 @@
end
parser.on("-v", "--version", "Show version info.") do
puts VERSION_NOTE
exit(true)
end
-
+
@options[:quiet] = false
parser.on("-q", "--quiet", "Do not print message.") do |boolean|
@options[:quiet] = boolean
end
@@ -252,16 +252,15 @@
end
private :parse_command_options
def get_port_number(default)
return default if @argv.empty?
-
+
port = @argv.shift
if port.to_i == 0
$stderr.puts "illegal port number: #{port}"
exit(false)
end
return port.to_i
end
private :get_port_number
-
end