Skip to content

Instantly share code, notes, and snippets.

@tbuehlmann
Created June 26, 2009 14:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbuehlmann/136499 to your computer and use it in GitHub Desktop.
Save tbuehlmann/136499 to your computer and use it in GitHub Desktop.
Sinatra Template
%w{rubygems sinatra haml}.each {|r| require r}
configure do
set :views, "#{File.dirname(__FILE__)}/views"
end
get '/' do
haml "Hello World!"
end
error do
e = request.env['sinatra.error']
Kernel.puts e.backtrace.join("\n")
haml "Application error"
end
not_found do
haml "Not found"
end
helpers do
end
require 'application'
# set :run, false
set :environment, :production
FileUtils.mkdir_p 'log' unless File.exists?('log')
log = File.new("log/sinatra.log", "a")
$stdout.reopen(log)
$stderr.reopen(log)
run Sinatra::Application
!!!
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
%head
%title Title
%meta{:content => "text/html; charset=utf-8", :"http-equiv" => "Content-Type"}
%body
=yield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment