Module: Grat
- Defined in:
- lib/environment.rb
Defined Under Namespace
Modules: System
Classes: Application, Content, EmptyContent, HashBinding
Constant Summary
collapse
- @@connection =
nil
- @@database_conf =
{}
Class Method Summary
collapse
Class Method Details
.database ⇒ Object
42
43
44
|
# File 'lib/environment.rb', line 42
def self.database
MongoMapper.database
end
|
.database_conf(options = {}) ⇒ Object
21
22
23
|
# File 'lib/environment.rb', line 21
def self.database_conf(options = {})
@@database_conf = options
end
|
.database_load ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/environment.rb', line 25
def self.database_load
require 'mongo_mapper'
if @@database_conf[:host]
MongoMapper.connection = Mongo::Connection.new(@@database_conf[:host])
end
MongoMapper.database = @@database_conf[:database] || 'grat_development'
if @@database_conf[:username] && @@database_conf[:password]
MongoMapper.database.authenticate(@@database_conf[:username], @@database_conf[:password])
end
require Grat.lib_path + '/grat/content'
require Grat.lib_path + '/grat/hwia_patch'
end
|
.lib_path ⇒ Object
13
14
15
|
# File 'lib/environment.rb', line 13
def self.lib_path
root_path + '/lib'
end
|
.root_path ⇒ Object
9
10
11
|
# File 'lib/environment.rb', line 9
def self.root_path
File.dirname(File.dirname(__FILE__))
end
|
.view_path ⇒ Object
17
18
19
|
# File 'lib/environment.rb', line 17
def self.view_path
root_path + '/views'
end
|