-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.rb
executable file
·41 lines (31 loc) · 888 Bytes
/
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
37
38
39
40
#!/usr/bin/env ruby -I ../lib -I lib
# coding: utf-8
require 'bundler/setup'
Bundler.require
require 'sinatra'
require 'sinatra/session'
require 'json'
require 'forgery'
require 'geocoder'
require 'ip'
require 'yaml'
require 'sanitize'
require 'data_mapper'
# Settings
set :server, 'thin'
set :session_secret, 'super-secret'
set :protection, :except => :frame_options
set :views, Proc.new { File.join(root, "app/views") }
set :streams, []
# Setup DataMapper
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3::memory:")
# Models
require_relative 'app/models/channel'
require_relative 'app/models/message'
# Finalize DataMapper after initializing models
DataMapper.finalize
DataMapper.auto_upgrade!
# Controllers
require_relative 'app/controllers/base_controller'
require_relative 'app/controllers/channel_controller'
require_relative 'app/controllers/stream_controller'