assembly-objectfile 1.8.4 → 1.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +8 -1
- data/.rubocop.yml +122 -0
- data/.rubocop_todo.yml +36 -38
- data/README.md +1 -1
- data/assembly-objectfile.gemspec +4 -1
- data/config/boot.rb +2 -2
- data/lib/assembly-objectfile.rb +7 -19
- data/lib/assembly-objectfile/content_metadata.rb +15 -17
- data/lib/assembly-objectfile/content_metadata/config.rb +3 -1
- data/lib/assembly-objectfile/content_metadata/file.rb +22 -2
- data/lib/assembly-objectfile/content_metadata/file_set.rb +7 -5
- data/lib/assembly-objectfile/content_metadata/file_set_builder.rb +4 -0
- data/lib/assembly-objectfile/content_metadata/nokogiri_builder.rb +2 -0
- data/lib/assembly-objectfile/object_file.rb +3 -3
- data/lib/assembly-objectfile/object_fileable.rb +49 -18
- data/lib/assembly-objectfile/version.rb +1 -1
- data/spec/content_metadata_spec.rb +748 -568
- data/spec/object_file_spec.rb +19 -0
- data/spec/spec_helper.rb +3 -1
- data/spec/test_data/input/test.json +1 -0
- metadata +28 -12
data/spec/object_file_spec.rb
CHANGED
@@ -25,6 +25,8 @@ describe Assembly::ObjectFile do
|
|
25
25
|
expect(@ai.exif).not_to be nil
|
26
26
|
expect(@ai.mimetype).to eq('image/tiff')
|
27
27
|
expect(@ai.file_mimetype).to eq('image/tiff')
|
28
|
+
expect(@ai.extension_mimetype).to eq('image/tiff')
|
29
|
+
expect(@ai.exif_mimetype).to eq('image/tiff')
|
28
30
|
expect(@ai.object_type).to eq(:image)
|
29
31
|
expect(@ai.valid_image?).to eq(true)
|
30
32
|
expect(@ai.jp2able?).to eq(true)
|
@@ -53,11 +55,28 @@ describe Assembly::ObjectFile do
|
|
53
55
|
expect(@ai.mimetype).to eq('text/plain')
|
54
56
|
end
|
55
57
|
|
58
|
+
it 'sets a mimetype of application/x-tgif for .obj 3d files if we prefer the mimetype extension gem over unix file system command' do
|
59
|
+
@ai = described_class.new(TEST_OBJ_FILE, mime_type_order: %i[extension file exif])
|
60
|
+
expect(@ai.mimetype).to eq('application/x-tgif')
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'ignores invald mimetype generation methods and still sets a mimetype of application/x-tgif for .obj 3d files if we prefer the mimetype extension gem over unix file system command' do
|
64
|
+
@ai = described_class.new(TEST_OBJ_FILE, mime_type_order: %i[bogus extension file])
|
65
|
+
expect(@ai.mimetype).to eq('application/x-tgif')
|
66
|
+
end
|
67
|
+
|
56
68
|
it 'sets the correct mimetype of plain/text for .ply 3d files' do
|
57
69
|
@ai = described_class.new(TEST_PLY_FILE)
|
58
70
|
expect(@ai.mimetype).to eq('text/plain')
|
59
71
|
end
|
60
72
|
|
73
|
+
it 'overrides the mimetype generators and uses the manual mapping to set the correct mimetype of application/json for a .json file' do
|
74
|
+
@ai = described_class.new(TEST_JSON_FILE)
|
75
|
+
expect(@ai.exif_mimetype).to be_nil # exif returns nil
|
76
|
+
expect(@ai.file_mimetype).to eq('text/plain') # unix file system command returns plain text
|
77
|
+
expect(@ai.mimetype).to eq('application/json') # but our configured mapping overrides both and returns application/json
|
78
|
+
end
|
79
|
+
|
61
80
|
it 'sets the correct mimetype of image/tiff for .tif files' do
|
62
81
|
@ai = described_class.new(TEST_TIF_INPUT_FILE)
|
63
82
|
expect(@ai.mimetype).to eq('image/tiff')
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'simplecov'
|
4
4
|
SimpleCov.start
|
5
5
|
|
6
|
-
bootfile = File.expand_path(File.dirname(__FILE__)
|
6
|
+
bootfile = File.expand_path("#{File.dirname(__FILE__)}/../config/boot")
|
7
7
|
require bootfile
|
8
8
|
|
9
9
|
RSpec.configure do |config|
|
@@ -54,6 +54,8 @@ TEST_RES3_TEI = File.join(TEST_INPUT_DIR, 'res3_teifile.txt')
|
|
54
54
|
|
55
55
|
TEST_FILE_NO_EXIF = File.join(TEST_INPUT_DIR, 'file_with_no_exif.xml')
|
56
56
|
|
57
|
+
TEST_JSON_FILE = File.join(TEST_INPUT_DIR, 'test.json')
|
58
|
+
|
57
59
|
TEST_OBJ_FILE = File.join(TEST_INPUT_DIR, 'someobject.obj')
|
58
60
|
TEST_PLY_FILE = File.join(TEST_INPUT_DIR, 'someobject.ply')
|
59
61
|
|
@@ -0,0 +1 @@
|
|
1
|
+
{some: 'thing'}
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assembly-objectfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Mangiafico
|
8
8
|
- Renzo Sanchez-Silva
|
9
9
|
- Monty Hindman
|
10
10
|
- Tony Calavano
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -27,6 +27,20 @@ dependencies:
|
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 5.2.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: deprecation
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
30
44
|
- !ruby/object:Gem::Dependency
|
31
45
|
name: dry-struct
|
32
46
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,16 +185,16 @@ dependencies:
|
|
171
185
|
name: simplecov
|
172
186
|
requirement: !ruby/object:Gem::Requirement
|
173
187
|
requirements:
|
174
|
-
- - "
|
188
|
+
- - "~>"
|
175
189
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
190
|
+
version: 0.17.0
|
177
191
|
type: :development
|
178
192
|
prerelease: false
|
179
193
|
version_requirements: !ruby/object:Gem::Requirement
|
180
194
|
requirements:
|
181
|
-
- - "
|
195
|
+
- - "~>"
|
182
196
|
- !ruby/object:Gem::Version
|
183
|
-
version:
|
197
|
+
version: 0.17.0
|
184
198
|
description: Get exif data, file sizes and more.
|
185
199
|
email:
|
186
200
|
- pmangiafico@stanford.edu
|
@@ -249,6 +263,7 @@ files:
|
|
249
263
|
- spec/test_data/input/someobject.obj
|
250
264
|
- spec/test_data/input/someobject.ply
|
251
265
|
- spec/test_data/input/test.jp2
|
266
|
+
- spec/test_data/input/test.json
|
252
267
|
- spec/test_data/input/test.pdf
|
253
268
|
- spec/test_data/input/test.tif
|
254
269
|
- spec/test_data/input/test2.jp2
|
@@ -258,23 +273,23 @@ homepage: https://github.com/sul-dlss/assembly-objectfile
|
|
258
273
|
licenses:
|
259
274
|
- ALv2
|
260
275
|
metadata: {}
|
261
|
-
post_install_message:
|
276
|
+
post_install_message:
|
262
277
|
rdoc_options: []
|
263
278
|
require_paths:
|
264
279
|
- lib
|
265
280
|
required_ruby_version: !ruby/object:Gem::Requirement
|
266
281
|
requirements:
|
267
|
-
- - "
|
282
|
+
- - "~>"
|
268
283
|
- !ruby/object:Gem::Version
|
269
|
-
version: '
|
284
|
+
version: '2.5'
|
270
285
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
286
|
requirements:
|
272
287
|
- - ">="
|
273
288
|
- !ruby/object:Gem::Version
|
274
289
|
version: '0'
|
275
290
|
requirements: []
|
276
|
-
rubygems_version: 3.
|
277
|
-
signing_key:
|
291
|
+
rubygems_version: 3.2.16
|
292
|
+
signing_key:
|
278
293
|
specification_version: 4
|
279
294
|
summary: Ruby immplementation of file services needed to prepare objects to be accessioned
|
280
295
|
in SULAIR digital library
|
@@ -312,6 +327,7 @@ test_files:
|
|
312
327
|
- spec/test_data/input/someobject.obj
|
313
328
|
- spec/test_data/input/someobject.ply
|
314
329
|
- spec/test_data/input/test.jp2
|
330
|
+
- spec/test_data/input/test.json
|
315
331
|
- spec/test_data/input/test.pdf
|
316
332
|
- spec/test_data/input/test.tif
|
317
333
|
- spec/test_data/input/test2.jp2
|