lib/eventhub/configuration.rb
def parse_options(argv = ARGV)
      @config_file = File.join(Dir.getwd, 'config', "#{@name}.json")

      OptionParser.new do |opts|
        note = 'Define environment'
        opts.on('-e', '--environment ENVIRONMENT', note) do |environment|
          @environment = environment
        end

        opts.on('-d', '--detached', 'Run processor detached as a daemon') do
          @detached = true
        end

        note = 'Define configuration file'
        opts.on('-c', '--config CONFIG', note) do |config|
          @config_file = config
        end
      end.parse!(argv)

      true
    rescue OptionParser::InvalidOption => e
      EventHub.logger.warn("Argument Parsing: #{e}")
      false
    rescue OptionParser::MissingArgument => e
      EventHub.logger.warn("Argument Parsing: #{e}")
      false
    end
def parse_options(argv = ARGV)
      @config_file = File.join(Dir.getwd, 'config', "#{@name}.json")

      OptionParser.new do |opts|
        note = 'Define environment'
        opts.on('-e', '--environment ENVIRONMENT', note) do |environment|
          @environment = environment
        end

        opts.on('-d', '--detached', 'Run processor detached as a daemon') do
          @detached = true
        end

        note = 'Define configuration file'
        opts.on('-c', '--config CONFIG', note) do |config|
          @config_file = config
        end
      end.parse!(argv)

      true
    rescue OptionParser::InvalidOption => e
      EventHub.logger.warn("Argument Parsing: #{e}")
      false
    rescue OptionParser::MissingArgument => e
      EventHub.logger.warn("Argument Parsing: #{e}")
      false
    end
def parse_options ( argv = ARGV ) @config_file = File . join ( Dir . getwd , 'config' , "#{@name}.json" ) OptionParser . new do | opts | note = 'Define environment' opts . on ( '-e' , '--environment ENVIRONMENT' , note ) do | environment | @environment = environment end opts . on ( '-d' , '--detached' , 'Run processor detached as a daemon' ) do @detached = true end note = 'Define configuration file' opts . on ( '-c' , '--config CONFIG' , note ) do | config | @config_file = config end end . parse! ( argv ) true rescue OptionParser :: InvalidOption => e EventHub . logger . warn ( "Argument Parsing: #{e}" ) false rescue OptionParser :: MissingArgument => e EventHub . logger . warn ( "Argument Parsing: #{e}" ) false end
parse options from argument list
parse options from argument list