Class: Shoryuken::CLI
- Inherits:
-
Object
- Object
- Shoryuken::CLI
- Includes:
- Util, Singleton
- Defined in:
- lib/shoryuken/cli.rb
Instance Attribute Summary collapse
-
#launcher ⇒ Object
Returns the value of attribute launcher.
Instance Method Summary collapse
Methods included from Util
#elapsed, #fire_event, #logger, #unparse_queues, #watchdog, #worker_name
Instance Attribute Details
#launcher ⇒ Object
Returns the value of attribute launcher.
17 18 19 |
# File 'lib/shoryuken/cli.rb', line 17 def launcher @launcher end |
Instance Method Details
#run(args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/shoryuken/cli.rb', line 19 def run(args) self_read, self_write = IO.pipe %w(INT TERM USR1 USR2 TTIN).each do |sig| begin trap sig do self_write.puts(sig) end rescue ArgumentError puts "Signal #{sig} not supported" end end = parse_cli_args(args) loader = EnvironmentLoader.() # When cli args exist, override options in config file Shoryuken..merge!() daemonize(Shoryuken.) write_pid(Shoryuken.) loader.load load_celluloid require 'shoryuken/launcher' @launcher = Shoryuken::Launcher.new if callback = Shoryuken.start_callback logger.info { 'Calling Shoryuken.on_start block' } callback.call end fire_event(:startup) begin launcher.run while (readable_io = IO.select([self_read])) signal = readable_io.first[0].gets.strip handle_signal(signal) end rescue Interrupt launcher.stop(shutdown: true) exit 0 end end |