lib/daengine/teamsite_metadata_parser.rb in daengine-0.4.7.9 vs lib/daengine/teamsite_metadata_parser.rb in daengine-0.4.8
- old
+ new
@@ -4,11 +4,10 @@
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',
@@ -65,21 +64,17 @@
asset = nil; docpath = {}; valid = true;
end
when /<tuple-field name="([^"]+)">([^<]+)<\/tuple-field>/
if (valid)
if @@validations[$1]
- valid = @@validations[$1].call($2.presence)
+ valid = @@validations[$1].call($2)
end
if @@path_tuples[$1]
- docpath[@@path_tuples[$1]] = $2.presence # if this is one of our keys, 'send' to the method
+ docpath[@@path_tuples[$1]] = $2 # if this is one of our keys, 'send' to the method
elsif (@@translation[$1])
- if($1 == 'TeamSite/Metadata/web_title')
- asset.title ||= $2.presence
- else
- val = asset.send("#{@@translation[$1]}").is_a?(Array) ? $2.split(',') : $2.presence
- asset.send("#{@@translation[$1]}=", val)
- end
+ val = asset.send("#{@@translation[$1]}").respond_to?(:[]) ? $2.split(',') : $2
+ asset.send("#{@@translation[$1]}=", val)
end
end
end
end
# loop thru each doc in the collection, either replace or delete it
@@ -136,10 +131,11 @@
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)) # try with just filename
+ if(!File.exist?(file)) # try with just the filename
+ #Daengine.log "Cant find file #{file}, trying with just the path and filename", "info"
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