require 'hara/base' start_options = {host: 'localhost', port: 3210} #like sinatra.. if ARGV.any? require 'optparse' OptionParser.new { |op| op.on('-p port', "set the port (default is #{start_options[:port]})") { |val| start_options[:port] = val.to_i } op.on('-o addr', "set the host (default is #{start_options[:host]})") { |val| srart_options[:host] = val } op.on('-e env', 'set the environment (default is development)') { |val| Hara.env = val.to_sym } }.parse!(ARGV.dup) end at_exit { Hara::Server.start(start_options[:host], start_options[:port]) if $!.nil? }