Skip to content

Instantly share code, notes, and snippets.

@adhusson
Created May 27, 2010 14:03
Show Gist options
  • Save adhusson/415830 to your computer and use it in GitHub Desktop.
Save adhusson/415830 to your computer and use it in GitHub Desktop.
require 'sinatra/base'
require 'pony'
require 'erubis'
require 'validatable'
Dir["lib/*.rb"].each {|file| require file }
class FermeGallard < Sinatra::Base
set :sessions, true
configure do
set :raise_errors, true
set :env, :production
# Disable Sinatra's built-in webserver
disable :run
# Serves static content from the public folder.
enable :static
set :views, Pathname.new(__FILE__).dirname.join('views').expand_path
set :public, Pathname.new(__FILE__).dirname.join('public').expand_path
set :haml, {:format => :html4}
end
helpers Sinatra::Partials, Helpers
get '/' do
haml :accueil
end
# ...
get '/error' do
fail "TEST FAILING" # This shows an error in the browser but Exceptional receives nothing.
end
end
begin
# Require the preresolved locked set of gems.
require ::File.expand_path('../.bundle/environment', __FILE__)
rescue LoadError
# Fallback on doing the resolve at runtime.
require "rubygems"
require "bundler"
Bundler.setup
end
require 'exceptional'
require 'application'
use Rack::Exceptional, "API_KEY"
run FermeGallard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment