-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.rb
54 lines (45 loc) · 1.41 KB
/
main.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
50
51
52
53
54
require 'sinatra'
require 'sinatra/reloader'
# require 'mongoid'
# require 'slim'
require 'compass'
require 'erb'
#require 'redcarpet'
class Main < Sinatra::Application
configure do
disable :show_exceptions
disable :raise_errors
#** Set up Sinatra variables
set :app_file, __FILE__
set :root, File.dirname(__FILE__)
set :views, File.join(File.dirname(__FILE__), 'views')
set :public_dir, File.join(File.dirname(__FILE__), 'public')
set :layouts_dir, File.join(File.dirname(__FILE__), 'views', 'layouts')
set :partials_dir, File.join(File.dirname(__FILE__), 'views', 'partials')
# Mongoid.load!("./mongoid.yml")
# Set your Google Analytics ID here if you have one:
# set :google_analytics_id, 'UA-12345678-1'
#** Configure compass
#* @see http://compass-style.org/help/tutorials/integration/
#**
Compass.add_project_configuration(File.join(Sinatra::Application.root, 'config', 'compass.rb'))
end
not_found do
status 404
@page_title = '404'
erb :'404', :layout => :default,
:layout_options => {:views => settings.layouts_dir}
end
error do
status 500
@page_title = '500'
erb :'500', :layout => :default,
:layout_options => {:views => settings.layouts_dir}
end
get '/' do
@page_title = 'Hello World!'
h
erb :index, :layout => :default,
:layout_options => {:views => settings.layouts_dir}
end
end