#!/usr/bin/env ruby # == Synopsis # # monitor: monitor the refinery system # # == Usage # # monitor [OPTION] # # -h, --help: # show help # # -d, --debug: # turn on debug logging # # -c, --config filename # specify a configuration file # # -v, --verbose # print info to the standard output require 'getoptlong' require 'rdoc/usage' require 'refinery' options = {} opts = GetoptLong.new( [ '--help', '-h', GetoptLong::NO_ARGUMENT ], [ '--debug', '-d', GetoptLong::NO_ARGUMENT ], [ '--config', '-c', GetoptLong::REQUIRED_ARGUMENT], [ '--verbose', '-v', GetoptLong::NO_ARGUMENT] ) opts.each do |opt, arg| case opt when '--help' RDoc::usage when '--debug' options[:debug] = true when '--config' options[:config] = arg when '--verbose' options[:verbose] = true end end Refinery::Monitor.new(options).run