Module: Daengine
- Defined in:
- lib/daengine.rb,
lib/daengine/engine.rb,
lib/daengine/version.rb,
lib/daengine/taxonomy_processor.rb,
lib/daengine/digital_asset_processor.rb,
lib/daengine/content_service_processor.rb
Defined Under Namespace
Modules: TaxonomyParser, TeamsiteMetadataParser
Classes: ContentServiceProcessor, DigitalAssetProcessor, Engine, TaxonomyProcessor
Constant Summary
collapse
- VERSION =
"0.3.7.2"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
59
60
61
|
# File 'lib/daengine.rb', line 59
def self.config
@config
end
|
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/daengine.rb', line 48
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
|
.execute(config_options) ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/daengine.rb', line 63
def self.execute(config_options)
self.configure(config_options)
self.set_logger(config[:logfile_location])
self.log("Daengine: ### Loading application config ###", "info")
config_options.each { |key, value| self.log("CONFIG #{key}\t#{value}", "info")}
begin
DigitalAssetProcessor.process_tuple_directory rescue Exception => e
self.log(e.message, "error")
end
end
|
.execute_content_service(config_options) ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/daengine.rb', line 87
def self.execute_content_service(config_options)
self.configure(config_options)
self.set_logger(config[:content_service_logfile_location])
self.log("Daengine: ### Loading application config ###", "info")
config_options.each { |key, value| self.log("CONFIG #{key}\t#{value}", "info")}
begin
ContentServiceProcessor.process_orderable
rescue Exception => e
self.log(e.message, "error")
end
end
|
.execute_taxonomy(config_options) ⇒ Object
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/daengine.rb', line 75
def self.execute_taxonomy(config_options)
self.configure(config_options)
self.set_logger(config[:taxonomyengine_logfile_location])
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
|
.log(message, level) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/daengine.rb', line 34
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
|
.logger ⇒ Object
103
104
105
|
# File 'lib/daengine.rb', line 103
def self.logger
@logger
end
|
.set_logger(logfile) ⇒ Object
99
100
101
|
# File 'lib/daengine.rb', line 99
def self.set_logger(logfile)
@logger = Logger.new(logfile, 'daily')
end
|