class QPush::Server::Launcher
Handles the start of the QPush
server via command line
Public Class Methods
new(argv)
click to toggle source
# File lib/qpush/server/launcher.rb, line 6 def initialize(argv) @argv = argv end
Public Instance Methods
start()
click to toggle source
Provides the main entrypoint for starting a QPush
server.
# File lib/qpush/server/launcher.rb, line 12 def start start_message setup_options validate! setup_jobs boot_manager end
Private Instance Methods
boot_manager()
click to toggle source
Boots our manager
# File lib/qpush/server/launcher.rb, line 58 def boot_manager manager = Manager.new(Server.config.workers) manager.start end
setup_jobs()
click to toggle source
Requires all base jobs as well as user jobs.
# File lib/qpush/server/launcher.rb, line 52 def setup_jobs JobLoader.call end
setup_options()
click to toggle source
Parses the arguments passed through the command line.
# File lib/qpush/server/launcher.rb, line 29 def setup_options parser = OptionParser.new do |o| o.banner = 'Usage: bundle exec qpush-server [options]' o.on('-c', '--config PATH', 'Load PATH for config file') do |arg| load(arg) Server.log.info("* Server config: #{arg}") end o.on('-h', '--help', 'Prints this help') { puts o && exit } end parser.parse!(@argv) end
start_message()
click to toggle source
# File lib/qpush/server/launcher.rb, line 22 def start_message Server.log.info('QPush Server starting!') Server.log.info("* Version #{QPush::VERSION}, codename: #{QPush::CODENAME}") end
validate!()
click to toggle source
Validates our server and worker configuration.
# File lib/qpush/server/launcher.rb, line 45 def validate! Server.config.validate! Server.config.workers.each { |w| w.validate! } end