Module: Lamed
- Included in:
- ObjectLoader, Rack::Builder
- Defined in:
- lib/lamed.rb,
lib/lamed/main.rb,
lib/lamed/model.rb,
lib/lamed/helper.rb,
lib/lamed/controller.rb,
lib/lamed/initializer.rb,
lib/lamed/object_loader.rb
Defined Under Namespace
Modules: Helper, Model
Classes: Controller, DM, MySQL, ObjectLoader
Constant Summary
collapse
- VERSION =
'0.4.6'
- OPTIONS =
{
:env => (ENV['RACK_ENV'] || "development").to_sym,
:config => ROOT + '/conf/',
:log_path => ROOT + '/logs',
:verbose => false
}
- SYS_OPTIONS =
YAML.load_file(OPTIONS[:config] + "config.yml")[OPTIONS[:env].to_s].inject({}) {|h,(k,v)| h[k.intern] = v; h}
- DB_OPTIONS =
YAML.load_file(OPTIONS[:config] + "database.yml")[OPTIONS[:env].to_s].inject({}) {|h,(k,v)| h[k.intern] = v; h}
Class Method Summary
collapse
Class Method Details
.initialize_logger ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/lamed/initializer.rb', line 39
def initialize_logger
if defined?(SYS_OPTIONS)
begin
logs = Logger.new(@log_path, OPTIONS[:rotate])
case OPTIONS[:env]
when :development
logs.level = Logger::DEBUG
when :test
logs.level = Logger::DEBUG
when :staging
logs.level = Logger::DEBUG
when :production
logs.level = Logger::WARN
end
rescue
logs = nil
end
end
if logs.nil?
puts "The log path #{@log_path} does not exist or is not writable."
puts "Log messages will be sent to STANDARD ERROR"
logs = Logger.new(STDERR)
end
@logger = logs
logs.warn("Logging level is set to #{@logger.level}")
return @logger
end
|
.load_controller ⇒ Object
.load_lib ⇒ Object
79
80
81
|
# File 'lib/lamed/initializer.rb', line 79
def load_lib
Dir[ROOT + '/lib/**/*.rb'].each {|f| load f}
end
|
.logger ⇒ Object
71
72
73
|
# File 'lib/lamed/initializer.rb', line 71
def logger
@logger
end
|
.opts ⇒ Object
75
76
77
|
# File 'lib/lamed/initializer.rb', line 75
def opts
@opts = SYS_OPTIONS
end
|