lib/lumber/lumber.rb in lumber-0.9.3 vs lib/lumber/lumber.rb in lumber-0.9.4
- old
+ new
@@ -1,7 +1,15 @@
require "socket"
-require "active_support/core_ext/duplicable"
+
+begin
+ # rails(active_support) 2
+ require "active_support/core_ext/duplicable"
+rescue LoadError
+ # rails(active_support) 3
+ require "active_support/core_ext/object/duplicable"
+end
+
require "active_support/core_ext/class"
require "active_support/core_ext/module"
module Lumber
@@ -17,10 +25,10 @@
#
# All config options get passed through to the log4r
# configurator for use in defining outputters
#
def self.init(opts = {})
- opts[:root] ||= RAILS_ROOT if defined?(RAILS_ROOT)
+ opts[:root] ||= RAILS_ROOT.to_s if defined?(RAILS_ROOT)
opts[:env] ||= RAILS_ENV if defined?(RAILS_ENV)
opts[:config_file] ||= "#{opts[:root]}/config/log4r.yml"
opts[:log_file] ||= "#{opts[:root]}/log/#{opts[:env]}.log"
raise "Lumber.init missing one of :root, :env" unless opts[:root] && opts[:env]
\ No newline at end of file