#!/usr/bin/env ruby require 'perus' require 'optparse' options_path = Perus::Server::DEFAULT_SERVER_OPTIONS_PATH environment = 'development' OptionParser.new do |opts| opts.banner = "Usage: perus-server [options]" opts.on('-c', '--config PATH', "Path to config file (default: #{Perus::Server::DEFAULT_SERVER_OPTIONS_PATH})") do |c| options_path = c end opts.on('-e', '--env ENV', "Environment (values: development (default), production)") do |e| environment = e unless %w{development production}.include?(e) puts 'Environment must be "development" or "production"' exit end end opts.on('-h', '--help', 'Prints this help') do puts opts exit end end.parse! server = Perus::Server::Server.new(options_path, environment) server.run