Skip to content

Instantly share code, notes, and snippets.

@benschwarz
Created April 29, 2010 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save benschwarz/383126 to your computer and use it in GitHub Desktop.
Save benschwarz/383126 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