speedy-af 0.5.1 → 0.6.1

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: 172c12ad71984a304a61ef5ac110109eec26907ad11d73f2fd58d0ced0b88f6a
4
- data.tar.gz: 0be67e88288ee13d853619cb91a2608450824d908230713ec3f8a9d535bde91f
3
+ metadata.gz: e0b87455a3724096083b0ee86c462df634780c3aa9a17e121087d7497610aa53
4
+ data.tar.gz: 845ce23c6ccdcc7ad89f130d8d6e850228c8e7fcd495b873c6c39048eabace61
5
5
  SHA512:
6
- metadata.gz: 7ff404cde599d7b7111cbceca64ca13f400740b1b4e794d93906b0c9e2987403f289f99294d3e7002946efd18d2cd41bfbdd7810f385a10e860bb6af33de0ec7
7
- data.tar.gz: a38247cc3afe52ce3db0b9dce0b4f12b456ffe03654e8fab460f4489f60744ec7b8b602454b3853ecbf520699684caf96364e2736b8a6deec5c4593a9aca8460
6
+ metadata.gz: ed974b3a2adb1802befbc240ca0a3a3ff64de6d4af73e975bf941384de40ae1997082800da10cd2f722491bab2782a729ccd7a0cea2b668767920b45d9eab9f0
7
+ data.tar.gz: c2771b07ca48dab6179ea713762351c8de56edaac75c8e7e8619ca0decad6792a0d082e64e8280a0affd56460a6f44cfcb4454e1e657bfa960ac89f604026a87
data/.circleci/config.yml CHANGED
@@ -37,31 +37,23 @@ jobs:
37
37
  workflows:
38
38
  ci:
39
39
  jobs:
40
+ - bundle_and_test:
41
+ name: "ruby4-0_rails8-1"
42
+ ruby_version: "4.0.2"
43
+ rails_version: "8.1.3"
44
+ - bundle_and_test:
45
+ name: "ruby4-0_rails8-0"
46
+ ruby_version: "4.0.2"
47
+ rails_version: "8.0.5"
40
48
  - bundle_and_test:
41
49
  name: "ruby3-4_rails8-0"
42
- ruby_version: "3.4.5"
43
- rails_version: "8.0.1"
50
+ ruby_version: "3.4.9"
51
+ rails_version: "8.0.5"
44
52
  - bundle_and_test:
45
53
  name: "ruby3-3_rails8-0"
46
- ruby_version: "3.3.4"
47
- rails_version: "8.0.1"
54
+ ruby_version: "3.3.11"
55
+ rails_version: "8.0.5"
48
56
  - bundle_and_test:
49
57
  name: "ruby3-3_rails7-2"
50
- ruby_version: "3.3.4"
51
- rails_version: "7.2.1"
52
- - bundle_and_test:
53
- name: "ruby3-2_rails7-1"
54
- ruby_version: "3.2.5"
55
- rails_version: "7.1.4"
56
- - bundle_and_test:
57
- name: "ruby3-1_rails7-1"
58
- ruby_version: "3.1.6"
59
- rails_version: "7.1.4"
60
- - bundle_and_test:
61
- name: "ruby3-2_rails7-0"
62
- ruby_version: "3.2.5"
63
- rails_version: "7.0.8.4"
64
- - bundle_and_test:
65
- name: "ruby3-1_rails7-0"
66
- ruby_version: "3.1.6"
67
- rails_version: "7.0.8.4"
58
+ ruby_version: "3.3.11"
59
+ rails_version: "7.2.3.1"
data/Gemfile CHANGED
@@ -6,3 +6,7 @@ gemspec
6
6
  gem 'byebug'
7
7
  gem 'pry-byebug' unless ENV['CI']
8
8
  gem 'psych', '< 4' # pinned to less than 4 due to ActiveFedora not specifying this restriction
9
+
10
+ # Workaround faraday and rdf issue in CI and dev environments
11
+ gem 'faraday', '>= 2.9.2'
12
+ gem 'rdf', '>= 3.3.2'
data/docker-compose.yml CHANGED
@@ -4,9 +4,11 @@ volumes:
4
4
 
5
5
  services:
6
6
  fedora:
7
- image: ghcr.io/samvera/fcrepo4:4.7.5
7
+ image: fcrepo/fcrepo:6.5.1-tomcat9
8
8
  volumes:
9
9
  - fedora:/data
10
+ environment:
11
+ - CATALINA_OPTS=-Dfcrepo.autoversioning.enabled=false
10
12
  ports:
11
13
  - '8986:8080'
12
14
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'ostruct'
3
+ require 'speedy_af/errors'
3
4
 
4
5
  module SpeedyAF
5
6
  class Base
@@ -42,7 +43,11 @@ module SpeedyAF
42
43
  end
43
44
 
44
45
  def find(id, opts = {})
45
- where(%(id:"#{id}"), opts.merge(rows: 1)).first
46
+ raise ArgumentError, "Couldn't find SpeedyAF::Base without an ID" if id.blank?
47
+ result = where(%(id:"#{id}"), opts.merge(rows: 1)).first
48
+ raise SpeedyAF::RecordNotFound, "Couldn't find SpeedyAF::Base with ID '#{id}'" if result.blank?
49
+ raise SpeedyAF::ModelMismatch if self != result.class && self != SpeedyAF::Base
50
+ result
46
51
  end
47
52
 
48
53
  def where(query, opts = {})
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ module SpeedyAF
3
+ class ProxyError < StandardError; end
4
+ class ModelMismatch < ProxyError; end
5
+ class RecordNotFound < ProxyError; end
6
+ end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SpeedyAF
3
- VERSION = '0.5.1'
3
+ VERSION = '0.6.1'
4
4
  end
@@ -70,3 +70,5 @@ module SpeedySpecs
70
70
  class DeepClass < ActiveFedora::Base
71
71
  end
72
72
  end
73
+
74
+ class SpeedyAF::Proxy::Book < SpeedyAF::Base; end
@@ -62,9 +62,28 @@ describe SpeedyAF::Base do
62
62
  expect { book_presenter.fthagn }.to raise_error(NoMethodError)
63
63
  end
64
64
 
65
- it '.find' do
66
- expect(book_presenter).to be_a(described_class)
67
- expect(book_presenter.publisher).to eq(book.publisher)
65
+ context '.find' do
66
+ it 'locates the correct presenter' do
67
+ expect(book_presenter).to be_a(described_class)
68
+ expect(book_presenter.publisher).to eq(book.publisher)
69
+ end
70
+
71
+ it 'raises ArgumentError if id is blank' do
72
+ expect { SpeedyAF::Base.find(nil) }.to raise_error(ArgumentError, "Couldn't find SpeedyAF::Base without an ID")
73
+ end
74
+
75
+ it 'raises RecordNotFound if id is not found' do
76
+ expect { SpeedyAF::Base.find('foo') }.to raise_error(SpeedyAF::RecordNotFound, "Couldn't find SpeedyAF::Base with ID 'foo'")
77
+ end
78
+
79
+ context 'proxy subclass' do
80
+ it 'does not raise error for matching model' do
81
+ expect { SpeedyAF::Proxy::Book.find(book.id) }.to_not raise_error
82
+ end
83
+ it 'raises error for mismatched model' do
84
+ expect { SpeedyAF::Proxy::Book.find(library.id) }.to raise_error(SpeedyAF::ModelMismatch)
85
+ end
86
+ end
68
87
  end
69
88
 
70
89
  it '.where' do
data/speedy-af.gemspec CHANGED
@@ -35,4 +35,5 @@ Gem::Specification.new do |s|
35
35
  s.add_development_dependency 'rake'
36
36
  s.add_development_dependency 'rdoc'
37
37
  s.add_development_dependency 'bixby'
38
+ s.add_development_dependency 'benchmark' # Needed for bixby/rubocop in ruby 4+
38
39
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speedy-af
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael B. Klein
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-08-06 00:00:00.000000000 Z
10
+ date: 2026-04-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: active-fedora
@@ -177,6 +177,20 @@ dependencies:
177
177
  - - ">="
178
178
  - !ruby/object:Gem::Version
179
179
  version: '0'
180
+ - !ruby/object:Gem::Dependency
181
+ name: benchmark
182
+ requirement: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
180
194
  description: Performance enhancements for ActiveFedora
181
195
  email: mbklein@gmail.com
182
196
  executables: []
@@ -199,6 +213,7 @@ files:
199
213
  - lib/speedy-af.rb
200
214
  - lib/speedy_af.rb
201
215
  - lib/speedy_af/base.rb
216
+ - lib/speedy_af/errors.rb
202
217
  - lib/speedy_af/indexed_content.rb
203
218
  - lib/speedy_af/ordered_aggregation_index.rb
204
219
  - lib/speedy_af/version.rb