Created
February 9, 2010 13:31
-
-
Save resistorsoftware/299200 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'toto' | |
require 'config/environment' | |
#point to your rails apps /public directory | |
use Rack::Static, :urls => ['/stylesheets', '/javascripts', '/images', '/favicon.ico'], :root => 'public' | |
use Rack::ShowExceptions | |
use Rack::CommonLogger | |
#run the toto application | |
toto = Toto::Server.new do | |
#override the default location for the toto directories | |
Toto::Paths = { | |
:templates => "blog/templates", | |
:pages => "blog/templates/pages", | |
:articles => "blog/articles" | |
} | |
#set your config variables here | |
set :title, "Ar-Bee-Dar Matey!" | |
set :date, lambda {|now| now.strftime("%B #{now.day.ordinal} %Y") } | |
set :summary, :max => 500 | |
set :root, "blog" | |
if RAILS_ENV != "production" | |
set :url, "http://localhost:9292/blog/" | |
else | |
set :url, "http://www.foobar.com/blog/" | |
end | |
end | |
#create a rack app | |
app = Rack::Builder.new do | |
use Rack::CommonLogger | |
#map requests to /blog to toto | |
map '/blog' do | |
run toto | |
end | |
#map all the other requests to rails | |
map '/' do | |
use Rails::Rack::Static | |
run ActionController::Dispatcher.new | |
end | |
end.to_app | |
run app | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment