summaryrefslogtreecommitdiff
path: root/lib/oxidized.rb
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2016-01-04 18:50:54 +0200
committerytti <saku@ytti.fi>2016-01-04 18:50:54 +0200
commit0eeba91b426c8b4a6335a88da9c65ba38e5fac15 (patch)
tree02ba46c4f7d43b5721f3eb7de38599e0e019e5cf /lib/oxidized.rb
parentf112dfa0c604ae1c990f6411a002806924c00bf3 (diff)
parente41f7b429901eb38ad785ad1fc2527dd41f35959 (diff)
Merge pull request #250 from Shopify/master0.10.0
refactoring, test coverage and github hook
Diffstat (limited to 'lib/oxidized.rb')
-rw-r--r--lib/oxidized.rb47
1 files changed, 45 insertions, 2 deletions
diff --git a/lib/oxidized.rb b/lib/oxidized.rb
index 61948ff..e92224a 100644
--- a/lib/oxidized.rb
+++ b/lib/oxidized.rb
@@ -1,6 +1,49 @@
module Oxidized
class OxidizedError < StandardError; end
- Encoding.default_external = 'UTF-8'
- Directory = File.expand_path File.join File.dirname(__FILE__), '../'
+
+ Directory = File.expand_path(File.join(File.dirname(__FILE__), '../'))
+
+ require 'oxidized/string'
+ require 'oxidized/config'
+ require 'oxidized/config/vars'
+ require 'oxidized/worker'
+ require 'oxidized/nodes'
+ require 'oxidized/manager'
+ require 'oxidized/hook'
require 'oxidized/core'
+
+ def self.asetus
+ @@asetus
+ end
+
+ def self.asetus=(val)
+ @@asetus = val
+ end
+
+ def self.config
+ asetus.cfg
+ end
+
+ def self.logger
+ @@logger
+ end
+
+ def self.logger=(val)
+ @@logger = val
+ end
+
+ def self.setup_logger
+ self.logger = if config.has_key?('use_syslog') && config.use_syslog
+ require 'syslog/logger'
+ Syslog::Logger.new('oxidized')
+ else
+ require 'logger'
+ if config.has_key?('log')
+ Logger.new(config.log)
+ else
+ Logger.new(STDERR)
+ end
+ end
+ logger.level = Logger::INFO unless config.debug
+ end
end