riiif 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -11
- data/lib/riiif/engine.rb +10 -0
- data/lib/riiif/version.rb +1 -1
- data/lib/riiif.rb +9 -1
- data/spec/models/riiif/image_spec.rb +21 -21
- data/spec/transformers/riiif/kakadu_transformer_spec.rb +8 -8
- 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: eca824ebbf6e2ab8546cfd299e7f8bd9a58943c157496eee5fc665cec69bf303
|
4
|
+
data.tar.gz: c1f03570083a8c04a59f107ebe7e4b03f4ab1ca44206575c9838baa4a06ab575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b80f4b2b9c18d6c35c49db4b912e6f194d07a2e7f511fca99fb9fb9eccb1b7df4c413613430d2bbe618d24863368d2ca8bb67e67298798404a282fee3602a6a
|
7
|
+
data.tar.gz: d0687470f9bfacaa27284cc30fa2c998ebf9f86c038f0d5834315ea5ddd59b2c8ccf6d7481d93a4dec2985704fe63eae3ec631eec540beb22f2e894681d5ea44
|
data/.github/workflows/ruby.yml
CHANGED
@@ -18,17 +18,8 @@ jobs:
|
|
18
18
|
runs-on: ubuntu-latest
|
19
19
|
strategy:
|
20
20
|
matrix:
|
21
|
-
ruby: ['3.
|
22
|
-
rails: ['7.
|
23
|
-
include:
|
24
|
-
- ruby: '2.7'
|
25
|
-
rails: '5.2.3'
|
26
|
-
- ruby: '2.7'
|
27
|
-
rails: '6.0.6.1'
|
28
|
-
- ruby: '3.0'
|
29
|
-
rails: '6.0.6.1'
|
30
|
-
- ruby: '3.1'
|
31
|
-
rails: '6.1.7.6'
|
21
|
+
ruby: ['3.2', '3.3']
|
22
|
+
rails: ['7.2.1', '7.1.4']
|
32
23
|
steps:
|
33
24
|
- uses: actions/checkout@v2
|
34
25
|
- name: Set up Ruby
|
data/lib/riiif/engine.rb
CHANGED
@@ -10,5 +10,15 @@ module Riiif
|
|
10
10
|
|
11
11
|
# Set to true to use kdu for jp2000 source images
|
12
12
|
config.kakadu_enabled = false
|
13
|
+
|
14
|
+
config.before_configuration do
|
15
|
+
# see https://github.com/fxn/zeitwerk#for_gem
|
16
|
+
# We put a generator into LOCAL APP lib/generators, so tell
|
17
|
+
# zeitwerk to ignore the whole directory? If we're using a recent
|
18
|
+
# enough version of Rails to have zeitwerk config
|
19
|
+
#
|
20
|
+
# See: https://github.com/cbeer/engine_cart/issues/117
|
21
|
+
Rails.autoloaders.main.ignore(Rails.root.join('lib', 'generators')) if Rails.try(:autoloaders).try(:main).respond_to?(:ignore)
|
22
|
+
end
|
13
23
|
end
|
14
24
|
end
|
data/lib/riiif/version.rb
CHANGED
data/lib/riiif.rb
CHANGED
@@ -12,7 +12,15 @@ module Riiif
|
|
12
12
|
# This error is raised when Riiif can't convert an image
|
13
13
|
class ConversionError < Error; end
|
14
14
|
|
15
|
-
|
15
|
+
def self.deprecation
|
16
|
+
@deprecation ||= ActiveSupport::Deprecation.new('3.0', 'Riiif')
|
17
|
+
end
|
18
|
+
|
19
|
+
HTTPFileResolver = ActiveSupport::Deprecation::DeprecatedConstantProxy.new(
|
20
|
+
'Riiif::HTTPFileResolver',
|
21
|
+
'Riiif::HttpFileResolver',
|
22
|
+
Riiif.deprecation
|
23
|
+
)
|
16
24
|
|
17
25
|
mattr_accessor :not_found_image # the image to use when a lookup fails
|
18
26
|
mattr_accessor :unauthorized_image # the image to use when a user doesn't have access
|
@@ -20,7 +20,7 @@ RSpec.describe Riiif::Image do
|
|
20
20
|
|
21
21
|
it 'renders' do
|
22
22
|
expect(Riiif::CommandRunner).to receive(:execute)
|
23
|
-
.with("convert -quality 85 -sampling-factor 4:2:0 -strip #{filename} jpg:-")
|
23
|
+
.with("convert -quality 85 -sampling-factor 4:2:0 -strip \'#{filename}\' jpg:-")
|
24
24
|
.and_return('imagedata')
|
25
25
|
|
26
26
|
expect(subject.render('size' => 'full', format: 'jpg')).to eq 'imagedata'
|
@@ -29,7 +29,7 @@ RSpec.describe Riiif::Image do
|
|
29
29
|
|
30
30
|
it 'is able to override the file used for the Image' do
|
31
31
|
allow(Riiif::CommandRunner).to receive(:execute)
|
32
|
-
.with("identify -format '%h %w %m %[channels]' #{filename}[0]").and_return('400 800')
|
32
|
+
.with("identify -format '%h %w %m %[channels]' \'#{filename}[0]\'").and_return('400 800')
|
33
33
|
|
34
34
|
img = described_class.new('some_id', Riiif::File.new(filename))
|
35
35
|
expect(img.id).to eq 'some_id'
|
@@ -39,7 +39,7 @@ RSpec.describe Riiif::Image do
|
|
39
39
|
describe 'info' do
|
40
40
|
it 'returns the data' do
|
41
41
|
allow(Riiif::CommandRunner).to receive(:execute)
|
42
|
-
.with("identify -format '%h %w %m %[channels]' #{filename}[0]").and_return('400 800')
|
42
|
+
.with("identify -format '%h %w %m %[channels]' \'#{filename}[0]\'").and_return('400 800')
|
43
43
|
|
44
44
|
expect(subject.info).to eq Riiif::ImageInformation.new(width: 800, height: 400)
|
45
45
|
end
|
@@ -77,7 +77,7 @@ RSpec.describe Riiif::Image do
|
|
77
77
|
describe '#render' do
|
78
78
|
before do
|
79
79
|
allow(Riiif::CommandRunner).to receive(:execute)
|
80
|
-
.with("identify -format '%h %w %m %[channels]' #{filename}[0]").and_return('131 175 JPEG')
|
80
|
+
.with("identify -format '%h %w %m %[channels]' \'#{filename}[0]\'").and_return('131 175 JPEG')
|
81
81
|
end
|
82
82
|
|
83
83
|
describe 'region' do
|
@@ -88,7 +88,7 @@ RSpec.describe Riiif::Image do
|
|
88
88
|
|
89
89
|
it 'returns the original' do
|
90
90
|
expect(Riiif::CommandRunner).to receive(:execute)
|
91
|
-
.with("convert -strip #{filename} png:-")
|
91
|
+
.with("convert -strip \'#{filename}\' png:-")
|
92
92
|
render
|
93
93
|
end
|
94
94
|
end
|
@@ -98,7 +98,7 @@ RSpec.describe Riiif::Image do
|
|
98
98
|
|
99
99
|
it 'runs the correct imagemagick command' do
|
100
100
|
expect(Riiif::CommandRunner).to receive(:execute)
|
101
|
-
.with("convert -crop 60x75+80+15 -strip #{filename} png:-")
|
101
|
+
.with("convert -crop 60x75+80+15 -strip \'#{filename}\' png:-")
|
102
102
|
render
|
103
103
|
end
|
104
104
|
end
|
@@ -108,7 +108,7 @@ RSpec.describe Riiif::Image do
|
|
108
108
|
|
109
109
|
it 'runs the correct imagemagick command' do
|
110
110
|
expect(Riiif::CommandRunner).to receive(:execute)
|
111
|
-
.with("convert -crop 80.0%x70.0+18+13 -strip #{filename} png:-")
|
111
|
+
.with("convert -crop 80.0%x70.0+18+13 -strip \'#{filename}\' png:-")
|
112
112
|
render
|
113
113
|
end
|
114
114
|
end
|
@@ -118,7 +118,7 @@ RSpec.describe Riiif::Image do
|
|
118
118
|
|
119
119
|
it 'runs the correct imagemagick command' do
|
120
120
|
expect(Riiif::CommandRunner).to receive(:execute)
|
121
|
-
.with("convert -crop 131x131+22+0 -strip #{filename} png:-")
|
121
|
+
.with("convert -crop 131x131+22+0 -strip \'#{filename}\' png:-")
|
122
122
|
render
|
123
123
|
end
|
124
124
|
end
|
@@ -140,7 +140,7 @@ RSpec.describe Riiif::Image do
|
|
140
140
|
|
141
141
|
it 'returns the original' do
|
142
142
|
expect(Riiif::CommandRunner).to receive(:execute)
|
143
|
-
.with("convert -strip #{filename} png:-")
|
143
|
+
.with("convert -strip \'#{filename}\' png:-")
|
144
144
|
render
|
145
145
|
end
|
146
146
|
end
|
@@ -150,7 +150,7 @@ RSpec.describe Riiif::Image do
|
|
150
150
|
|
151
151
|
it 'runs the correct imagemagick command' do
|
152
152
|
expect(Riiif::CommandRunner).to receive(:execute)
|
153
|
-
.with("convert -resize 50.0% -strip #{filename} png:-")
|
153
|
+
.with("convert -resize 50.0% -strip \'#{filename}\' png:-")
|
154
154
|
render
|
155
155
|
end
|
156
156
|
end
|
@@ -160,7 +160,7 @@ RSpec.describe Riiif::Image do
|
|
160
160
|
|
161
161
|
it 'runs the correct imagemagick command' do
|
162
162
|
expect(Riiif::CommandRunner).to receive(:execute)
|
163
|
-
.with("convert -resize 12.5% -strip #{filename} png:-")
|
163
|
+
.with("convert -resize 12.5% -strip \'#{filename}\' png:-")
|
164
164
|
render
|
165
165
|
end
|
166
166
|
end
|
@@ -170,7 +170,7 @@ RSpec.describe Riiif::Image do
|
|
170
170
|
|
171
171
|
it 'runs the correct imagemagick command' do
|
172
172
|
expect(Riiif::CommandRunner).to receive(:execute)
|
173
|
-
.with("convert -resize 50 -strip #{filename} png:-")
|
173
|
+
.with("convert -resize 50 -strip \'#{filename}\' png:-")
|
174
174
|
render
|
175
175
|
end
|
176
176
|
end
|
@@ -180,7 +180,7 @@ RSpec.describe Riiif::Image do
|
|
180
180
|
|
181
181
|
it 'runs the correct imagemagick command' do
|
182
182
|
expect(Riiif::CommandRunner).to receive(:execute)
|
183
|
-
.with("convert -resize x50 -strip #{filename} png:-")
|
183
|
+
.with("convert -resize x50 -strip \'#{filename}\' png:-")
|
184
184
|
render
|
185
185
|
end
|
186
186
|
end
|
@@ -190,7 +190,7 @@ RSpec.describe Riiif::Image do
|
|
190
190
|
|
191
191
|
it 'runs the correct imagemagick command' do
|
192
192
|
expect(Riiif::CommandRunner).to receive(:execute)
|
193
|
-
.with("convert -resize 150x75! -strip #{filename} png:-")
|
193
|
+
.with("convert -resize 150x75! -strip \'#{filename}\' png:-")
|
194
194
|
render
|
195
195
|
end
|
196
196
|
end
|
@@ -199,7 +199,7 @@ RSpec.describe Riiif::Image do
|
|
199
199
|
|
200
200
|
it 'runs the correct imagemagick command' do
|
201
201
|
expect(Riiif::CommandRunner).to receive(:execute)
|
202
|
-
.with("convert -resize 150x75 -strip #{filename} png:-")
|
202
|
+
.with("convert -resize 150x75 -strip \'#{filename}\' png:-")
|
203
203
|
render
|
204
204
|
end
|
205
205
|
end
|
@@ -221,7 +221,7 @@ RSpec.describe Riiif::Image do
|
|
221
221
|
|
222
222
|
it 'returns the original' do
|
223
223
|
expect(Riiif::CommandRunner).to receive(:execute)
|
224
|
-
.with("convert -strip #{filename} png:-")
|
224
|
+
.with("convert -strip \'#{filename}\' png:-")
|
225
225
|
render
|
226
226
|
end
|
227
227
|
end
|
@@ -231,7 +231,7 @@ RSpec.describe Riiif::Image do
|
|
231
231
|
|
232
232
|
it 'handles floats' do
|
233
233
|
expect(Riiif::CommandRunner).to receive(:execute)
|
234
|
-
.with("convert -virtual-pixel white +distort srt 22.5 -strip #{filename} png:-")
|
234
|
+
.with("convert -virtual-pixel white +distort srt 22.5 -strip \'#{filename}\' png:-")
|
235
235
|
render
|
236
236
|
end
|
237
237
|
end
|
@@ -253,7 +253,7 @@ RSpec.describe Riiif::Image do
|
|
253
253
|
|
254
254
|
it 'returns the original when specifing default' do
|
255
255
|
expect(Riiif::CommandRunner).to receive(:execute)
|
256
|
-
.with("convert -strip #{filename} png:-")
|
256
|
+
.with("convert -strip \'#{filename}\' png:-")
|
257
257
|
render
|
258
258
|
end
|
259
259
|
end
|
@@ -263,7 +263,7 @@ RSpec.describe Riiif::Image do
|
|
263
263
|
|
264
264
|
it 'returns the original when specifing color' do
|
265
265
|
expect(Riiif::CommandRunner).to receive(:execute)
|
266
|
-
.with("convert -strip #{filename} png:-")
|
266
|
+
.with("convert -strip \'#{filename}\' png:-")
|
267
267
|
render
|
268
268
|
end
|
269
269
|
end
|
@@ -273,7 +273,7 @@ RSpec.describe Riiif::Image do
|
|
273
273
|
|
274
274
|
it 'converts to grayscale' do
|
275
275
|
expect(Riiif::CommandRunner).to receive(:execute)
|
276
|
-
.with("convert -colorspace Gray -strip #{filename} png:-")
|
276
|
+
.with("convert -colorspace Gray -strip \'#{filename}\' png:-")
|
277
277
|
render
|
278
278
|
end
|
279
279
|
end
|
@@ -283,7 +283,7 @@ RSpec.describe Riiif::Image do
|
|
283
283
|
|
284
284
|
it 'converts to bitonal' do
|
285
285
|
expect(Riiif::CommandRunner).to receive(:execute)
|
286
|
-
.with("convert -colorspace Gray -type Bilevel -strip #{filename} png:-")
|
286
|
+
.with("convert -colorspace Gray -type Bilevel -strip \'#{filename}\' png:-")
|
287
287
|
render
|
288
288
|
end
|
289
289
|
end
|
@@ -42,7 +42,7 @@ RSpec.describe Riiif::KakaduTransformer do
|
|
42
42
|
.with('kdu_expand -quiet -i baseball.jp2 -num_threads 4 ' \
|
43
43
|
'-region "{0.1,0.2},{0.1,0.1}" -reduce 4 -o /tmp/foo.bmp')
|
44
44
|
expect(Riiif::CommandRunner).to receive(:execute)
|
45
|
-
.with('convert -resize 38x38! -quality 85 -sampling-factor 4:2:0 -strip /tmp/foo.bmp jpg:-')
|
45
|
+
.with('convert -resize 38x38! -quality 85 -sampling-factor 4:2:0 -strip \'/tmp/foo.bmp\' jpg:-')
|
46
46
|
transform
|
47
47
|
end
|
48
48
|
end
|
@@ -54,7 +54,7 @@ RSpec.describe Riiif::KakaduTransformer do
|
|
54
54
|
expect(Riiif::CommandRunner).to receive(:execute)
|
55
55
|
.with('kdu_expand -quiet -i baseball.jp2 -num_threads 4 -o /tmp/foo.bmp')
|
56
56
|
expect(Riiif::CommandRunner).to receive(:execute)
|
57
|
-
.with('convert -quality 85 -sampling-factor 4:2:0 -strip /tmp/foo.bmp jpg:-')
|
57
|
+
.with('convert -quality 85 -sampling-factor 4:2:0 -strip \'/tmp/foo.bmp\' jpg:-')
|
58
58
|
transform
|
59
59
|
end
|
60
60
|
end
|
@@ -67,7 +67,7 @@ RSpec.describe Riiif::KakaduTransformer do
|
|
67
67
|
expect(Riiif::CommandRunner).to receive(:execute)
|
68
68
|
.with('kdu_expand -quiet -i baseball.jp2 -num_threads 4 -o /tmp/foo.bmp')
|
69
69
|
expect(Riiif::CommandRunner).to receive(:execute)
|
70
|
-
.with('convert -resize 651 -quality 85 -sampling-factor 4:2:0 -strip /tmp/foo.bmp jpg:-')
|
70
|
+
.with('convert -resize 651 -quality 85 -sampling-factor 4:2:0 -strip \'/tmp/foo.bmp\' jpg:-')
|
71
71
|
transform
|
72
72
|
end
|
73
73
|
end
|
@@ -80,7 +80,7 @@ RSpec.describe Riiif::KakaduTransformer do
|
|
80
80
|
expect(Riiif::CommandRunner).to receive(:execute)
|
81
81
|
.with('kdu_expand -quiet -i baseball.jp2 -num_threads 4 -o /tmp/foo.bmp')
|
82
82
|
expect(Riiif::CommandRunner).to receive(:execute)
|
83
|
-
.with('convert -resize x581 -quality 85 -sampling-factor 4:2:0 -strip /tmp/foo.bmp jpg:-')
|
83
|
+
.with('convert -resize x581 -quality 85 -sampling-factor 4:2:0 -strip \'/tmp/foo.bmp\' jpg:-')
|
84
84
|
transform
|
85
85
|
end
|
86
86
|
end
|
@@ -96,7 +96,7 @@ RSpec.describe Riiif::KakaduTransformer do
|
|
96
96
|
expect(Riiif::CommandRunner).to receive(:execute)
|
97
97
|
.with('kdu_expand -quiet -i baseball.jp2 -num_threads 4 -reduce 1 -o /tmp/foo.bmp')
|
98
98
|
expect(Riiif::CommandRunner).to receive(:execute)
|
99
|
-
.with('convert -resize 60.0% -quality 85 -sampling-factor 4:2:0 -strip /tmp/foo.bmp jpg:-')
|
99
|
+
.with('convert -resize 60.0% -quality 85 -sampling-factor 4:2:0 -strip \'/tmp/foo.bmp\' jpg:-')
|
100
100
|
transform
|
101
101
|
end
|
102
102
|
end
|
@@ -109,7 +109,7 @@ RSpec.describe Riiif::KakaduTransformer do
|
|
109
109
|
expect(Riiif::CommandRunner).to receive(:execute)
|
110
110
|
.with('kdu_expand -quiet -i baseball.jp2 -num_threads 4 -reduce 1 -o /tmp/foo.bmp')
|
111
111
|
expect(Riiif::CommandRunner).to receive(:execute)
|
112
|
-
.with('convert -resize 408 -quality 85 -sampling-factor 4:2:0 -strip /tmp/foo.bmp jpg:-')
|
112
|
+
.with('convert -resize 408 -quality 85 -sampling-factor 4:2:0 -strip \'/tmp/foo.bmp\' jpg:-')
|
113
113
|
transform
|
114
114
|
end
|
115
115
|
end
|
@@ -122,7 +122,7 @@ RSpec.describe Riiif::KakaduTransformer do
|
|
122
122
|
expect(Riiif::CommandRunner).to receive(:execute)
|
123
123
|
.with('kdu_expand -quiet -i baseball.jp2 -num_threads 4 -reduce 1 -o /tmp/foo.bmp')
|
124
124
|
expect(Riiif::CommandRunner).to receive(:execute)
|
125
|
-
.with('convert -resize x481 -quality 85 -sampling-factor 4:2:0 -strip /tmp/foo.bmp jpg:-')
|
125
|
+
.with('convert -resize x481 -quality 85 -sampling-factor 4:2:0 -strip \'/tmp/foo.bmp\' jpg:-')
|
126
126
|
transform
|
127
127
|
end
|
128
128
|
end
|
@@ -135,7 +135,7 @@ RSpec.describe Riiif::KakaduTransformer do
|
|
135
135
|
expect(Riiif::CommandRunner).to receive(:execute)
|
136
136
|
.with('kdu_expand -quiet -i baseball.jp2 -num_threads 4 -reduce 2 -o /tmp/foo.bmp')
|
137
137
|
expect(Riiif::CommandRunner).to receive(:execute)
|
138
|
-
.with('convert -resize 80.0% -quality 85 -sampling-factor 4:2:0 -strip /tmp/foo.bmp jpg:-')
|
138
|
+
.with('convert -resize 80.0% -quality 85 -sampling-factor 4:2:0 -strip \'/tmp/foo.bmp\' jpg:-')
|
139
139
|
transform
|
140
140
|
end
|
141
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riiif
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
233
|
- !ruby/object:Gem::Version
|
234
234
|
version: '0'
|
235
235
|
requirements: []
|
236
|
-
rubygems_version: 3.
|
236
|
+
rubygems_version: 3.5.9
|
237
237
|
signing_key:
|
238
238
|
specification_version: 4
|
239
239
|
summary: A Rails engine that support IIIF requests
|