daengine 0.3.8.3 → 0.3.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/daengine.rb CHANGED
@@ -77,11 +77,11 @@ module Daengine
77
77
  self.set_logger(config[:taxonomyengine_logfile_location])
78
78
  self.log("Daengine: ### Loading application config ###", "info")
79
79
  config_options.each { |key, value| self.log("CONFIG #{key}\t#{value}", "info")}
80
- begin
80
+ # begin
81
81
  TaxonomyProcessor.process_taxonomy_file
82
- rescue Exception => e
83
- self.log(e.message, "error")
84
- end
82
+ # rescue Exception => e
83
+ # self.log(e.message, "error")
84
+ # end
85
85
  end
86
86
 
87
87
  def self.execute_content_service(config_options)
@@ -15,21 +15,16 @@ module Daengine::TaxonomyParser
15
15
  def self.parse_taxonomy_file(file)
16
16
  @error_msg=[]
17
17
  time do
18
- begin
19
- doc = Nokogiri::XML(file) { |config| config.strict }
20
- rescue Nokogiri::XML::SyntaxError => e
21
- raise "ERROR: TaxonomyProcessor: XML parse error :: #{e}"
22
- end
23
- TaxonomyTerm.purge!
24
- doc.xpath('//taxonomy/facet').map do |i|
18
+ doc = Nokogiri::XML(file) { |config| config.strict }
19
+
20
+ TaxonomyTerm.purge! if doc.xpath('//taxonomy/facet')
21
+ doc.xpath('//taxonomy/facet').each do |i|
25
22
  parse_taxonomy_term(i)
26
23
  end
27
- log_txt = "Failed to save/update following Taxonomy terms in database:\n"
28
- @error_msg.each do |taxonomy_term|
29
- log_txt = log_txt + "> #{taxonomy_term}\n"
30
- end
31
- Daengine.log(log_txt, "warn") if !@error_msg.empty?
32
24
  end
25
+ # rescue
26
+ # p "ERROR! Unable to parse / update taxonomy file! #{$!.backtrace.join('\n')}"
27
+ # Daengine.log($!.backtrace.join('\n'), "error")
33
28
  end
34
29
 
35
30
  def self.parse_taxonomy_term(entity)
@@ -41,20 +36,18 @@ module Daengine::TaxonomyParser
41
36
  a_text = entity.xpath('altname').inner_html
42
37
  category.term_type = {alternate_name[0].value => a_text}
43
38
  end
44
- my_terms = entity.xpath('term').map
45
- unless my_terms.nil?
46
- entity.xpath('term').map do |j|
47
- a_term = parse_taxonomy_term(j)
48
- a_term.parent_term = category
49
- category.child_terms << a_term
50
- end
39
+ entity.xpath('term').each do |j|
40
+ a_term = parse_taxonomy_term(j)
41
+ a_term.parent_term = category
42
+ category.child_terms << a_term
51
43
  end
52
- begin
44
+ # end
45
+ # begin
53
46
  category.save!
54
- rescue Exception => e
47
+ # rescue Exception => e
55
48
  #puts "--**Exception**-- #{e}"
56
- p "Failed to add record #{category.try(:label)}, #{category.try(:errors).try(:full_messages)}"
57
- end
49
+ # p "Failed to add record #{category.try(:label)}, #{category.try(:errors).try(:full_messages)}"
50
+ # end
58
51
  category
59
52
  end
60
53
 
@@ -1,3 +1,3 @@
1
1
  module Daengine
2
- VERSION = "0.3.8.3"
2
+ VERSION = "0.3.8.4"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: daengine
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.8.3
5
+ version: 0.3.8.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - sbhatia
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-02 00:00:00.000000000Z
13
+ date: 2012-11-05 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails