#!/usr/bin/env ruby
require 'pathname'
@root = Pathname.new(File.dirname(__FILE__)).parent.expand_path
action = ARGV[0]
case action
when "start"
require 'rubygems'
require 'rack'
config = @root.join('lib/visage/config.ru').to_s
Rack::Server.start(:config => config, :Port => 9292)
when "genapache"
require 'socket'
fqdn = Socket.gethostbyname(Socket.gethostname).first
public_dir = @root.join('lib/visage/public')
puts <<-CONFIG
ServerName #{fqdn}
ServerAdmin root@#{fqdn}
DocumentRoot #{public_dir}
Options FollowSymLinks Indexes
AllowOverride None
Order allow,deny
Allow from all
CONFIG
else
puts "Usage: visage "
end