lib/daengine.rb in daengine-0.2.1 vs lib/daengine.rb in daengine-0.2.2

- old
+ new

@@ -1,22 +1,27 @@ require "daengine/version" require 'daengine/engine' require File.expand_path('../../app/models/digital_asset',__FILE__) +require File.expand_path('../../app/models/taxonomy_term',__FILE__) require 'daengine/teamsite_metadata_parser' require 'daengine/digital_asset_processor' +require 'daengine/taxonomy_parser' +require 'daengine/taxonomy_processor' require 'mongoid' require 'logger' +require 'nokogiri' module Daengine - @logger = "/logs/daengine.log" + @logger = Logger.new("/logs/daengine.log") @config = { - :assets_path => '/digital-assets' + :assets_path => '/digital-assets', + :taxonomy_xml_filepath => '/taxonomy.xml' } @mongoid_config = { - 'database' => 'ssc_assets', # mongoid database name + 'database' => 'ssc_assets_test', # mongoid database name 'host' => nil, # mongoid server 'port' => nil, # mongodb server port 'hosts' => nil } @@ -56,9 +61,21 @@ self.set_logger() self.log("Daengine: ### Loading application config ###", "info") config_options.each { |key, value| self.log("CONFIG #{key}\t#{value}", "info")} begin DigitalAssetProcessor.process_tuple_directory # start the thread daemon + rescue Exception => e + self.log(e.message, "error") + end + end + + def self.execute_taxonomy(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")} + begin + TaxonomyProcessor.process_taxonomy_file rescue Exception => e self.log(e.message, "error") end end