blacklight-hierarchy 6.4.0 → 6.5.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 +4 -4
- data/.github/workflows/ruby.yml +7 -11
- data/README.md +7 -0
- data/app/models/blacklight/hierarchy/facet_tree.rb +2 -0
- data/blacklight-hierarchy.gemspec +1 -1
- data/lib/blacklight/hierarchy/version.rb +1 -1
- data/spec/models/blacklight/hierarchy/facet_tree_spec.rb +57 -0
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0087020faf523fb8671351fa18c62b7d4f2bd09f254b24564a5a5d7aac9d5593'
|
4
|
+
data.tar.gz: 6ffb7349402eea8340d105cc747d95d0089c94a552700f5f1106cb6fb069173a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66d064cea30098266d2276b2806775a348250f8f1eb9bd27958018502589dbd6402bf18273ab1cd034e85a6747ef0fa74aee88e93d0d1bda71552284c656d192
|
7
|
+
data.tar.gz: 685bd238b6bec0f0c41d2b3bbd831111734c3b472f5949e8f27b90f13ffa3c387784d486b617b4cab07ba5b16e490bd6584c94b0c20e557f0c0479a5697107d3
|
data/.github/workflows/ruby.yml
CHANGED
@@ -18,18 +18,16 @@ jobs:
|
|
18
18
|
runs-on: ubuntu-latest
|
19
19
|
strategy:
|
20
20
|
matrix:
|
21
|
-
ruby: ["3.
|
22
|
-
rails_version: ["7.
|
23
|
-
blacklight_version: ["
|
21
|
+
ruby: ["3.3", "3.4"]
|
22
|
+
rails_version: ["7.2.2.1", "8.0.2"]
|
23
|
+
blacklight_version: ["8.8.4"]
|
24
24
|
include:
|
25
|
-
- ruby: "3.1"
|
26
|
-
rails_version: "6.1.7.8"
|
27
25
|
- ruby: "3.2"
|
28
|
-
rails_version: "7.
|
26
|
+
rails_version: "7.1.3.4"
|
29
27
|
- ruby: "3.3"
|
30
28
|
rails_version: "7.1.3.4"
|
31
|
-
name: "Blacklight
|
32
|
-
blacklight_version: "
|
29
|
+
name: "Blacklight 7"
|
30
|
+
blacklight_version: "7.38.0"
|
33
31
|
env:
|
34
32
|
BLACKLIGHT_VERSION: ${{ matrix.blacklight_version }}
|
35
33
|
steps:
|
@@ -39,8 +37,6 @@ jobs:
|
|
39
37
|
with:
|
40
38
|
ruby-version: ${{ matrix.ruby }}
|
41
39
|
bundler: latest
|
42
|
-
- name: Change permissions
|
43
|
-
run: "chmod -f -R o-w /opt/hostedtoolcache/Ruby/3.2.5/x64/lib/ruby/gems/3.2.0/gems | :"
|
44
40
|
- name: Install dependencies
|
45
41
|
run: bundle install
|
46
42
|
env:
|
@@ -49,4 +45,4 @@ jobs:
|
|
49
45
|
run: bundle exec rake ci
|
50
46
|
env:
|
51
47
|
RAILS_VERSION: ${{ matrix.rails_version }}
|
52
|
-
ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test"
|
48
|
+
ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-kamal --skip-solid --skip-coffee --skip-test -a propshaft --css=bootstrap"
|
data/README.md
CHANGED
@@ -146,3 +146,10 @@ $ npm publish
|
|
146
146
|
- WRITE TESTS
|
147
147
|
- Switch internal facet management from hack-y Hash to `Blacklight::Hierarchy::FacetGroup` class (already implemented, but not plumbed up)
|
148
148
|
- Clarify when suffix is applied/required/etc.
|
149
|
+
|
150
|
+
## Developing gem
|
151
|
+
- Clone locally `git@github.com:sul-dlss/blacklight-hierarchy.git`
|
152
|
+
- go into project directory `cd blacklight-hierarchy`
|
153
|
+
- install dependencies `bundle install`
|
154
|
+
- Create a test app to develop and test against `bundle exec rake engine_cart:generate
|
155
|
+
- Run tests `bundle exec rspec`
|
@@ -28,6 +28,8 @@ module Blacklight
|
|
28
28
|
path = facet_item.value.split(split_regex)
|
29
29
|
loc = tree[facet_field]
|
30
30
|
loc = loc[path.shift] ||= {} while path.length > 0
|
31
|
+
raise(StandardError, "Expected non-empty array after splitting facet value. Original facet value: '#{facet_item.value}'") unless facet_item.value.split(split_regex).present?
|
32
|
+
|
31
33
|
loc[:_] = HierarchicalFacetItem.new(facet_item.value, facet_item.value.split(split_regex).last, facet_item.hits)
|
32
34
|
end
|
33
35
|
end
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ['lib']
|
20
20
|
|
21
21
|
s.add_dependency 'blacklight', '>= 7.18', '< 9'
|
22
|
-
s.add_dependency 'rails', '>=
|
22
|
+
s.add_dependency 'rails', '>= 7.1', '< 9'
|
23
23
|
s.add_dependency 'deprecation'
|
24
24
|
|
25
25
|
s.add_development_dependency 'rsolr'
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Blacklight::Hierarchy::FacetTree do
|
4
|
+
let(:prefix) { 'lc' }
|
5
|
+
let(:facet_display) { { hierarchy: { 'lc' => [['facet'], ':'] } } }
|
6
|
+
let(:display_facet) do
|
7
|
+
instance_double(Blacklight::Solr::Response::Facets::FacetField, name: 'lc_facet', items:, limit: 1001, sort: :index, offset: 0, prefix: nil)
|
8
|
+
end
|
9
|
+
let(:items) do
|
10
|
+
[
|
11
|
+
Blacklight::Solr::Response::Facets::FacetItem.new(label: ':', value: ':', hits: 100),
|
12
|
+
Blacklight::Solr::Response::Facets::FacetItem.new(label: 'A - General Works', value: 'A - General Works', hits: 5),
|
13
|
+
Blacklight::Solr::Response::Facets::FacetItem.new(label: 'A - General Works:AC - Collections Works', value: 'A - General Works:AC - Collections Works', hits: 4)
|
14
|
+
]
|
15
|
+
end
|
16
|
+
let(:facet_field) do
|
17
|
+
instance_double(
|
18
|
+
Blacklight::FacetFieldPresenter,
|
19
|
+
display_facet:,
|
20
|
+
key: 'lc_facet',
|
21
|
+
label: 'Classification'
|
22
|
+
)
|
23
|
+
end
|
24
|
+
context 'with only valid items' do
|
25
|
+
let(:items) do
|
26
|
+
[
|
27
|
+
Blacklight::Solr::Response::Facets::FacetItem.new(label: 'A - General Works', value: 'A - General Works', hits: 5),
|
28
|
+
Blacklight::Solr::Response::Facets::FacetItem.new(label: 'A - General Works:AC - Collections Works', value: 'A - General Works:AC - Collections Works', hits: 4)
|
29
|
+
]
|
30
|
+
end
|
31
|
+
it 'creates HierarchicalFacetItems' do
|
32
|
+
facet_tree = described_class.build(prefix:, facet_display:, facet_field:)
|
33
|
+
expect(facet_tree['lc_facet'].size).to eq(1)
|
34
|
+
expect(facet_tree['lc_facet'].keys.first).to eq('A - General Works')
|
35
|
+
expect(facet_tree['lc_facet']['A - General Works'].keys).to match_array([:_, 'AC - Collections Works'])
|
36
|
+
expect(facet_tree['lc_facet']['A - General Works'][:_]).to be_an_instance_of(HierarchicalFacetItem)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
context 'with an invalid item' do
|
42
|
+
let(:items) do
|
43
|
+
[
|
44
|
+
Blacklight::Solr::Response::Facets::FacetItem.new(label: ':', value: ':', hits: 100),
|
45
|
+
Blacklight::Solr::Response::Facets::FacetItem.new(label: 'A - General Works', value: 'A - General Works', hits: 5),
|
46
|
+
Blacklight::Solr::Response::Facets::FacetItem.new(label: 'A - General Works:AC - Collections Works', value: 'A - General Works:AC - Collections Works', hits: 4)
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'raises an error' do
|
51
|
+
expect do
|
52
|
+
described_class.build(prefix:, facet_display:, facet_field:)
|
53
|
+
end.to raise_error(StandardError, "Expected non-empty array after splitting facet value. Original facet value: ':'")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-hierarchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael B. Klein
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-04-04 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: blacklight
|
@@ -36,20 +35,20 @@ dependencies:
|
|
36
35
|
requirements:
|
37
36
|
- - ">="
|
38
37
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
38
|
+
version: '7.1'
|
40
39
|
- - "<"
|
41
40
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
41
|
+
version: '9'
|
43
42
|
type: :runtime
|
44
43
|
prerelease: false
|
45
44
|
version_requirements: !ruby/object:Gem::Requirement
|
46
45
|
requirements:
|
47
46
|
- - ">="
|
48
47
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
48
|
+
version: '7.1'
|
50
49
|
- - "<"
|
51
50
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
51
|
+
version: '9'
|
53
52
|
- !ruby/object:Gem::Dependency
|
54
53
|
name: deprecation
|
55
54
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,13 +179,13 @@ files:
|
|
180
179
|
- package.json
|
181
180
|
- spec/features/basic_spec.rb
|
182
181
|
- spec/helpers/hierarchy_helper_spec.rb
|
182
|
+
- spec/models/blacklight/hierarchy/facet_tree_spec.rb
|
183
183
|
- spec/spec_helper.rb
|
184
184
|
- spec/test_app_templates/Gemfile.extra
|
185
185
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
186
186
|
homepage: https://github.com/sul-dlss/blacklight-hierarchy
|
187
187
|
licenses: []
|
188
188
|
metadata: {}
|
189
|
-
post_install_message:
|
190
189
|
rdoc_options: []
|
191
190
|
require_paths:
|
192
191
|
- lib
|
@@ -201,13 +200,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
200
|
- !ruby/object:Gem::Version
|
202
201
|
version: '0'
|
203
202
|
requirements: []
|
204
|
-
rubygems_version: 3.
|
205
|
-
signing_key:
|
203
|
+
rubygems_version: 3.6.3
|
206
204
|
specification_version: 4
|
207
205
|
summary: Hierarchical Facets for Blacklight
|
208
206
|
test_files:
|
209
207
|
- spec/features/basic_spec.rb
|
210
208
|
- spec/helpers/hierarchy_helper_spec.rb
|
209
|
+
- spec/models/blacklight/hierarchy/facet_tree_spec.rb
|
211
210
|
- spec/spec_helper.rb
|
212
211
|
- spec/test_app_templates/Gemfile.extra
|
213
212
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|