daengine 0.4.6.2 → 0.4.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -183,6 +183,9 @@ class DigitalAsset::Document
183
183
  field :pages, type: Integer, default: 1
184
184
  field :size, type: String
185
185
  field :mime_type, type: String
186
+ field :subject, type: String
187
+ field :keywords, type: Array, default: []
188
+ field :author, type: String
186
189
 
187
190
  embedded_in :digital_asset
188
191
 
data/lib/daengine.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "daengine/version"
2
2
  require 'daengine/engine'
3
+ require 'daengine/railtie' if defined?(Rails)
3
4
  require File.expand_path('../../app/models/digital_asset',__FILE__)
4
5
  require File.expand_path('../../app/models/taxonomy_term',__FILE__)
5
6
  require File.expand_path('../../app/models/content_service_resource',__FILE__)
@@ -0,0 +1,12 @@
1
+ require 'daengine'
2
+ require 'rails'
3
+
4
+ module Daengine
5
+ class Railtie < Rails::Railtie
6
+ railtie_name :daengine
7
+
8
+ rake_tasks do
9
+ load "lib/tasks/daengine_tasks.rake"
10
+ end
11
+ end
12
+ end
@@ -148,20 +148,30 @@ module Daengine::TeamsiteMetadataParser
148
148
  doc['pages'] = pages
149
149
  doc['size'] = exifdata.filesize
150
150
  doc['mime_type'] = exifdata.mimetype
151
+ doc['keywords'] = exifdata.keywords.gsub(';', ',').gsub(':', ',').split(",") unless exifdata.keywords.nil?
152
+ if exifdata.description.is_a? Enumerable
153
+ doc['subject'] = exifdata.description.join(" ") unless exifdata.description.nil?
154
+ else
155
+ doc['subject'] = exifdata.description.gsub(':', '') unless exifdata.description.nil?
156
+ end
157
+ doc['author'] = exifdata.author
151
158
  Daengine.log "Exif data for #{file} was pages:#{doc['pages']}, size:#{doc['size']}", "info"
152
159
  rescue Exception => e
153
160
  Daengine.log "Error reading metadata from #{file} #{e.message}", "error"
154
161
  end
155
- elsif(existing_da && !existing_da.new?) # copy over the existing asset metadata
156
- existing_doc = existing_da.documents.where(path: doc['path'])[0]
157
- if(existing_doc)
158
- doc['pages'] = existing_doc.pages
159
- doc['size'] = existing_doc.size
160
- doc['mime_type'] = existing_doc.mime_type
161
- else
162
- Daengine.log "Unable to find document with path #{file} on existing asset #{existing_da.guid} title: #{existing_da.title}", "info"
163
- end
164
- Daengine.log "Saving existing pages #{existing_doc.pages} and size #{existing_doc.size} on #{file}", "info"
162
+ elsif (existing_da && !existing_da.new?) # copy over the existing asset metadata
163
+ existing_doc = existing_da.documents.where(path: doc['path'])[0]
164
+ if (existing_doc)
165
+ doc['pages'] = existing_doc.pages
166
+ doc['size'] = existing_doc.size
167
+ doc['mime_type'] = existing_doc.mime_type
168
+ doc['keywords'] = existing_doc.keywords
169
+ doc['subject'] = existing_doc.subject
170
+ doc['author'] = existing_doc.author
171
+ else
172
+ Daengine.log "Unable to find document with path #{file} on existing asset #{existing_da.guid} title: #{existing_da.title}", "info"
173
+ end
174
+ Daengine.log "Saving existing pages #{existing_doc.pages} and size #{existing_doc.size} on #{file}", "info"
165
175
  end
166
176
  else
167
177
  # the file was missing on disk, show a warning!
@@ -1,3 +1,3 @@
1
1
  module Daengine
2
- VERSION = "0.4.6.2"
2
+ VERSION = "0.4.6.3"
3
3
  end
@@ -2,3 +2,13 @@
2
2
  # task :daengine do
3
3
  # # Task goes here
4
4
  # end
5
+
6
+
7
+ namespace :digital_asset do
8
+ task seed: :environment do
9
+ desc 'Seeding digital asset in database'
10
+
11
+ puts 'Seeding digital asset in database complete'
12
+ end
13
+ end
14
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: daengine
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.6.2
5
+ version: 0.4.6.3
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: 2013-01-30 00:00:00.000000000Z
13
+ date: 2013-02-07 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -102,6 +102,7 @@ files:
102
102
  - lib/daengine/content_service_processor.rb
103
103
  - lib/daengine/digital_asset_processor.rb
104
104
  - lib/daengine/engine.rb
105
+ - lib/daengine/railtie.rb
105
106
  - lib/daengine/taxonomy_parser.rb
106
107
  - lib/daengine/taxonomy_processor.rb
107
108
  - lib/daengine/teamsite_metadata_parser.rb