lib/daengine/teamsite_metadata_parser.rb in daengine-0.4.7.5 vs lib/daengine/teamsite_metadata_parser.rb in daengine-0.4.7.6

- old
+ new

@@ -4,10 +4,11 @@ module Daengine::TeamsiteMetadataParser @@translation = { 'TeamSite/Metadata/web_title' => 'title', + 'TeamSite/Metadata/homepageTitle' => 'title', "TeamSite/Metadata/enterprise_last_updated_date"=> 'changed_at', "TeamSite/Metadata/enterprise_audience_id"=> 'audiences', "TeamSite/Metadata/enterprise_sami_desc"=> 'sami_code', "TeamSite/Metadata/enterprise_last_publication_date"=> 'published_at', "TeamSite/Metadata/enterprise_unpublish_date"=> 'unpublished_at', @@ -64,17 +65,21 @@ asset = nil; docpath = {}; valid = true; end when /<tuple-field name="([^"]+)">([^<]+)<\/tuple-field>/ if (valid) if @@validations[$1] - valid = @@validations[$1].call($2) + valid = @@validations[$1].call($2.presence) end if @@path_tuples[$1] - docpath[@@path_tuples[$1]] = $2 # if this is one of our keys, 'send' to the method + docpath[@@path_tuples[$1]] = $2.presence # if this is one of our keys, 'send' to the method elsif (@@translation[$1]) - val = asset.send("#{@@translation[$1]}").respond_to?(:[]) ? $2.split(',') : $2 - asset.send("#{@@translation[$1]}=", val) + if($1 == 'TeamSite/Metadata/web_title') + asset.title ||= $2.presence + else + val = asset.send("#{@@translation[$1]}").respond_to?(:[]) ? $2.split(',') : $2.presence + asset.send("#{@@translation[$1]}=", val) + end end end end end # loop thru each doc in the collection, either replace or delete it @@ -131,12 +136,10 @@ if Dir.exist?(path) # dont throw away assets if we can't locate the dir asset_docs.each do |doc| #exclude manifest_file unless doc['path'].match('\/manifest\/') file = File.join(path, doc['path']) - if(!File.exist?(file)) - # use just the filename - Daengine.log "Cant find file #{file}, trying with just the path and filename", "info" + if(!File.exist?(file)) # try with just filename file = File.join(path, doc['path'].split('/').last) end #exclude digital_asset_files that are not in *Teamsite Staging* if File.exist?(file) docs << doc \ No newline at end of file