-
Notifications
You must be signed in to change notification settings - Fork 9
/
application.rb
51 lines (40 loc) · 1.04 KB
/
application.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
# encoding: utf-8
require "rubygems"
require "bundler"
require 'em-hiredis'
require 'json'
module Callme
class Application
def self.root(path = nil)
@_root ||= File.expand_path(File.dirname(__FILE__))
path ? File.join(@_root, path.to_s) : @_root
end
def self.env
@_env ||= ENV['RACK_ENV'] || 'development'
end
def self.routes
@_routes ||= eval(File.read('./config/routes.rb'))
end
def self.scripts
@_scripts ||= %w(mt more object_with_handlers session remote register_box status_box contacts_box util video_box index)
end
def self.redis
if @_redis.nil?
@_redis = EM::Hiredis.connect
@_redis.callback do
@_redis.del( Session.table_name )
end
end
@_redis
end
# Initialize the application
def self.initialize!
Cramp::Websocket.backend = :thin
end
end
end
Bundler.require(:default, Callme::Application.env)
# Preload application classes
%w(lib app).each do |loc|
Dir["./#{loc}/**/*.rb"].each {|f| require f}
end