class HTTPMe::Command

Public Instance Methods

run() click to toggle source
# File lib/httpme/command.rb, line 29
def run
  path = args['PATH'] || ENV['HTTPME_PATH'] || '.'
  port = (args['--port'] || ENV['HTTPME_PORT'] || 3000).to_i
  host = args['--host'] || ENV['HTTPME_HOST'] || '0.0.0.0'
  auth = args['--auth'] || ENV['HTTPME_AUTH']

  raise ArgumentError, "Path not found [#{path}]" unless Dir.exist? path

  server = Server.new path: path, host: host, port: port, auth: auth
  server.run
end