riiif 2.5.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d88fa024e853f81b2c6a4fb9a722357d45537e1e6c235aafb165e1dc5fc0f017
4
- data.tar.gz: 775234812041bad9fbf9340540799baf9e6740e9cd11d43eca5c51eead07ef28
3
+ metadata.gz: ea4afe42b1178e584376a461d2a093dce410e4e7d6ffe7b77b03a65c2e90c787
4
+ data.tar.gz: 74cff5d88b9cb6e0bb5077b67e81cf104b04c400419728090dcb423051b7382d
5
5
  SHA512:
6
- metadata.gz: eed458967ef79c6f0458fdb9ca6a07ad9442bd487d5dc29f6b8b828649aa37317410b7bd210de93ebc1438990179b2c33b3af196396ed2eebbdd28249416e29d
7
- data.tar.gz: cd607c37c612833ab41b90e5beba46891421f8e44e93d0a1c609542dbe857786871926c1ebb44652a44725df9658517c87ee58a80d3d91c5de43b96376d37b85
6
+ metadata.gz: e3b19485e9b29e6383995a27540acd3356981e49ee2c62e27c069de234e87cd075b685c98818d947a9e03c073478ff55b4e2d49f8c377b9ea9bf9f563def5daf
7
+ data.tar.gz: a7f044747b0d275e60e7ef3aac3184d7ab033e88c02b1b0bbf7337e212c428d9c985ed604ab1ef95e8b0deb3101dd608ec9b08a66fad70c99531caac5a2a1879
@@ -18,29 +18,22 @@ jobs:
18
18
  runs-on: ubuntu-latest
19
19
  strategy:
20
20
  matrix:
21
- ruby: ['3.1', '3.2']
22
- rails: ['7.0.8']
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: ["8.0.0", "7.2.2", "7.1.5"]
32
23
  steps:
33
- - uses: actions/checkout@v2
34
- - name: Set up Ruby
35
- uses: ruby/setup-ruby@v1
36
- with:
37
- ruby-version: ${{ matrix.ruby }}
38
- - name: Install dependencies
39
- run: bundle install
40
- env:
41
- RAILS_VERSION: ${{ matrix.rails }}
42
- - name: Run tests
43
- run: bundle exec rake
44
- env:
45
- RAILS_VERSION: ${{ matrix.rails }}
46
- ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
24
+ - name: Install ImageMagick
25
+ run: sudo apt install imagemagick
26
+ - uses: actions/checkout@v2
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ - name: Install dependencies
32
+ run: bundle install
33
+ env:
34
+ RAILS_VERSION: ${{ matrix.rails }}
35
+ - name: Run tests
36
+ run: bundle exec rake
37
+ env:
38
+ RAILS_VERSION: ${{ matrix.rails }}
39
+ ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test"
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
@@ -1,3 +1,3 @@
1
1
  module Riiif
2
- VERSION = '2.5.0'.freeze
2
+ VERSION = '2.7.0'.freeze
3
3
  end
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
- HTTPFileResolver = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Riiif::HTTPFileResolver', 'Riiif::HttpFileResolver')
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
data/riiif.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'railties', '>= 4.2', '<8'
21
+ spec.add_dependency 'railties', '>= 4.2', '< 9'
22
22
  spec.add_dependency 'deprecation', '>= 1.0.0'
23
23
  spec.add_dependency 'iiif-image-api', '>= 0.1.0'
24
24
 
@@ -160,7 +160,7 @@ RSpec.describe Riiif::ImagesController do
160
160
  'height' => 4000,
161
161
  'format' => 'JPEG',
162
162
  'channels' => 'rgb',
163
- 'profile' => ['http://iiif.io/api/image/2/level1.json', 'formats' => %w(jpg png)],
163
+ 'profile' => ['http://iiif.io/api/image/2/level1.json', 'formats' => %w(webp jpg png)],
164
164
  'protocol' => 'http://iiif.io/api/image'
165
165
  expect(response.headers['Link']).to eq '<http://iiif.io/api/image/2/level1.json>;rel="profile"'
166
166
  expect(response.headers['Content-Type']).to eq 'application/ld+json; charset=utf-8'
@@ -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.5.0
4
+ version: 2.7.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-01-17 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '8'
22
+ version: '9'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '8'
32
+ version: '9'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: deprecation
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -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.4.20
236
+ rubygems_version: 3.5.23
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: A Rails engine that support IIIF requests