assembly-objectfile 1.6.8 → 1.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6dc0ea8319dd859ec9be81fd8f1f198c7cf4f9b
4
- data.tar.gz: 658c0a71e1d654e25ef96ed3d6f726ffc62fc032
3
+ metadata.gz: 525c02a47a00911d384772353e49b34f0e730f9a
4
+ data.tar.gz: 73656cb1be5cdbab3275bbaab9883b1a79598bc0
5
5
  SHA512:
6
- metadata.gz: a651a9d5ef31b219cc861189da4dccacb7d65072718fff634b27adc91e9f6475dc7d3f093f0624ab09e8f90ddb4253adaa52366eb81451fdc341a387a9551731
7
- data.tar.gz: f6daca5780f916a41a5d4b3f2890ba2432803bb852a0e24837041f5ce489dd06ebebde38caae6d636402653f0b67815f6820971fa35b5d51b4edb53a50e565dc
6
+ metadata.gz: aa7a37c0e0705c51de15c0d8b9500533e845eb9cb953acee0f88c63e3302445c1939cd13492c53c30c1aeff8776284d3baefe4c5ff5ff15a48a6f8e8f6c2ad8e
7
+ data.tar.gz: 23fe849cf5e4a54f939ecde806dd31db990c75ca5e3c4e159451db1c00276772f3803ba13325285dfe1d9859e32404ae0877cedd411d606b103ccbc71fdc5a32
data/README.rdoc CHANGED
@@ -1,3 +1,5 @@
1
+ {<img src="https://travis-ci.org/sul-dlss/assembly-objectfile.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/sul-dlss/assembly-objectfile]
2
+
1
3
  = Assembly-ObjectFile Gem
2
4
 
3
5
  ==Overview
@@ -67,6 +69,7 @@ content type specific operations (such as jp2 generation).
67
69
  - 1.6.3 Integrate with TravisCI
68
70
  - 1.6.4 Try and solve UTF-8 encoding issues with exif data in images
69
71
  - 1.6.5 Just use mime-types extension by default to compute mimetype to prevent calling to shell all the time (and avoid potential memory problems). A new method allows you to call out to shell if you really want to.
72
+ - 1.7.0 Support the `role` attribute on files
70
73
 
71
74
  ==Usage
72
75
 
@@ -108,4 +111,3 @@ To keep a local server running with up to date code documentation that you can v
108
111
 
109
112
  Mac users:
110
113
  brew install exiftool
111
-
@@ -2,9 +2,11 @@ require 'nokogiri'
2
2
 
3
3
  module Assembly
4
4
 
5
- SPECIAL_DPG_FOLDERS=['31','44','50'] # these special dpg folders will force any files contained in them into their own resources, regardless of filenaming convention
5
+ SPECIAL_DPG_FOLDERS = ['31', '44', '50'] # these special dpg folders will force any files contained in them into their own resources, regardless of filenaming convention
6
6
  # these are used when :bundle=>:dpg only
7
-
7
+
8
+ DEPRECATED_STYLES = [:book_with_pdf, :book_as_image]
9
+
8
10
  # This class generates content metadata for image files
9
11
  class ContentMetadata
10
12
 
@@ -20,8 +22,8 @@ module Assembly
20
22
  # :simple_image (default), contentMetadata type="image", resource type="image"
21
23
  # :file, contentMetadata type="file", resource type="file"
22
24
  # :simple_book, contentMetadata type="book", resource type="page", but any resource which has file(s) other than an image, and also contains no images at all, will be resource type="object"
23
- # :book_with_pdf, contentMetadata type="book", resource type="page", but any resource which has any file(s) other than an image will be resource type="object"
24
- # :book_as_image, as simple_book, but with contentMetadata type="book", resource type="image" (same rule applies for resources with non images)
25
+ # :book_with_pdf, contentMetadata type="book", resource type="page", but any resource which has any file(s) other than an image will be resource type="object" - NOTE: THIS IS DEPRECATED
26
+ # :book_as_image, as simple_book, but with contentMetadata type="book", resource type="image" (same rule applies for resources with non images) - NOTE: THIS IS DEPRECATED
25
27
  # :map, like simple_image, but with contentMetadata type="map", resource type="image"
26
28
  # :bundle = optional - a symbol containing the method of bundling files into resources, allowed values are
27
29
  # :default = all files get their own resources (default)
@@ -29,8 +31,8 @@ module Assembly
29
31
  # :dpg = files representing the same image but of different mimetype that use the SULAIR DPG filenaming standard (00 vs 05) get bundled together in a single resource
30
32
  # :prebundlded = this option requires you to prebundled the files passed in as an array of arrays, indicating how files are bundlded into resources; this is the most flexible option since it gives you full control
31
33
  # :add_exif = optional - a boolean to indicate if exif data should be added (mimetype, filesize, image height/width, etc.) to each file, defaults to false and is not required if project goes through assembly
32
- # :add_file_attributes = optional - a boolean to indicate if publish/preserve/shelve attributes should be added using defaults or by supplied override by mime/type, defaults to false and is not required if project goes through assembly
33
- # :file_attributes = optional - a hash of file attributes by mimetype to use instead of defaults, only used if add_file_attributes is also true,
34
+ # :add_file_attributes = optional - a boolean to indicate if publish/preserve/shelve/role attributes should be added using defaults or by supplied override by mime/type, defaults to false and is not required if project goes through assembly
35
+ # :file_attributes = optional - a hash of file attributes by mimetype to use instead of defaults, only used if add_file_attributes is also true,
34
36
  # If a mimetype match is not found in your hash, the default is used (either your supplied default or the gems).
35
37
  # e.g. {'default'=>{:preserve=>'yes',:shelve=>'yes',:publish=>'yes'},'image/tif'=>{:preserve=>'yes',:shelve=>'no',:publish=>'no'},'application/pdf'=>{:preserve=>'yes',:shelve=>'yes',:publish=>'yes'}}
36
38
  # :include_root_xml = optional - a boolean to indicate if the contentMetadata returned includes a root <?xml version="1.0"?> tag, defaults to true
@@ -41,7 +43,7 @@ module Assembly
41
43
  # The default is false. If set to true, will override the "preserve_common_paths" parameter.
42
44
  # :auto_labels = optional - Will add automated resource labels (e.g. "File 1") when labels are not provided by the user. The default is true.
43
45
  # Example:
44
- # Assembly::Image.create_content_metadata(:druid=>'druid:nx288wh8889',:style=>:simple_image,:objects=>object_files,:add_file_attributes=>false)
46
+ # Assembly::ContentMetadata.create_content_metadata(:druid=>'druid:nx288wh8889',:style=>:simple_image,:objects=>object_files,:add_file_attributes=>false)
45
47
  def self.create_content_metadata(params={})
46
48
 
47
49
  druid=params[:druid]
@@ -93,6 +95,7 @@ module Assembly
93
95
  raise "Supplied style not valid"
94
96
  end
95
97
 
98
+ puts "WARNING - the style #{style} is now deprecated and should not be used." if DEPRECATED_STYLES.include? style
96
99
 
97
100
  # determine how many resources to create
98
101
  # setup an array of arrays, where the first array is the number of resources, and the second array is the object files containined in that resource
@@ -188,6 +191,7 @@ module Assembly
188
191
  :preserve => file_attributes_hash[:preserve],
189
192
  :publish => file_attributes_hash[:publish],
190
193
  :shelve => file_attributes_hash[:shelve],
194
+ :role => file_attributes_hash[:role],
191
195
  })
192
196
  end
193
197
 
@@ -3,7 +3,7 @@ module Assembly
3
3
 
4
4
  class ObjectFile
5
5
  # Project version number
6
- VERSION = "1.6.8"
6
+ VERSION = "1.7.0"
7
7
  end
8
8
 
9
9
  end
@@ -551,6 +551,23 @@ describe Assembly::ContentMetadata do
551
551
  end
552
552
  end
553
553
 
554
+ it "should generate role attributes for content metadata for a tif" do
555
+ obj1=Assembly::ObjectFile.new(TEST_TIF_INPUT_FILE)
556
+ obj1.file_attributes={:publish=>'no',:preserve=>'no',:shelve=>'no',:role=>'master-role'}
557
+ objects=[obj1]
558
+ result = Assembly::ContentMetadata.create_content_metadata(:druid=>TEST_DRUID,:add_exif=>false,:add_file_attributes=>true,:objects=>objects)
559
+ expect(result.class).to be String
560
+ xml = Nokogiri::XML(result)
561
+ expect(xml.errors.size).to be 0
562
+ expect(xml.xpath("//contentMetadata")[0].attributes['type'].value).to eq("image")
563
+ expect(xml.xpath("//resource").length).to be 1
564
+ expect(xml.xpath("//resource/file").length).to be 1
565
+ expect(xml.xpath("//resource/file").length).to be 1
566
+ expect(xml.xpath("//resource/file")[0].attributes['role'].value).to eq("master-role")
567
+ end
568
+
569
+
570
+
554
571
  it "should generate content metadata even when no objects are passed in" do
555
572
  objects=[]
556
573
  result = Assembly::ContentMetadata.create_content_metadata(:druid=>TEST_DRUID,:bundle=>:prebundled,:style=>:file,:objects=>objects)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assembly-objectfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.8
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mangiafico
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2016-11-11 00:00:00.000000000 Z
14
+ date: 2018-02-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: mini_exiftool
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  version: '0'
194
194
  requirements: []
195
195
  rubyforge_project: assembly-objectfile
196
- rubygems_version: 2.6.7
196
+ rubygems_version: 2.6.11
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Ruby immplementation of file services needed to prepare objects to be accessioned
@@ -235,4 +235,3 @@ test_files:
235
235
  - spec/test_data/input/test2.jp2
236
236
  - spec/test_data/input/test2.tif
237
237
  - spec/test_data/input/test_no_color_profile.tif
238
- has_rdoc: