Skip to content

Instantly share code, notes, and snippets.

@grantmichaels
Forked from benschwarz/.gems
Created April 30, 2010 13:52
Show Gist options
  • Save grantmichaels/385230 to your computer and use it in GitHub Desktop.
Save grantmichaels/385230 to your computer and use it in GitHub Desktop.
bonsai
rdiscount

Run 盆栽 Bonsai on Heroku

Add the files described below and ensure that you do the following.

  • Run bonsai --repot before you push to heroku (each time you push)
  • Ensure that output/ is not .gitignored
  • Make sure you pay Heroku. They're awesome.
require 'website'
run Bonsai::Server
require 'sinatra'
require 'bonsai'
Bonsai.root_dir = Dir.pwd
module Bonsai
class Server < Sinatra::Base
enable :static
disable :logging
set :public, File.join(File.dirname(__FILE__), "output")
get '/' do
begin
Page.find("index").render
rescue Exception => e
not_found
end
end
get '/*' do
begin
Page.find(params[:splat].join).render
rescue Exception => e
not_found
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment