Skip to content

Instantly share code, notes, and snippets.

@resistorsoftware
Created February 9, 2010 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save resistorsoftware/299200 to your computer and use it in GitHub Desktop.
Save resistorsoftware/299200 to your computer and use it in GitHub Desktop.
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