Methods
Constants
COMMANDS | = | [ ['start', 'StartCommand'], ['stop', 'StopCommand'], ['status', 'StatusCommand'], ['package-runtime', 'PackageRuntimeCommand'], ['version', 'VersionCommand'], ['help', 'HelpCommand'] |
Public Class methods
[ show source ]
# File lib/phusion_passenger/standalone/main.rb, line 42 42: def self.each_command 43: COMMANDS.each do |command_spec| 44: command_name = command_spec[0] 45: filename = command_name.sub(/-/, '_') + "_command" 46: require "phusion_passenger/standalone/#{filename}" 47: command_class = Standalone.const_get(command_spec[1]) 48: yield(command_name, command_class) 49: end 50: end
[ show source ]
# File lib/phusion_passenger/standalone/main.rb, line 38 38: def self.run!(argv) 39: new.run!(argv) 40: end
Public Instance methods
[ show source ]
# File lib/phusion_passenger/standalone/main.rb, line 52 52: def run!(argv) 53: command = argv[0] 54: if command.nil? || command == '-h' || command == '--help' 55: run_command('help') 56: exit 57: elsif command == '-v' || command == '--version' 58: run_command('version') 59: exit 60: elsif command_exists?(command) 61: begin 62: run_command(command, argv[1..-1]) 63: rescue => e 64: if defined?(OptionParser::ParseError) && e.is_a?(OptionParser::ParseError) 65: puts e 66: puts 67: puts "Please see '--help' for valid options." 68: exit 1 69: elsif defined?(ConfigFile::DisallowedContextError) && e.is_a?(ConfigFile::DisallowedContextError) 70: puts "*** Error in #{e.filename} line #{e.line}:" 71: puts e 72: exit 1 73: else 74: raise e 75: end 76: end 77: else 78: STDERR.puts "Unknown command '#{command}'. Please type --help for options." 79: exit 1 80: end 81: end