Sha256: 449d4739dab3847aaf3663c0a861d01e35b5c21132c9ed4fa9456b926a494f67

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

#!/usr/bin/env jruby

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

require 'rubygems'
require 'kipatra'
require 'optparse'

options = {:udp => [], :tcp => [], :sipatra => false}
option_parser = OptionParser.new do |opts|

  opts.on("-u UDP","--udp UDP") do |udp|
    host, port = udp.split(':')
    port = port.nil? ? 5060 : port.to_i
    options[:udp] << {:host => host, :port => port}
  end

  opts.on("-t TCP","--tcp TCP") do |tcp|
    host, port = tcp.split(':')
    port = port.nil? ? 5060 : port.to_i
    options[:tcp] << {:host => host, :port => port}
  end

  opts.on("-s", "--sipatra") do
    options[:sipatra] = true
  end
end
option_parser.parse!

## DEBUG
#puts options.inspect

dir_or_file = ARGV.shift

raise "No application to start." if dir_or_file.nil?

if(File.directory?(dir_or_file) || dir_or_file[-4..-1] == '.war') 
  options[:war] = dir_or_file
else
  options[:app_file] = dir_or_file
end

server = Kipatra::Server.new(options)
server.start
server.join

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kipatra-0.1.1 bin/kipatra