Class: Phobos::CLI::Start

Inherits:
Object
  • Object
show all
Defined in:
lib/deimos/monkey_patches/phobos_cli.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#validate_listeners!Object

:nodoc:



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/deimos/monkey_patches/phobos_cli.rb', line 12

def validate_listeners!
  Phobos.config.listeners.each do |listener|
    handler = listener.handler
    begin
      handler.constantize
    rescue NameError
      error_exit("Handler '#{handler}' not defined")
    end

    delivery = listener.delivery
    if delivery.nil?
      Phobos::CLI.logger.warn do
        Hash(message: "Delivery option should be specified, defaulting to 'batch'"\
         ' - specify this option to silence this message')
      end
    elsif !Listener::DELIVERY_OPTS.include?(delivery)
      error_exit("Invalid delivery option '#{delivery}'. Please specify one of: "\
        "#{Listener::DELIVERY_OPTS.join(', ')}")
    end
  end
end