def run
require 'rack'
self.require_site
autocompile_config = self.site.config[:autocompile] || {}
options_for_rack = {
:Port => (options[:port] || autocompile_config[:port] || 3000).to_i,
:Host => (options[:host] || autocompile_config[:host] || '0.0.0.0')
}
handler_option = options[:handler] || autocompile_config[:handler]
unless handler = Rack::Handler.get(handler_option)
begin
handler = Rack::Handler::Mongrel
rescue LoadError => e
handler = Rack::Handler::WEBrick
end
end
autocompiler = Nanoc::Extra::AutoCompiler.new('.')
app = Rack::Builder.new do
use Rack::CommonLogger, $stderr
use Rack::ShowExceptions
run autocompiler
end.to_app
puts "Running on http://#{options_for_rack[:Host]}:#{options_for_rack[:Port]}/"
handler.run(app, options_for_rack)
end