speedy-af 0.3.0 → 0.4.0

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: f90da5142141870db8a58733e7456af65d963a3de8ed26e40af1c1d23fba022a
4
- data.tar.gz: a995000c4e447c04073f22884d7608c33fb9a6401d839ef613007818ebb4d648
3
+ metadata.gz: 0fd6d0ac71c3da9c7807fe63bf98774a75abf4796130be797e19a9eba4ac6292
4
+ data.tar.gz: 549a1835b24011c7ebebef142654afb7c8ab0afdd0b70e39a713e7e1c9055dca
5
5
  SHA512:
6
- metadata.gz: d07dc9fdfabc614b2ad7ba5960da463d102f07680626efa40e1446087ea027b243fe29ac28be4ad01866c5edbff3663ee9bc846297c3bd3815fc481dd7564b90
7
- data.tar.gz: 445ce106eabd70703ad9b96ef3c91a657fd6500d82e8b7c9d8e3c52baf48030d01601fc21f95ac57a5832f721621db8aa535ddf2bac546381d2c0e0b9eacdb29
6
+ metadata.gz: 50e4f754a2f59937b4d08a3ccd9d460e64ecbba50d1e5eed821a28fcb77aab99f77a62307c9185269d27ac1f0baab58e72f8e56cc9debbab71bd99c2c54700e5
7
+ data.tar.gz: f0f1e0fd4e04f475085ada08769cf9617a95f6ddcd2b0955cea44adc91284844862d0c3c6729c9bc17c32ba456067e448d83c81be9899520003b5dea3b142ed1
data/.circleci/config.yml CHANGED
@@ -10,7 +10,7 @@ jobs:
10
10
  type: string
11
11
  bundler_version:
12
12
  type: string
13
- default: 2.0.2
13
+ default: 2.5.18
14
14
  ffmpeg_version:
15
15
  type: string
16
16
  default: 4.1.4
@@ -38,18 +38,22 @@ workflows:
38
38
  ci:
39
39
  jobs:
40
40
  - bundle_and_test:
41
- name: "ruby2-7_rails7-0"
42
- ruby_version: "2.7.6"
43
- rails_version: "7.0.4"
41
+ name: "ruby3-3_rails7-2"
42
+ ruby_version: "3.3.4"
43
+ rails_version: "7.2.1"
44
44
  - bundle_and_test:
45
- name: "ruby2-7_rails6-1"
46
- ruby_version: "2.7.6"
47
- rails_version: "6.1.7"
45
+ name: "ruby3-2_rails7-1"
46
+ ruby_version: "3.2.5"
47
+ rails_version: "7.1.4"
48
48
  - bundle_and_test:
49
- name: "ruby2-7_rails6-0"
50
- ruby_version: "2.7.6"
51
- rails_version: "6.0.6"
49
+ name: "ruby3-1_rails7-1"
50
+ ruby_version: "3.1.6"
51
+ rails_version: "7.1.4"
52
52
  - bundle_and_test:
53
- name: "ruby2-7_rails5-2"
54
- ruby_version: "2.7.6"
55
- rails_version: "5.2.8.1"
53
+ name: "ruby3-2_rails7-0"
54
+ ruby_version: "3.2.5"
55
+ rails_version: "7.0.8.4"
56
+ - bundle_and_test:
57
+ name: "ruby3-1_rails7-0"
58
+ ruby_version: "3.1.6"
59
+ rails_version: "7.0.8.4"
data/Rakefile CHANGED
@@ -5,6 +5,15 @@ require 'active_fedora/rake_support'
5
5
  require 'bundler'
6
6
  Bundler::GemHelper.install_tasks
7
7
 
8
+ # This is to fix a breaking change with Ruby 3.2 where some methods
9
+ # in fcrepo_wrapper use the removed `File.exists?` alias, preventing
10
+ # tests from being set up.
11
+ class File
12
+ class << self
13
+ alias exists? exist?
14
+ end
15
+ end
16
+
8
17
  require 'rspec/core/rake_task'
9
18
  desc 'Run tests only'
10
19
  RSpec::Core::RakeTask.new(:rspec) do |spec|
@@ -42,11 +42,11 @@ module SpeedyAF
42
42
  end
43
43
 
44
44
  def find(id, opts = {})
45
- where(%(id:"#{id}"), opts).first
45
+ where(%(id:"#{id}"), opts.merge(rows: 1)).first
46
46
  end
47
47
 
48
48
  def where(query, opts = {})
49
- docs = ActiveFedora::SolrService.query(query, rows: SOLR_ALL)
49
+ docs = ActiveFedora::SolrService.query(query, rows: opts[:rows] || SOLR_ALL)
50
50
  from(docs, opts)
51
51
  end
52
52
 
@@ -92,7 +92,10 @@ module SpeedyAF
92
92
 
93
93
  def query_for_belongs_to(proxy_hash, _opts)
94
94
  proxy_hash.collect do |_id, proxy|
95
- proxy.belongs_to_reflections.collect { |_name, reflection| "id:#{proxy.attrs[predicate_for_reflection(reflection).to_sym]}" }
95
+ proxy.belongs_to_reflections.collect do |_name, reflection|
96
+ id = proxy.attrs[predicate_for_reflection(reflection).to_sym]
97
+ id.blank? ? nil : "id:#{id}"
98
+ end.compact
96
99
  end.flatten.join(" OR ")
97
100
  end
98
101
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SpeedyAF
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
@@ -61,7 +61,7 @@ describe SpeedyAF::Base do
61
61
  end
62
62
 
63
63
  it '.to_query' do
64
- expect(book.to_query('book_id')).to eq("book_id=#{URI.encode(book.id, /[^\-_.!~*'()a-zA-Z\d;?:@&=+$,\[\]]/)}")
64
+ expect(book.to_query('book_id')).to eq("book_id=#{URI::Parser.new.escape(book.id, /[^\-_.!~*'()a-zA-Z\d;?:@&=+$,\[\]]/)}")
65
65
  end
66
66
 
67
67
  context 'reflections' do
@@ -105,6 +105,15 @@ describe SpeedyAF::Base do
105
105
  expect(book_presenter).not_to be_real
106
106
  end
107
107
 
108
+ context 'missing parent id' do
109
+ let(:book) { Book.new title: 'Ordered Things', publisher: 'ActiveFedora Performance LLC', library: nil }
110
+ it 'does not cause belongs_to reflections to error' do
111
+ expect(book_presenter.library_id).to be_nil
112
+ expect(book_presenter.library).to be_nil
113
+ expect(book_presenter).not_to be_real
114
+ end
115
+ end
116
+
108
117
  context 'preloaded subresources' do
109
118
  let(:book_presenter) { described_class.find(book.id, load_reflections: true) }
110
119
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speedy-af
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael B. Klein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-18 00:00:00.000000000 Z
11
+ date: 2024-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active-fedora
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  - !ruby/object:Gem::Version
227
227
  version: '0'
228
228
  requirements: []
229
- rubygems_version: 3.1.6
229
+ rubygems_version: 3.5.16
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: Performance enhancements for ActiveFedora