riiif 2.1.0 → 2.4.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: 2e92c056972609b8cb70468fae8b71b34e1974b2ec4caa691af4422187886fa8
4
- data.tar.gz: eae0755c48ed444ebc292b56f30bd13520d1e34988ec6c7c37087483bbfbd8d8
3
+ metadata.gz: b5d2036dfb026731136b7eba93e3ede1943246aeac921a6db93cc76c6a1cfa8f
4
+ data.tar.gz: fd36f9c29b4beffb389259f3c1d66650f6f2b9963f0c243cfb6f0140736b72e7
5
5
  SHA512:
6
- metadata.gz: 5fe8da75c42178b50f8768cdb8f8383043d994865ab917d6b1b74083660b925265f0cd7d08f90f0670e7640c41dcf1b48736926a02855a391c51210ef96256f9
7
- data.tar.gz: 11dbed920c6e8bd094cbd2ae01e9e5f29de71670833b3d39d231c5ad0415b39fbc4c3da95b9f79dc46d6e6e12f50a962ed4b425ad3d65fa28d960868655db9e1
6
+ metadata.gz: 25e4d827a9033f80d3a803c3b47891b703bfc27dbff125b464b3a0096f6900c8f90eeb42e59bd80e7c59c79d2fe75e000adb69932489840899b52cea8aeba1c2
7
+ data.tar.gz: f226dd80245c3f7aebd8923980ef54d31faa3abf4829fc530ad297991642b1235c346c219dbb2bbbeaf6936d6e4979bca976b977f2271a01b8a6b2369dfccf5e
@@ -0,0 +1,42 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: CI
9
+
10
+ on:
11
+ push:
12
+ branches:
13
+ - master
14
+ pull_request:
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby: ['2.7', '3.0']
22
+ rails: ['6.1.4.6', '7.0.2.2']
23
+ include:
24
+ - ruby: '2.7'
25
+ rails: '5.2.3'
26
+ - ruby: '2.7'
27
+ rails: '6.0.0'
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - name: Set up Ruby
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ - name: Install dependencies
35
+ run: bundle install
36
+ env:
37
+ RAILS_VERSION: ${{ matrix.rails }}
38
+ - name: Run tests
39
+ run: bundle exec rake
40
+ env:
41
+ RAILS_VERSION: ${{ matrix.rails }}
42
+ ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
data/.rubocop_todo.yml CHANGED
@@ -1,16 +1,54 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-02-23 11:28:05 -0600 using RuboCop version 0.52.1.
3
+ # on 2022-02-28 10:01:41 -0800 using RuboCop version 0.85.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 2
9
+ # Offense count: 6
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
12
+ # SupportedHashRocketStyles: key, separator, table
13
+ # SupportedColonStyles: key, separator, table
14
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
15
+ Layout/HashAlignment:
16
+ Exclude:
17
+ - 'spec/controllers/riiif/images_controller_spec.rb'
18
+
19
+ # Offense count: 62
20
+ # Cop supports --auto-correct.
21
+ # Configuration parameters: EnforcedStyle.
22
+ # SupportedStyles: normal, indented_internal_methods
23
+ Layout/IndentationConsistency:
24
+ Exclude:
25
+ - 'app/controllers/riiif/images_controller.rb'
26
+ - 'app/resolvers/riiif/file_system_file_resolver.rb'
27
+ - 'app/resolvers/riiif/http_file_resolver.rb'
28
+ - 'app/services/riiif/crop.rb'
29
+ - 'app/services/riiif/imagemagick_command_factory.rb'
30
+ - 'app/services/riiif/kakadu_command_factory.rb'
31
+ - 'app/services/riiif/resize.rb'
32
+ - 'app/transformers/riiif/kakadu_transformer.rb'
33
+
34
+ # Offense count: 62
35
+ # Cop supports --auto-correct.
36
+ # Configuration parameters: Width, IgnoredPatterns.
37
+ Layout/IndentationWidth:
38
+ Exclude:
39
+ - 'app/controllers/riiif/images_controller.rb'
40
+ - 'app/resolvers/riiif/file_system_file_resolver.rb'
41
+ - 'app/resolvers/riiif/http_file_resolver.rb'
42
+ - 'app/services/riiif/crop.rb'
43
+ - 'app/services/riiif/imagemagick_command_factory.rb'
44
+ - 'app/services/riiif/kakadu_command_factory.rb'
45
+ - 'app/services/riiif/resize.rb'
46
+ - 'app/transformers/riiif/kakadu_transformer.rb'
47
+
48
+ # Offense count: 1
10
49
  # Configuration parameters: AllowSafeAssignment.
11
50
  Lint/AssignmentInCondition:
12
51
  Exclude:
13
- - 'app/models/riiif/file.rb'
14
52
  - 'app/resolvers/riiif/http_file_resolver.rb'
15
53
 
16
54
  # Offense count: 1
@@ -18,27 +56,26 @@ Lint/DuplicateMethods:
18
56
  Exclude:
19
57
  - 'app/resolvers/riiif/http_file_resolver.rb'
20
58
 
21
- # Offense count: 1
22
- Lint/HandleExceptions:
59
+ # Offense count: 2
60
+ # Configuration parameters: AllowComments.
61
+ Lint/SuppressedException:
23
62
  Exclude:
63
+ - 'app/controllers/riiif/images_controller.rb'
24
64
  - 'spec/models/riiif/http_file_resolver_spec.rb'
25
65
 
26
- # Offense count: 1
27
- Lint/UselessAssignment:
28
- Exclude:
29
- - 'app/models/riiif/file.rb'
30
-
31
66
  # Offense count: 21
32
67
  # Configuration parameters: CountComments, ExcludedMethods.
68
+ # ExcludedMethods: refine
33
69
  Metrics/BlockLength:
34
- Max: 233
70
+ Max: 237
35
71
 
36
72
  # Offense count: 1
73
+ # Configuration parameters: IgnoredMethods.
37
74
  Metrics/CyclomaticComplexity:
38
75
  Max: 7
39
76
 
40
77
  # Offense count: 3
41
- # Configuration parameters: CountComments.
78
+ # Configuration parameters: CountComments, ExcludedMethods.
42
79
  Metrics/MethodLength:
43
80
  Max: 18
44
81
 
@@ -47,12 +84,20 @@ Metrics/MethodLength:
47
84
  Metrics/ParameterLists:
48
85
  Max: 6
49
86
 
87
+ # Offense count: 3
88
+ # Cop supports --auto-correct.
89
+ Performance/RegexpMatch:
90
+ Exclude:
91
+ - 'app/resolvers/riiif/file_system_file_resolver.rb'
92
+ - 'app/services/riiif/imagemagick_command_factory.rb'
93
+
50
94
  # Offense count: 1
51
95
  RSpec/DescribeClass:
52
96
  Exclude:
53
97
  - 'spec/routing/resize_routes_spec.rb'
54
98
 
55
99
  # Offense count: 2
100
+ # Cop supports --auto-correct.
56
101
  # Configuration parameters: SkipBlocks, EnforcedStyle.
57
102
  # SupportedStyles: described_class, explicit
58
103
  RSpec/DescribedClass:
@@ -67,9 +112,11 @@ RSpec/ExampleLength:
67
112
  - 'spec/models/riiif/http_file_resolver_spec.rb'
68
113
  - 'spec/transformers/riiif/kakadu_transformer_spec.rb'
69
114
 
70
- # Offense count: 1
115
+ # Offense count: 2
116
+ # Cop supports --auto-correct.
71
117
  RSpec/LeadingSubject:
72
118
  Exclude:
119
+ - 'spec/controllers/riiif/images_controller_spec.rb'
73
120
  - 'spec/transformers/riiif/kakadu_transformer_spec.rb'
74
121
 
75
122
  # Offense count: 43
@@ -78,7 +125,8 @@ RSpec/LeadingSubject:
78
125
  RSpec/MessageSpies:
79
126
  EnforcedStyle: receive
80
127
 
81
- # Offense count: 23
128
+ # Offense count: 24
129
+ # Configuration parameters: IgnoreSharedExamples.
82
130
  RSpec/NamedSubject:
83
131
  Exclude:
84
132
  - 'spec/controllers/riiif/images_controller_spec.rb'
@@ -93,18 +141,51 @@ RSpec/RepeatedExample:
93
141
  - 'spec/controllers/riiif/images_controller_spec.rb'
94
142
 
95
143
  # Offense count: 7
96
- # Configuration parameters: IgnoreSymbolicNames.
144
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
97
145
  RSpec/VerifiedDoubles:
98
146
  Exclude:
99
147
  - 'spec/controllers/riiif/images_controller_spec.rb'
100
148
  - 'spec/services/riiif/imagemagick_command_factory_spec.rb'
101
149
  - 'spec/services/riiif/kakadu_command_factory_spec.rb'
102
150
 
151
+ # Offense count: 2
152
+ # Cop supports --auto-correct.
153
+ # Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent.
154
+ Rails/Blank:
155
+ Exclude:
156
+ - 'spec/controllers/riiif/images_controller_spec.rb'
157
+
103
158
  # Offense count: 1
159
+ # Configuration parameters: EnforcedStyle.
160
+ # SupportedStyles: slashes, arguments
104
161
  Rails/FilePath:
105
162
  Exclude:
106
163
  - 'spec/models/riiif/akubra_system_file_resolver_spec.rb'
107
164
 
165
+ # Offense count: 37
166
+ # Cop supports --auto-correct.
167
+ # Configuration parameters: EnforcedStyle.
168
+ # SupportedStyles: always, always_true, never
169
+ Style/FrozenStringLiteralComment:
170
+ Enabled: false
171
+
172
+ # Offense count: 2
173
+ # Cop supports --auto-correct.
174
+ # Configuration parameters: EnforcedStyle.
175
+ # SupportedStyles: literals, strict
176
+ Style/MutableConstant:
177
+ Exclude:
178
+ - 'lib/riiif/routes.rb'
179
+
180
+ # Offense count: 1
181
+ # Cop supports --auto-correct.
182
+ # Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
183
+ # SupportedStyles: predicate, comparison
184
+ Style/NumericPredicate:
185
+ Exclude:
186
+ - 'spec/**/*'
187
+ - 'app/services/riiif/imagemagick_command_factory.rb'
188
+
108
189
  # Offense count: 4
109
190
  # Cop supports --auto-correct.
110
191
  # Configuration parameters: PreferredDelimiters.
@@ -114,3 +195,15 @@ Style/PercentLiteralDelimiters:
114
195
  - 'app/resolvers/riiif/file_system_file_resolver.rb'
115
196
  - 'spec/controllers/riiif/images_controller_spec.rb'
116
197
  - 'spec/models/riiif/http_file_resolver_spec.rb'
198
+
199
+ # Offense count: 1
200
+ # Cop supports --auto-correct.
201
+ Style/RedundantBegin:
202
+ Exclude:
203
+ - 'app/resolvers/riiif/http_file_resolver.rb'
204
+
205
+ # Offense count: 1
206
+ # Cop supports --auto-correct.
207
+ Style/RedundantFreeze:
208
+ Exclude:
209
+ - 'app/services/riiif/imagemagick_command_factory.rb'
data/Gemfile CHANGED
@@ -28,13 +28,6 @@ else
28
28
  end
29
29
  end
30
30
 
31
- case ENV['RAILS_VERSION']
32
- when /^4.2/
33
- gem 'responders', '~> 2.0'
34
- gem 'sass-rails', '>= 5.0'
35
- gem 'coffee-rails', '~> 4.1.0'
36
- when /^4.[01]/
37
- gem 'sass-rails', '< 5.0'
38
- end
31
+ gem 'sass-rails', '~> 5.0'
39
32
  end
40
33
  # END ENGINE_CART BLOCK
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Coverage Status](https://coveralls.io/repos/github/curationexperts/riiif/badge.svg?branch=master)](https://coveralls.io/github/curationexperts/riiif?branch=master)
4
4
 
5
5
 
6
- A Ruby IIIF image server as a rails engine
6
+ A Ruby IIIF image server as a rails engine. Note that RIIIF is meant for development convenience and will not scale to the needs of most production-level applications.
7
7
 
8
8
  ## Installation
9
9
 
@@ -48,7 +48,7 @@ When the Id passed in is "foo_image", then it will look for an image file using
48
48
  ### Images retrieved over HTTP
49
49
  It's preferable to use files on the filesystem, because this avoids the overhead of downloading the file. If this is unavoidable, Riiif can be configured to fetch files from the network. To enable this behavior, configure Riiif to use an alternative resolver:
50
50
  ```
51
- Riiif::Image.file_resolver = Riiif::HTTPFileResolver.new
51
+ Riiif::Image.file_resolver = Riiif::HttpFileResolver.new
52
52
  ```
53
53
  Then we configure the resolver with a mechanism for mapping the provided id to a url:
54
54
  ```
@@ -154,7 +154,7 @@ Create an initializer like this in `config/initializers/riiif_initializer.rb`
154
154
 
155
155
  ```ruby
156
156
  # Tell RIIIF to get files via HTTP (not from the local disk)
157
- Riiif::Image.file_resolver = Riiif::HTTPFileResolver.new
157
+ Riiif::Image.file_resolver = Riiif::HttpFileResolver.new
158
158
 
159
159
  # This tells RIIIF how to resolve the identifier to a URI in Fedora
160
160
  Riiif::Image.file_resolver.id_to_uri = lambda do |id|
@@ -12,28 +12,6 @@ module Riiif
12
12
  @tempfile = tempfile # ensures that the tempfile will stick around until this file is garbage collected.
13
13
  end
14
14
 
15
- def self.read(stream, ext)
16
- create(ext) do |f|
17
- while chunk = stream.read(8192)
18
- f.write(chunk)
19
- end
20
- end
21
- end
22
- deprecation_deprecate read: 'Riiif::File.read is deprecated and will be removed in version 2.0'
23
-
24
- # Yields a tempfile to the provided block
25
- # @return [Riiif::File] a file backed by the Tempfile
26
- def self.create(ext = nil, _validate = true, &block)
27
- tempfile = Tempfile.new(['mini_magick', ext.to_s.downcase])
28
- tempfile.binmode
29
- block.call(tempfile)
30
- tempfile.close
31
- image = new(tempfile.path, tempfile)
32
- ensure
33
- tempfile.close if tempfile
34
- end
35
- deprecation_deprecate create: 'Riiif::File.create is deprecated and will be removed in version 2.0'
36
-
37
15
  # @param [Transformation] transformation
38
16
  # @param [ImageInformation] image_info
39
17
  # @return [String] the processed image data
@@ -4,19 +4,9 @@ module Riiif
4
4
  attr_accessor :base_path
5
5
 
6
6
  def initialize(base_path: nil)
7
- @base_path = base_path || default_base_path
7
+ @base_path = base_path
8
8
  end
9
9
 
10
- def default_base_path
11
- Deprecation.warn(self, 'Initializing a file resolver without setting the base path ' \
12
- 'is deprecated and will be removed in Riiif 2.0', caller(2))
13
- @root ||= ::File.expand_path(::File.join(::File.dirname(__FILE__), '../..'))
14
- ::File.join(@root, 'spec/samples')
15
- end
16
-
17
- attr_reader :root
18
- deprecation_deprecate :root
19
-
20
10
  def find(id)
21
11
  Riiif::File.new(path(id))
22
12
  end
@@ -14,7 +14,7 @@ module Riiif
14
14
 
15
15
  # @return [Boolean] true if the id matches the regex
16
16
  def validate_identifier(id:, regex: identifier_regex)
17
- return true if id =~ regex
17
+ return true if id.to_s =~ regex
18
18
  Rails.logger.warn "Invalid characters in id `#{id}`"
19
19
  false
20
20
  end
@@ -2,11 +2,11 @@ require 'open-uri'
2
2
  require 'active_support/core_ext/file/atomic'
3
3
 
4
4
  module Riiif
5
- class HTTPFileResolver
5
+ class HttpFileResolver
6
6
  # Set a lambda that maps the first parameter (id) to a URL
7
7
  # Example:
8
8
  #
9
- # resolver = Riiif::HTTPFileResolver.new
9
+ # resolver = Riiif::HttpFileResolver.new
10
10
  # resolver.id_to_uri = lambda do |id|
11
11
  # "http://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/#{id}.jpg/600px-#{id}.jpg"
12
12
  # end
@@ -63,7 +63,7 @@ module Riiif
63
63
  benchmark("Riiif downloaded #{url}") do
64
64
  ::File.atomic_write(file_name, cache_path) do |local|
65
65
  begin
66
- Kernel.open(url, download_opts) do |remote|
66
+ handler.open(url, **download_opts) do |remote|
67
67
  while chunk = remote.read(8192)
68
68
  local.write(chunk)
69
69
  end
@@ -85,6 +85,14 @@ module Riiif
85
85
  def ensure_cache_path(path)
86
86
  FileUtils.makedirs(path) unless ::File.exist?(path)
87
87
  end
88
+
89
+ def handler
90
+ if url.match?(URI.regexp)
91
+ URI
92
+ else
93
+ Kernel
94
+ end
95
+ end
88
96
  end
89
97
 
90
98
  protected
data/lib/riiif/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Riiif
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.4.0'.freeze
3
3
  end
data/lib/riiif.rb CHANGED
@@ -12,6 +12,8 @@ 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')
16
+
15
17
  mattr_accessor :not_found_image # the image to use when a lookup fails
16
18
  mattr_accessor :unauthorized_image # the image to use when a user doesn't have access
17
19
 
data/riiif.gemspec CHANGED
@@ -18,14 +18,15 @@ 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', '<6'
21
+ spec.add_dependency 'railties', '>= 4.2', '<8'
22
22
  spec.add_dependency 'deprecation', '>= 1.0.0'
23
- spec.add_dependency 'iiif-image-api', '~> 0.1.0'
23
+ spec.add_dependency 'iiif-image-api', '>= 0.1.0'
24
+
24
25
  spec.add_development_dependency 'bundler'
25
26
  spec.add_development_dependency 'rake'
26
27
  spec.add_development_dependency 'engine_cart', '~> 2.0'
27
28
  spec.add_development_dependency 'rspec-rails'
28
29
  spec.add_development_dependency 'sqlite3'
29
- spec.add_development_dependency 'bixby', '~> 1.0.0'
30
+ spec.add_development_dependency 'bixby', '~> 3.0'
30
31
  spec.add_development_dependency 'coveralls'
31
32
  end
@@ -24,9 +24,9 @@ RSpec.describe Riiif::ImagesController do
24
24
  it 'sends images to the service' do
25
25
  image = double
26
26
  expect(Riiif::Image).to receive(:new).with('abcd1234').and_return(image)
27
- expect(image).to receive(:render).with('region' => 'full', 'size' => 'full',
27
+ expect(image).to receive(:render).with({ 'region' => 'full', 'size' => 'full',
28
28
  'rotation' => '0', 'quality' => 'default',
29
- 'format' => 'jpg').and_return('IMAGEDATA')
29
+ 'format' => 'jpg' }).and_return('IMAGEDATA')
30
30
  get :show, params: { id: 'abcd1234', action: 'show', region: 'full', size: 'full',
31
31
  rotation: '0', quality: 'default', format: 'jpg' }
32
32
  expect(response).to be_successful
@@ -102,9 +102,9 @@ RSpec.describe Riiif::ImagesController do
102
102
  raise Riiif::ImageNotFoundError unless file.present?
103
103
  not_found_image
104
104
  end.twice
105
- expect(not_found_image).to receive(:render).with('region' => 'full', 'size' => 'full',
105
+ expect(not_found_image).to receive(:render).with({ 'region' => 'full', 'size' => 'full',
106
106
  'rotation' => '0', 'quality' => 'default',
107
- 'format' => 'jpg').and_return('default-image-data')
107
+ 'format' => 'jpg' }).and_return('default-image-data')
108
108
 
109
109
  get :show, params: { id: 'bad_id', action: 'show', region: 'full', size: 'full',
110
110
  rotation: '0', quality: 'default', format: 'jpg' }
@@ -118,9 +118,9 @@ RSpec.describe Riiif::ImagesController do
118
118
  raise Riiif::ImageNotFoundError unless file.present?
119
119
  not_found_image
120
120
  end.twice
121
- expect(not_found_image).to receive(:render).with('region' => 'full', 'size' => 'full',
121
+ expect(not_found_image).to receive(:render).with({ 'region' => 'full', 'size' => 'full',
122
122
  'rotation' => '0', 'quality' => 'default',
123
- 'format' => 'jpg').and_return('default-image-data')
123
+ 'format' => 'jpg' }).and_return('default-image-data')
124
124
 
125
125
  get :show, params: { id: 'bad_id', action: 'show', region: 'full', size: 'full',
126
126
  rotation: '0', quality: 'default', format: 'jpg' }
@@ -155,7 +155,7 @@ RSpec.describe Riiif::ImagesController do
155
155
  get :info, params: { id: 'abcd1234', format: 'json' }
156
156
  expect(response).to be_successful
157
157
  expect(json).to eq '@context' => 'http://iiif.io/api/image/2/context.json',
158
- '@id' => 'http://test.host/abcd1234',
158
+ '@id' => Rails.version > '6.1' ? 'http://test.host/images/abcd1234' : 'http://test.host/abcd1234',
159
159
  'width' => 6000,
160
160
  'height' => 4000,
161
161
  'format' => 'JPEG',
@@ -78,5 +78,12 @@ describe Riiif::FileSystemFileResolver do
78
78
  expect(subject).to be_nil
79
79
  end
80
80
  end
81
+
82
+ context 'as an integer' do
83
+ let(:id) { 1 }
84
+ it 'converts it to a string before parsing' do
85
+ expect { subject }.not_to raise_error
86
+ end
87
+ end
81
88
  end
82
89
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Riiif::HTTPFileResolver do
3
+ describe Riiif::HttpFileResolver do
4
4
  subject { described_class.new }
5
5
 
6
6
  before do
@@ -28,6 +28,9 @@ RSpec.describe Riiif::Image do
28
28
  end
29
29
 
30
30
  it 'is able to override the file used for the Image' do
31
+ allow(Riiif::CommandRunner).to receive(:execute)
32
+ .with("identify -format '%h %w %m %[channels]' #{filename}[0]").and_return('400 800')
33
+
31
34
  img = described_class.new('some_id', Riiif::File.new(filename))
32
35
  expect(img.id).to eq 'some_id'
33
36
  expect(img.info).to eq Riiif::ImageInformation.new(width: 800, height: 400)
@@ -35,13 +38,16 @@ RSpec.describe Riiif::Image do
35
38
 
36
39
  describe 'info' do
37
40
  it 'returns the data' do
41
+ allow(Riiif::CommandRunner).to receive(:execute)
42
+ .with("identify -format '%h %w %m %[channels]' #{filename}[0]").and_return('400 800')
43
+
38
44
  expect(subject.info).to eq Riiif::ImageInformation.new(width: 800, height: 400)
39
45
  end
40
46
  end
41
47
 
42
- context 'using HTTPFileResolver' do
48
+ context 'using HttpFileResolver' do
43
49
  before do
44
- described_class.file_resolver = Riiif::HTTPFileResolver.new
50
+ described_class.file_resolver = Riiif::HttpFileResolver.new
45
51
  described_class.file_resolver.id_to_uri = lambda do |id|
46
52
  "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/#{id}.jpg/600px-#{id}.jpg"
47
53
  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.1.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-30 00:00:00.000000000 Z
11
+ date: 2022-02-28 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: '6'
22
+ version: '8'
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: '6'
32
+ version: '8'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: deprecation
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -48,14 +48,14 @@ dependencies:
48
48
  name: iiif-image-api
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: 0.1.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 0.1.0
61
61
  - !ruby/object:Gem::Dependency
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: 1.0.0
137
+ version: '3.0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: 1.0.0
144
+ version: '3.0'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: coveralls
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -163,11 +163,11 @@ executables: []
163
163
  extensions: []
164
164
  extra_rdoc_files: []
165
165
  files:
166
+ - ".github/workflows/ruby.yml"
166
167
  - ".gitignore"
167
168
  - ".rspec"
168
169
  - ".rubocop.yml"
169
170
  - ".rubocop_todo.yml"
170
- - ".travis.yml"
171
171
  - CHANGELOG
172
172
  - Gemfile
173
173
  - LICENSE
@@ -218,7 +218,7 @@ homepage: https://github.com/curationexperts/riiif
218
218
  licenses:
219
219
  - APACHE2
220
220
  metadata: {}
221
- post_install_message:
221
+ post_install_message:
222
222
  rdoc_options: []
223
223
  require_paths:
224
224
  - lib
@@ -233,9 +233,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  - !ruby/object:Gem::Version
234
234
  version: '0'
235
235
  requirements: []
236
- rubyforge_project:
237
- rubygems_version: 2.7.9
238
- signing_key:
236
+ rubygems_version: 3.2.32
237
+ signing_key:
239
238
  specification_version: 4
240
239
  summary: A rails engine that support IIIF requests
241
240
  test_files:
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- notifications:
2
- email: false
3
-
4
- before_install:
5
- - gem update --system
6
-
7
- rvm:
8
- - 2.4.0
9
-
10
- sudo: false
11
- language: ruby