assembly-objectfile 2.1.2 → 2.1.3
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 +4 -4
- data/Gemfile.lock +5 -5
- data/lib/assembly/object_file/version.rb +1 -1
- data/lib/assembly/object_file.rb +8 -3
- data/spec/assembly/object_file_spec.rb +24 -17
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6743d03c8c75529ad425586ed16bece4858c1fd2394342918ab29c568199d4f7
|
4
|
+
data.tar.gz: 16a79c4115124aae1402f1651076a85eb58912b4309f5a7503536246cd55076f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f08d614455304c1d7c935bc5e69ca85400493b8ba4bb045d048dc519c5a78f401d2d7e1a62292a8048cc0e9b83bdd0bc3f9fa540e8021356f9929ba3ec72ef37
|
7
|
+
data.tar.gz: 2340e0deff59c7e913272c6c18ce6f27513d2b1777e7d7da9120a4b3377f00c80ae2c59e31c3c29769ae763dc2cc4888b3bbdc76ce75f6962b81b2de713d4551
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
assembly-objectfile (2.1.
|
4
|
+
assembly-objectfile (2.1.3)
|
5
5
|
activesupport (>= 5.2.0)
|
6
6
|
mime-types (> 3)
|
7
7
|
mini_exiftool
|
@@ -32,12 +32,12 @@ GEM
|
|
32
32
|
parallel (1.22.1)
|
33
33
|
parser (3.1.2.1)
|
34
34
|
ast (~> 2.4.1)
|
35
|
-
pry (0.
|
35
|
+
pry (0.14.1)
|
36
36
|
coderay (~> 1.1)
|
37
37
|
method_source (~> 1.0)
|
38
|
-
pry-byebug (3.
|
38
|
+
pry-byebug (3.10.1)
|
39
39
|
byebug (~> 11.0)
|
40
|
-
pry (
|
40
|
+
pry (>= 0.13, < 0.15)
|
41
41
|
rainbow (3.1.1)
|
42
42
|
rake (13.0.6)
|
43
43
|
regexp_parser (2.5.0)
|
@@ -55,7 +55,7 @@ GEM
|
|
55
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
56
56
|
rspec-support (~> 3.11.0)
|
57
57
|
rspec-support (3.11.0)
|
58
|
-
rubocop (1.35.
|
58
|
+
rubocop (1.35.1)
|
59
59
|
json (~> 2.3)
|
60
60
|
parallel (~> 1.10)
|
61
61
|
parser (>= 3.1.2.1)
|
data/lib/assembly/object_file.rb
CHANGED
@@ -121,12 +121,17 @@ module Assembly
|
|
121
121
|
lookup.nil? ? :other : lookup.media_type.to_sym
|
122
122
|
end
|
123
123
|
|
124
|
-
# @return [Boolean] true if the mime-types gem recognizes it as an image
|
124
|
+
# @return [Boolean] true if the mime-types gem recognizes it as an image
|
125
125
|
def image?
|
126
|
-
object_type
|
126
|
+
return false if object_type != :image
|
127
|
+
|
128
|
+
# We exclude TARGA images here because we've seen where the file is a disk image and
|
129
|
+
# when we look for a mime type it is `image/x-tga', however it is not
|
130
|
+
# recognizable by exiftool. See https://github.com/sul-dlss/assembly-objectfile/issues/98
|
131
|
+
mimetype != 'image/x-tga'
|
127
132
|
end
|
128
133
|
|
129
|
-
# @return [Boolean] true if the mime-types gem recognizes it as an image
|
134
|
+
# @return [Boolean] true if the mime-types gem recognizes it as an image
|
130
135
|
# AND it is a jp2 or jp2able?
|
131
136
|
def valid_image?
|
132
137
|
return false unless image?
|
@@ -97,34 +97,41 @@ describe Assembly::ObjectFile do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
describe '#image?' do
|
100
|
+
subject { object_file.image? }
|
101
|
+
|
100
102
|
context 'with tiff' do
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
end
|
103
|
+
let(:object_file) { described_class.new(TEST_TIF_INPUT_FILE) }
|
104
|
+
|
105
|
+
it { is_expected.to be true }
|
105
106
|
end
|
106
107
|
|
107
108
|
context 'with jp2' do
|
108
|
-
|
109
|
-
|
110
|
-
|
109
|
+
let(:object_file) { described_class.new(TEST_JP2_INPUT_FILE) }
|
110
|
+
|
111
|
+
it { is_expected.to be true }
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'with targa file' do
|
115
|
+
before do
|
116
|
+
allow(object_file).to receive(:exif_mimetype).and_return(nil)
|
117
|
+
allow(object_file).to receive(:file_mimetype).and_return('image/x-tga')
|
111
118
|
end
|
119
|
+
|
120
|
+
let(:object_file) { described_class.new(TEST_JP2_INPUT_FILE) }
|
121
|
+
|
122
|
+
it { is_expected.to be false }
|
112
123
|
end
|
113
124
|
|
114
125
|
context 'with ruby file' do
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
expect(object_file.image?).to be(false)
|
119
|
-
end
|
126
|
+
let(:object_file) { described_class.new(File.join(PATH_TO_GEM, 'spec/assembly/object_file_spec.rb')) }
|
127
|
+
|
128
|
+
it { is_expected.to be false }
|
120
129
|
end
|
121
130
|
|
122
131
|
context 'with xml' do
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
expect(object_file.image?).to be(false)
|
127
|
-
end
|
132
|
+
let(:object_file) { described_class.new(File.join(PATH_TO_GEM, 'spec/test_data/input/file_with_no_exif.xml')) }
|
133
|
+
|
134
|
+
it { is_expected.to be false }
|
128
135
|
end
|
129
136
|
end
|
130
137
|
|
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: 2.1.
|
4
|
+
version: 2.1.3
|
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: 2022-08-
|
14
|
+
date: 2022-08-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: '0'
|
201
201
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
202
|
+
rubygems_version: 3.2.32
|
203
203
|
signing_key:
|
204
204
|
specification_version: 4
|
205
205
|
summary: Ruby implementation of file services needed to prepare objects to be accessioned
|