-
Notifications
You must be signed in to change notification settings - Fork 2
/
yogurt.rb
49 lines (40 loc) · 1.08 KB
/
yogurt.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'roda'
class Yogurt < Roda
use Rack::Session::Cookie, secret: ENV['SECRET']
use Rack::MethodOverride
plugin :all_verbs
plugin :symbol_views
plugin :view_options
plugin :render, ext: 'html.erb', layout: '/layout'
plugin :static, %w[/images /fonts]
plugin :multi_route
plugin :assets, group_subdirs: false,
css: { home: %w[lib/bootstrap.css jumbotron.css],
yogurt: %w[lib/bootstrap.css yogurt.css] },
js: { yogurt: %w[lib/jquery-2.1.3.js lib/bootstrap.js] }
plugin(:not_found) { view '/http_404' }
if env.development?
require 'better_errors'
require 'pry'
use BetterErrors::Middleware
BetterErrors.application_root = __dir__
else
compile_assets
plugin :error_handler do |e|
case e
when Sequel::NoMatchingRow
response.status = 404
view '/http_404'
else
view '/http_500'
end
end
end
route do |r|
r.root { render(:index) }
r.multi_route
r.assets
end
end
Unreloader.require('routes'){}
Unreloader.record_split_class(__FILE__, 'routes')