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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0931aac97a88ba77ac0cfa8ff018d19fddcfe909c81cd82e9dfc13dca12ed4f4'
4
- data.tar.gz: 4eb596c2799586b3298cd1019be16606b4a371a175c4630b1ac826296dacb5bb
3
+ metadata.gz: 6743d03c8c75529ad425586ed16bece4858c1fd2394342918ab29c568199d4f7
4
+ data.tar.gz: 16a79c4115124aae1402f1651076a85eb58912b4309f5a7503536246cd55076f
5
5
  SHA512:
6
- metadata.gz: a252cfc25b6e2a11f50a6eb2976997fdcbf387ba3855fbca03d188a2f7e9572ca1a3ed605da191700551e34a685deb9dec810e63dfbff59bf9bfd09f6a6a9504
7
- data.tar.gz: db0fdbf6583455bce118aa14bc29692d90fbb35c1e9746f3748548094ff53e0f33fe79c08cf5baace3869a08e4f9e3080d1906b810ce38d64022efa573e8c500
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.2)
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.13.1)
35
+ pry (0.14.1)
36
36
  coderay (~> 1.1)
37
37
  method_source (~> 1.0)
38
- pry-byebug (3.9.0)
38
+ pry-byebug (3.10.1)
39
39
  byebug (~> 11.0)
40
- pry (~> 0.13.0)
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.0)
58
+ rubocop (1.35.1)
59
59
  json (~> 2.3)
60
60
  parallel (~> 1.10)
61
61
  parser (>= 3.1.2.1)
@@ -4,6 +4,6 @@
4
4
  module Assembly
5
5
  class ObjectFile
6
6
  # Gem version
7
- VERSION = '2.1.2'
7
+ VERSION = '2.1.3'
8
8
  end
9
9
  end
@@ -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 (from file extension lookup)
124
+ # @return [Boolean] true if the mime-types gem recognizes it as an image
125
125
  def image?
126
- object_type == :image
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 (from file extension lookup)
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
- it 'true' do
102
- object_file = described_class.new(TEST_TIF_INPUT_FILE)
103
- expect(object_file.image?).to be(true)
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
- it 'true' do
109
- object_file = described_class.new(TEST_JP2_INPUT_FILE)
110
- expect(object_file.image?).to be(true)
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
- it 'false' do
116
- non_image_file = File.join(PATH_TO_GEM, 'spec/assembly/object_file_spec.rb')
117
- object_file = described_class.new(non_image_file)
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
- it 'false' do
124
- non_image_file = File.join(PATH_TO_GEM, 'spec/test_data/input/file_with_no_exif.xml')
125
- object_file = described_class.new(non_image_file)
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.2
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-18 00:00:00.000000000 Z
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.3.7
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