Sha256: f9f92b5fe7891bb9e38475fa3b2210b81ffb27f5d2bbd70909aa85e57c0d67b6

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

#!/usr/bin/env ruby

$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))

require 'rubygems'
require 'sinatra'
require 'getoptlong'

set :environment, :production

def printusage(error_code)
  print "Usage: jschat-web [options]\n\n"
  print "    -b, --bind=ADDRESS               IP address\n"
  print "    -p, --port=PORT                  Port number\n"
  print "    -H, --help                       This text\n"

  exit(error_code)
end

opts = GetoptLong.new(
  [ "--bind", "-b", GetoptLong::REQUIRED_ARGUMENT ],
  [ "--port", "-p", GetoptLong::REQUIRED_ARGUMENT ],
  [ "--help", "-H", GetoptLong::NO_ARGUMENT ]
)

begin
  opts.each do |opt, arg|
    case opt
      when "--bind"
        set :bind, arg
      when "--port"
        set :port, arg
      when "--help"
        printusage(0)
    end
  end
end
                                                                                 
require 'jschat/http/jschat'
Sinatra::Application.run!

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jschat-0.3.7 bin/jschat-web