-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
24 lines (22 loc) · 835 Bytes
/
init.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
# File to make the project act like a Rails plugin.
#
# Sets Parser::default_compliance_level[link:/classes/Rcal/Parser.html]
# to strict if RAILS_ENV is 'development' or 'test,' and to lax if RAILS_ENV
# is 'production.'
#
# Sets
# Util::Loggable::default_logger.level[link:/classes/Rcal/Util/Loggable.html]
# to DEBUG if RAILS_ENV is 'development' or 'test,' and to ERROR if RAILS_ENV
# is 'production.'
if Object.const_defined?(:RAILS_ENV)
require 'rcal/parser'
require 'rcal/util/loggable'
case RAILS_ENV
when *['development', 'test']
Rcal::Parser::default_compliance_level = Rcal::Parser::STRICT
Rcal::Util::Loggable.default_logger.level = Logger::DEBUG
when 'production'
Rcal::Parser::default_compliance_level = Rcal::Parser::LAX
Rcal::Util::Loggable.default_logger.level = Logger::ERROR
end
end