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
40
41
42
|
# File 'lib/environment.rb', line 40
def self.database
MongoMapper.database
end
|
.database_conf(options = {}) ⇒ Object
19
20
21
|
# File 'lib/environment.rb', line 19
def self.database_conf(options = {})
@@database_conf = options
end
|
.database_load ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/environment.rb', line 23
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
11
12
13
|
# File 'lib/environment.rb', line 11
def self.lib_path
root_path + '/lib'
end
|
.root_path ⇒ Object
7
8
9
|
# File 'lib/environment.rb', line 7
def self.root_path
File.dirname(File.dirname(__FILE__))
end
|
.view_path ⇒ Object
15
16
17
|
# File 'lib/environment.rb', line 15
def self.view_path
root_path + '/views'
end
|