#!/usr/bin/ruby
$:.unshift(File.dirname(__FILE__)+'/../lib') unless
  $:.include?(File.dirname(__FILE__)+'/../lib') || $:.include?(File.expand_path(File.dirname(__FILE__)+'/../lib'))

require 'starfish'

def server(options={}, &block)
  Starfish.options = options
  Starfish.server = block
end

def client(options={}, &block)
  Starfish.options = options
  Starfish.client = block
end

require ARGV.first

if ARGV.include?('stop')
  Starfish.new.stop
elsif ARGV.include?('server')
  Starfish.new.server
elsif ARGV.include?('stats')
  Starfish.new.stats
else
  Starfish.new.client
end