#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
## brew server: Run a local webserver for browsing available and installed brews.
# Note: this external command is ruby, but set up as a shell script, so that it gets exec'd.
# This is required for sinatra's run-loop to take over.
$:.unshift(ENV['HOMEBREW_LIBRARY_PATH'])
require 'global'
require 'formula'
require 'cmd/search'
require 'rubygems'
begin
require 'sinatra'
rescue LoadError
onoe 'Sinatra required but not found'
puts 'To install: /usr/bin/gem install sinatra'
exit 1
end
require 'cgi'
def link_to_formula name
"#{name}"
end
def css_style; <<-CSS
CSS
end
def search_form; <<-EOS
EOS
end
def html_page(title)
body = <<-HTML
#{title}
#{css_style}