class Bake::BakeRtextServiceOptions

Attributes

loglevel[R]
patterns[R]
timeout[R]

Public Class Methods

new(argv) click to toggle source
Calls superclass method Bake::Parser::new
# File lib/rtext-service/options/options.rb, line 10
def initialize(argv)
  super(argv)

  @loglevel = 'info'
  @patterns = []
  @timeout = 3600

  add_option([""                 ], lambda { |x| @patterns.push(x)                                    })
  add_option(["-l", "--loglevel" ], lambda { |x| set_loglevel(x)                                      })
  add_option(["-t", "--timeout"  ], lambda { |x| @timeout = x.to_i                                    })
  add_option(["-h", "--help"     ], lambda { usage; ExitHelper.exit(0)                                })
  add_option(["--version"        ], lambda { Bake::Version.printBakeFormatVersion; ExitHelper.exit(0) })
end

Public Instance Methods

parse_options() click to toggle source
# File lib/rtext-service/options/options.rb, line 33
def parse_options()
  parse_internal(true)
  @patterns = ['./**'] unless @patterns.any?
end
usage() click to toggle source
# File lib/rtext-service/options/options.rb, line 24
def usage
  puts [
    "Usage: #{__FILE__} [options] <dir patterns>",
    "  -l, --loglevel [string], log level is one of [debug, info, warn, error, fatal].",
    "  -t, --timeout [number], idle timeout in seconds after which the service will shutdown. Default is 3600.",
    "  dir patterns, glob patterns."
  ].join("\n")
end