This repository was archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinit.rb
More file actions
56 lines (42 loc) · 1.23 KB
/
init.rb
File metadata and controls
56 lines (42 loc) · 1.23 KB
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
55
56
ROOT_DIR = File.expand_path(File.dirname(__FILE__)) unless defined? ROOT_DIR
#to-do
#dynamically load all css and javascript in the layout
require 'rubygems'
require 'bundler'
Bundler.setup
require 'date'
require 'open-uri'
require 'haml'
require 'json'
require 'sass/plugin/rack'
require 'mongo'
require 'mongo_mapper'
require 'bson'
require 'sinatra/base'
require 'sinatra/reloader'
# Connect to mongo database.
#MongoMapper.connection = Mongo::Connection.new
#MongoMapper.database = INSERT DATABASE NAME HERE
# Load all application files.
Dir["#{File.dirname(__FILE__)}/app/**/*.rb"].each do |file|
require file
end
if defined? Encoding
Encoding.default_external = Encoding::UTF_8
end
class Main < Sinatra::Base
#enable :sessions
#For Security enable rack sessions
use Rack::Session::Pool
set :app_file, __FILE__
set :haml, { :format => :html5 }
set :protection, :except => [:frame_options,:http_origin]
use Sass::Plugin::Rack
configure do
#Set any configuration variables you might need here
end
configure :development do
register Sinatra::Reloader
end
end
Main.run! if Main.run?