def parse(argv)
      parser        = OptionParser.new do |o|
        o.on('-n', '--name NAME', 'Unique Name of this server (Default: host_name:PID)') do |arg|
          @name = arg
        end
        o.on('-w', '--workers COUNT', 'Number of workers (threads) to start') do |arg|
          @workers = arg.to_i
        end
        o.on('-t', '--threads COUNT', 'DEPRECATED') do |arg|
          warn '-t and --threads are deprecated, use -w or --workers'
          @workers = arg.to_i
        end
        o.on('-F', '--filter REGEXP', 'Limit this server to only those job classes that match this regular expression (case-insensitive). Example: "DirmonJob|WeeklyReportJob"') do |arg|
          @include_filter = Regexp.new(arg, true)
        end
        o.on('-E', '--exclude REGEXP', 'Prevent this server from working on any job classes that match this regular expression (case-insensitive). Example: "DirmonJob|WeeklyReportJob"') do |arg|
          @exclude_filter = Regexp.new(arg, true)
        end
        o.on('-W', '--where JSON', "Limit this server instance to the supplied mongo query filter. Supply as a string in JSON format. Example: '{\"priority\":{\"$lte\":25}}'") do |arg|
          @where_filter = JSON.parse(arg)
        end
        o.on('-q', '--quiet', 'Do not write to stdout, only to logfile. Necessary when running as a daemon') do
          @quiet = true
        end
        o.on('-d', '--dir DIR', 'Directory containing Rails app, if not current directory') do |arg|
          @directory = arg
        end
        o.on('-e', '--environment ENVIRONMENT', 'The environment to run the app on (Default: RAILS_ENV || RACK_ENV || development)') do |arg|
          @environment = arg
        end
        o.on('-l', '--log_level trace|debug|info|warn|error|fatal', 'The log level to use') do |arg|
          @log_level = arg
        end
        o.on('-f', '--log_file FILE_NAME', 'The log file to write to. Default: log/<environment>.log') do |arg|
          @log_file = arg
        end
        o.on('--pidfile PATH', 'Use PATH as a pidfile') do |arg|
          @pidfile = arg
        end
        o.on('-m', '--mongo MONGO_CONFIG_FILE_NAME', 'Path and filename of config file. Default: config/mongoid.yml') do |arg|
          @mongo_config = arg
        end
        o.on('-s', '--symmetric-encryption SYMMETRIC_ENCRYPTION_CONFIG_FILE_NAME', 'Path and filename of Symmetric Encryption config file. Default: config/symmetric-encryption.yml') do |arg|
          @symmetric_encryption_config = arg
        end
        o.on('-v', '--version', 'Print the version information') do
          puts "Rocket Job v#{RocketJob::VERSION}"
          exit 1
        end
      end
      parser.banner = 'rocketjob <options>'
      parser.on_tail '-h', '--help', 'Show help' do
        puts parser
        exit 1
      end
      parser.parse! argv
    end
def parse(argv)
      parser        = OptionParser.new do |o|
        o.on('-n', '--name NAME', 'Unique Name of this server (Default: host_name:PID)') do |arg|
          @name = arg
        end
        o.on('-w', '--workers COUNT', 'Number of workers (threads) to start') do |arg|
          @workers = arg.to_i
        end
        o.on('-t', '--threads COUNT', 'DEPRECATED') do |arg|
          warn '-t and --threads are deprecated, use -w or --workers'
          @workers = arg.to_i
        end
        o.on('-F', '--filter REGEXP', 'Limit this server to only those job classes that match this regular expression (case-insensitive). Example: "DirmonJob|WeeklyReportJob"') do |arg|
          @include_filter = Regexp.new(arg, true)
        end
        o.on('-E', '--exclude REGEXP', 'Prevent this server from working on any job classes that match this regular expression (case-insensitive). Example: "DirmonJob|WeeklyReportJob"') do |arg|
          @exclude_filter = Regexp.new(arg, true)
        end
        o.on('-W', '--where JSON', "Limit this server instance to the supplied mongo query filter. Supply as a string in JSON format. Example: '{\"priority\":{\"$lte\":25}}'") do |arg|
          @where_filter = JSON.parse(arg)
        end
        o.on('-q', '--quiet', 'Do not write to stdout, only to logfile. Necessary when running as a daemon') do
          @quiet = true
        end
        o.on('-d', '--dir DIR', 'Directory containing Rails app, if not current directory') do |arg|
          @directory = arg
        end
        o.on('-e', '--environment ENVIRONMENT', 'The environment to run the app on (Default: RAILS_ENV || RACK_ENV || development)') do |arg|
          @environment = arg
        end
        o.on('-l', '--log_level trace|debug|info|warn|error|fatal', 'The log level to use') do |arg|
          @log_level = arg
        end
        o.on('-f', '--log_file FILE_NAME', 'The log file to write to. Default: log/<environment>.log') do |arg|
          @log_file = arg
        end
        o.on('--pidfile PATH', 'Use PATH as a pidfile') do |arg|
          @pidfile = arg
        end
        o.on('-m', '--mongo MONGO_CONFIG_FILE_NAME', 'Path and filename of config file. Default: config/mongoid.yml') do |arg|
          @mongo_config = arg
        end
        o.on('-s', '--symmetric-encryption SYMMETRIC_ENCRYPTION_CONFIG_FILE_NAME', 'Path and filename of Symmetric Encryption config file. Default: config/symmetric-encryption.yml') do |arg|
          @symmetric_encryption_config = arg
        end
        o.on('-v', '--version', 'Print the version information') do
          puts "Rocket Job v#{RocketJob::VERSION}"
          exit 1
        end
      end
      parser.banner = 'rocketjob <options>'
      parser.on_tail '-h', '--help', 'Show help' do
        puts parser
        exit 1
      end
      parser.parse! argv
    end
Parse command line options placing results in the corresponding instance variables