Sha256: dceb73331773b046d9de453e9ed3b5e29bbfba8db6d0f0b37c81b74adae47a08
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
require "daengine/version" require 'daengine/engine' require File.expand_path('../../app/models/digital_asset',__FILE__) require 'daengine/teamsite_metadata_parser' require 'daengine/digital_asset_processor' require 'mongoid' require 'logger' module Daengine @logger = "/logs/daengine.log" @config = { :assets_path => '/digital-assets' } @mongoid_config = { 'database' => 'ssc_assets', # mongoid database name 'host' => nil, # mongoid server 'port' => nil, # mongodb server port 'hosts' => nil } @valid_mongoid_keys = @mongoid_config.keys def self.log(message, level) message = "[#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}] #{message}" puts "#{message}" case level when "warn" @logger.warn "#{message}" when "error" @logger.error "#{message}" else @logger.info "#{message}" end end # yaml file config def self.configure(config_options) config_options.each {|k,v| @config[k.to_sym] = v} config_options.each {|k,v| @mongoid_config[k] = v if @valid_mongoid_keys.include? k } @mongoid_config.delete_if { |k,v| ! v } Mongoid.configure do |config| config.from_hash(@mongoid_config) end end def self.config @config end def self.execute(config_options) self.configure(config_options) self.set_logger() self.log("Daengine: ### Loading application config ###", "info") config_options.each { |key, value| self.log("CONFIG #{key}\t#{value}", "info")} return DigitalAssetProcessor.process_tuple_directory # start the thread daemon end def self.set_logger logfile = self.config[:logfile_location] @logger = Logger.new(logfile, 'daily') end def self.logger @logger end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
daengine-0.1.3 | lib/daengine.rb |