-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.rb
36 lines (32 loc) · 1.17 KB
/
app.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
require 'sinatra/base'
require 'sinatra/activerecord'
require 'yaml'
require 'active_record'
require 'will_paginate'
require 'will_paginate/active_record'
require 'digest'
require 'thinking_sphinx'
require 'bcrypt'
require './app/models/user'
require './app/models/message'
require './config/initializers/will_paginate'
require './app/controllers/users'
require './app/controllers/messages'
require './app/controllers/search'
require './app/controllers/errors'
require './app/helpers/users'
require './app/helpers/messages'
class App < Sinatra::Base
set :raise_errors, false
set :show_exceptions, true if development?
set :haml, { :ugly => true } if production?
set :views, File.join(File.dirname(__FILE__), 'app', 'views')
set :public_folder, File.join(File.dirname(__FILE__), 'public')
env = ENV['RACK_ENV'] || 'development'
db_config = YAML::load_file(File.join(File.dirname(__FILE__), 'config', 'database.yml'))[env]
ActiveRecord::Base.establish_connection(db_config)
xmpp_config = YAML::load_file(File.join(File.dirname(__FILE__), 'config', 'xmpp.yml'))[env]
set :room_name, xmpp_config['room']
register WillPaginate::Sinatra
register Sinatra::ActiveRecordExtension
end