blacklight 7.34.0 → 7.36.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: 65ccb9085e62a93389eab98519e5cb673b61d8fc3c6e973a2810e4ac66a87cf1
4
- data.tar.gz: 56e423a036a4e82382f6bda36084b79758c966ccc8757dfe004deb26963ee400
3
+ metadata.gz: d0a27a3fed4a939867c1fcbce79c7a1eaf6e8009db94369256b0c8f5de7d38d7
4
+ data.tar.gz: eba03e7545e6ea1f9a6d403f01e51ba53775fa823a3c915f335364b61edd3c99
5
5
  SHA512:
6
- metadata.gz: 49ebde9d47e594d7ddeaaf893f2a9a99c4162592065800d8c4d5b3f84b7e08d2c95a57f47f20a079b0ba8bfc36e6c83fc31e96aa4587695db913a40194999a42
7
- data.tar.gz: 94a1cfe6e885d009a1117a7bede81a4db4f8215cd8b3f37b2d38fa89da17e239478556809f2265fb9a47761644da5c0ef6487042276655151b9372b0919664f8
6
+ metadata.gz: d35343c758cf2b280c5c7a22832b0b5051bdf10a2677f29d1b5f91f4904f2eeb420f12299e4755d67fda78b78d46308848eb248a46f5f6b92f1a7b0a12d97888
7
+ data.tar.gz: a92edba7cad9d2a755943f2231de4baec6213047350a0fc88c72514dea94caf5cd97b68b5120d4c81d6299c661a89bcb26a9eaeafbb424ad53929c6b384d9034
data/.env CHANGED
@@ -1,5 +1,5 @@
1
- ALPINE_RUBY_VERSION=2.7.5
2
- RAILS_VERSION=5.2.6
1
+ ALPINE_RUBY_VERSION=3.2.2
2
+ RAILS_VERSION=7.0.8
3
3
  VIEW_COMPONENT_VERSION=2.6.6
4
4
  SOLR_PORT=8983
5
5
  SOLR_URL=http://solr:8983/solr/blacklight-core
@@ -23,7 +23,7 @@ jobs:
23
23
  uses: ruby/setup-ruby@v1
24
24
  with:
25
25
  ruby-version: 2.7
26
- bundler: 'latest'
26
+ bundler: 'default'
27
27
  - name: Install dependencies
28
28
  run: bundle install
29
29
  - name: Run linter
@@ -32,14 +32,16 @@ jobs:
32
32
  runs-on: ubuntu-latest
33
33
  strategy:
34
34
  matrix:
35
- ruby: [2.7, '3.0', 3.1, 3.2]
35
+ ruby: [3.1, 3.2]
36
+ env:
37
+ RAILS_VERSION: 7.0.8
36
38
  steps:
37
39
  - uses: actions/checkout@v2
38
40
  - name: Set up Ruby
39
41
  uses: ruby/setup-ruby@v1
40
42
  with:
41
43
  ruby-version: ${{ matrix.ruby }}
42
- bundler: 'latest'
44
+ bundler: 'default'
43
45
  - name: Install dependencies
44
46
  run: bundle install
45
47
  - name: Run tests
@@ -51,13 +53,15 @@ jobs:
51
53
  strategy:
52
54
  matrix:
53
55
  ruby: ['3.0']
56
+ env:
57
+ RAILS_VERSION: 7.0.8
54
58
  steps:
55
59
  - uses: actions/checkout@v2
56
60
  - name: Set up Ruby
57
61
  uses: ruby/setup-ruby@v1
58
62
  with:
59
63
  ruby-version: ${{ matrix.ruby }}
60
- bundler: 'latest'
64
+ bundler: 'default'
61
65
  - name: Install dependencies
62
66
  run: bundle install
63
67
  - name: Run tests
@@ -76,7 +80,7 @@ jobs:
76
80
  uses: ruby/setup-ruby@v1
77
81
  with:
78
82
  ruby-version: ${{ matrix.ruby }}
79
- bundler: 'latest'
83
+ bundler: 'default'
80
84
  - name: Install dependencies
81
85
  run: bundle install
82
86
  env:
@@ -97,7 +101,7 @@ jobs:
97
101
  uses: ruby/setup-ruby@v1
98
102
  with:
99
103
  ruby-version: ${{ matrix.ruby }}
100
- bundler: 'latest'
104
+ bundler: 'default'
101
105
  - name: Install dependencies
102
106
  run: bundle install
103
107
  env:
@@ -107,27 +111,25 @@ jobs:
107
111
  env:
108
112
  RAILS_VERSION: 5.2.8.1
109
113
  ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
110
-
111
114
  test_rails6_1:
112
115
  runs-on: ubuntu-latest
113
116
  strategy:
114
117
  matrix:
115
118
  ruby: ['3.0']
119
+ env:
120
+ RAILS_VERSION: 6.1.6.1
116
121
  steps:
117
122
  - uses: actions/checkout@v2
118
123
  - name: Set up Ruby
119
124
  uses: ruby/setup-ruby@v1
120
125
  with:
121
126
  ruby-version: ${{ matrix.ruby }}
122
- bundler: 'latest'
127
+ bundler: 'default'
123
128
  - name: Install dependencies
124
129
  run: bundle install
125
- env:
126
- RAILS_VERSION: 6.1.6.1
127
130
  - name: Run tests
128
131
  run: bundle exec rake ci
129
132
  env:
130
- RAILS_VERSION: 6.1.6.1
131
133
  ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-keeps --skip-action-cable --skip-test'
132
134
  test_vc3:
133
135
  runs-on: ubuntu-latest
@@ -135,6 +137,7 @@ jobs:
135
137
  matrix:
136
138
  ruby: ['3.2']
137
139
  env:
140
+ RAILS_VERSION: 7.0.8
138
141
  VIEW_COMPONENT_VERSION: ${{ matrix.view_component_version }}
139
142
  steps:
140
143
  - uses: actions/checkout@v2
@@ -142,7 +145,7 @@ jobs:
142
145
  uses: ruby/setup-ruby@v1
143
146
  with:
144
147
  ruby-version: ${{ matrix.ruby }}
145
- bundler: 'latest'
148
+ bundler: 'default'
146
149
  - name: Install dependencies
147
150
  run: bundle install
148
151
  - name: Run tests
@@ -154,12 +157,14 @@ jobs:
154
157
  strategy:
155
158
  matrix:
156
159
  ruby: [2.7, '3.0']
160
+ env:
161
+ RAILS_VERSION: 7.0.8
157
162
  steps:
158
163
  - uses: actions/checkout@v2
159
164
  - name: Set up Ruby
160
165
  uses: ruby/setup-ruby@v1
161
166
  with:
162
- bundler: 'latest'
167
+ bundler: 'default'
163
168
  ruby-version: ${{ matrix.ruby }}
164
169
  - name: Install dependencies
165
170
  run: bundle install
data/Gemfile CHANGED
@@ -48,3 +48,29 @@ end
48
48
  # END ENGINE_CART BLOCK
49
49
 
50
50
  eval_gemfile File.expand_path("spec/test_app_templates/Gemfile.extra", File.dirname(__FILE__))
51
+
52
+ gem "rubocop", "~> 1.60"
53
+
54
+ gem "rubocop-capybara", "~> 2.20"
55
+
56
+ gem "rubocop-rspec", "~> 2.26"
57
+
58
+ gem "rubocop-rails", "~> 2.23"
59
+
60
+ gem "rspec", "~> 3.12"
61
+
62
+ gem "simplecov", "~> 0.22.0"
63
+
64
+ gem "engine_cart", "~> 2.6"
65
+
66
+ gem "rspec-rails", "~> 6.1"
67
+
68
+ gem "rspec-collection_matchers", "~> 1.2"
69
+
70
+ gem "capybara", "~> 3.39"
71
+
72
+ gem "selenium-webdriver", "~> 4.16"
73
+
74
+ gem "equivalent-xml", "~> 0.6.0"
75
+
76
+ gem "axe-core-rspec", "~> 4.8"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.34.0
1
+ 7.36.0
@@ -33,7 +33,7 @@ module Blacklight
33
33
  options = sort_fields.values.map { |field_config| [helpers.sort_field_label(field_config.key), field_config.key] }
34
34
  return unless options.any?
35
35
 
36
- select_tag(:sort, options_for_select(options, params[:sort]), class: "form-control sort-select w-auto", aria: { labelledby: 'advanced-search-sort-label' })
36
+ select_tag(:sort, options_for_select(options, params[:sort]), class: "form-select custom-select sort-select w-auto", aria: { labelledby: 'advanced-search-sort-label' })
37
37
  end
38
38
 
39
39
  private
@@ -20,7 +20,7 @@
20
20
  <div class="more_facets">
21
21
  <%= link_to t("more_#{@facet_field.key}_html", scope: 'blacklight.search.facets', default: :more_html, field_name: @facet_field.label),
22
22
  @facet_field.modal_path,
23
- data: { blacklight_modal: 'trigger' } %>
23
+ data: { blacklight_modal: 'trigger', turbo: false } %>
24
24
  </div>
25
25
  <% end %>
26
26
  </div>
@@ -42,7 +42,11 @@ module Blacklight::Bookmarks
42
42
  @bookmarks = token_or_current_or_guest_user.bookmarks
43
43
  bookmark_ids = @bookmarks.collect { |b| b.document_id.to_s }
44
44
  @response, deprecated_document_list = search_service.fetch(bookmark_ids)
45
- @document_list = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(deprecated_document_list, "The @document_list instance variable is now deprecated and will be removed in Blacklight 8.0")
45
+ @document_list = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
46
+ deprecated_document_list,
47
+ "The @document_list instance variable is now deprecated",
48
+ ActiveSupport::Deprecation.new("8.0", "blacklight")
49
+ )
46
50
 
47
51
  respond_to do |format|
48
52
  format.html {}
@@ -34,7 +34,11 @@ module Blacklight::Catalog
34
34
  def index
35
35
  (@response, deprecated_document_list) = search_service.search_results
36
36
 
37
- @document_list = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(deprecated_document_list, 'The @document_list instance variable is deprecated; use @response.documents instead.')
37
+ @document_list = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
38
+ deprecated_document_list,
39
+ 'The @document_list instance variable is deprecated; use @response.documents instead.',
40
+ ActiveSupport::Deprecation.new("8.0", "blacklight")
41
+ )
38
42
 
39
43
  respond_to do |format|
40
44
  format.html { store_preferred_view }
@@ -53,7 +57,11 @@ module Blacklight::Catalog
53
57
  # to add responses for formats other than html or json see _Blacklight::Document::Export_
54
58
  def show
55
59
  deprecated_response, @document = search_service.fetch(params[:id])
56
- @response = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(deprecated_response, 'The @response instance variable is deprecated; use @document.response instead.')
60
+ @response = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
61
+ deprecated_response,
62
+ 'The @response instance variable is deprecated; use @document.response instead.',
63
+ ActiveSupport::Deprecation.new("8.0", "blacklight")
64
+ )
57
65
 
58
66
  respond_to do |format|
59
67
  format.html { @search_context = setup_next_and_previous_documents }
@@ -28,6 +28,16 @@ module Blacklight::Document
28
28
  def find id
29
29
  repository.find(id).documents.first
30
30
  end
31
+
32
+ # In Rails 7.1+, needs this method
33
+ def composite_primary_key?
34
+ false
35
+ end
36
+
37
+ # In Rails 7.1+, needs this method
38
+ def has_query_constraints?
39
+ false
40
+ end
31
41
  end
32
42
 
33
43
  ##
data/app/models/search.rb CHANGED
@@ -4,7 +4,12 @@ class Search < ApplicationRecord
4
4
  belongs_to :user, optional: true
5
5
 
6
6
  # use a backwards-compatible serializer until the Rails API stabilizes and we can evaluate for major-revision compatibility
7
- serialize :query_params, Blacklight::SearchParamsYamlCoder
7
+ if ::Rails.version.to_f >= 7.1
8
+ # non-deprecated coder: keyword arg for Rails 7.1+
9
+ serialize :query_params, coder: Blacklight::SearchParamsYamlCoder
10
+ else
11
+ serialize :query_params, Blacklight::SearchParamsYamlCoder
12
+ end
8
13
 
9
14
  # A Search instance is considered a saved search if it has a user_id.
10
15
  def saved?
@@ -22,17 +22,19 @@ module Blacklight
22
22
 
23
23
  # @return [Array]
24
24
  def fetch
25
- Array.wrap(
26
- if field_config.highlight
27
- retrieve_highlight
28
- elsif field_config.accessor
29
- retieve_using_accessor
30
- elsif field_config.values
31
- retrieve_values
32
- else
33
- retrieve_simple
34
- end
35
- )
25
+ if field_config.highlight
26
+ value = retrieve_highlight
27
+ end
28
+ if value.blank?
29
+ value = if field_config.accessor
30
+ retieve_using_accessor
31
+ elsif field_config.values
32
+ retrieve_values
33
+ else
34
+ retrieve_simple
35
+ end
36
+ end
37
+ Array.wrap(value)
36
38
  end
37
39
 
38
40
  private
@@ -1,4 +1,4 @@
1
- <div id="blacklight-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
1
+ <div id="blacklight-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" data-turbo="false">
2
2
  <div class="modal-dialog modal-lg" role="document">
3
3
  <div class="modal-content">
4
4
  </div>
data/blacklight.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
 
26
26
  s.required_ruby_version = '>= 2.5'
27
27
 
28
- s.add_dependency "rails", '>= 5.1', '< 7.1'
28
+ s.add_dependency "rails", '>= 5.1', '< 7.2'
29
29
  s.add_dependency "globalid"
30
30
  s.add_dependency "jbuilder", '~> 2.7'
31
31
  s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.add_dependency 'hashdiff'
37
37
 
38
38
  s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
39
- s.add_development_dependency "rspec-rails", "~> 5.0"
39
+ s.add_development_dependency "rspec-rails", ">= 5.0" # some versions tested need >= 6.0
40
40
  s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
41
41
  s.add_development_dependency 'axe-core-rspec'
42
42
  s.add_development_dependency "capybara", '~> 3'
@@ -6,6 +6,17 @@ module Blacklight
6
6
  class Engine < Rails::Engine
7
7
  engine_name "blacklight"
8
8
 
9
+ config.before_configuration do
10
+ # see https://github.com/fxn/zeitwerk#for_gem
11
+ # Blacklight puts a generator into LOCAL APP lib/generators, so tell
12
+ # zeitwerk to ignore the whole directory? If we're using zeitwerk
13
+ #
14
+ # https://github.com/cbeer/engine_cart/issues/117
15
+ if Rails.try(:autoloaders).try(:main).respond_to?(:ignore)
16
+ Rails.autoloaders.main.ignore(Rails.root.join('lib/generators'))
17
+ end
18
+ end
19
+
9
20
  # BlacklightHelper is needed by all helpers, so we inject it
10
21
  # into action view base here.
11
22
  initializer 'blacklight.helpers' do
@@ -51,7 +51,17 @@ RSpec.describe Blacklight::FacetComponent, type: :component do
51
51
  end
52
52
 
53
53
  before do
54
- controller.view_context.view_paths.unshift(RSpec::Rails::ViewExampleGroup::StubResolverCache.resolver_for('catalog/_facet_partial.html.erb' => 'facet partial'))
54
+ # Not sure why we need to re-implement rspec's stub_template, but
55
+ # we already were, and need a Rails 7.1+ safe alternate too
56
+ # https://github.com/rspec/rspec-rails/commit/4d65bea0619955acb15023b9c3f57a3a53183da8
57
+ # https://github.com/rspec/rspec-rails/issues/2696
58
+
59
+ replace_hash = { 'catalog/_facet_partial.html.erb' => 'facet partial' }
60
+ if ::Rails.version.to_f >= 7.1
61
+ controller.prepend_view_path(RSpec::Rails::ViewExampleGroup::StubResolverCache.resolver_for(replace_hash))
62
+ else
63
+ controller.view_context.view_paths.unshift(RSpec::Rails::ViewExampleGroup::StubResolverCache.resolver_for(replace_hash))
64
+ end
55
65
  end
56
66
 
57
67
  it 'renders the partial' do
@@ -331,12 +331,17 @@ RSpec.describe BlacklightHelper do
331
331
  blacklight_config.view.gallery(template: '/my/partial')
332
332
  end
333
333
 
334
- def stub_template(hash)
335
- view.view_paths.unshift(ActionView::FixtureResolver.new(hash))
336
- end
337
-
338
334
  it 'renders that template' do
339
- stub_template 'my/_partial.html.erb' => 'some content'
335
+ # Not sure why we need to re-implement rspec's stub_template, but
336
+ # we already were, and need a Rails 7.1+ safe alternate too
337
+ # https://github.com/rspec/rspec-rails/commit/4d65bea0619955acb15023b9c3f57a3a53183da8
338
+ # https://github.com/rspec/rspec-rails/issues/2696
339
+ replace_hash = { 'my/_partial.html.erb' => 'some content' }
340
+ if ::Rails.version.to_f >= 7.1
341
+ controller.prepend_view_path(RSpec::Rails::ViewExampleGroup::StubResolverCache.resolver_for(replace_hash))
342
+ else
343
+ view.view_paths.unshift(ActionView::FixtureResolver.new(replace_hash))
344
+ end
340
345
 
341
346
  response = helper.render_document_index_with_view :gallery, [obj1, obj1]
342
347
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Blacklight::FieldRetriever, api: true do
4
+ let(:service) { described_class.new(document, blacklight_field_config) }
5
+
6
+ let(:blacklight_field_config) { Blacklight::Configuration::Field.new(field: 'author_field', highlight: true) }
7
+ let(:document) { SolrDocument.new({ 'id' => 'doc1', 'title_field' => 'doc1 title', 'author_field' => 'author_someone' }, 'highlighting' => { 'doc1' => { 'title_tsimext' => ['doc <em>1</em>'] } }) }
8
+ let(:view_context) { {} }
9
+
10
+ context "highlighting" do
11
+ describe '#fetch' do
12
+ it "retrieves an author even if it's not highlighted" do
13
+ expect(service.fetch).to eq(['author_someone'])
14
+ end
15
+ end
16
+ end
17
+ end
data/spec/spec_helper.rb CHANGED
@@ -117,3 +117,31 @@ RSpec.configure do |config|
117
117
  # as the one that triggered the failure.
118
118
  Kernel.srand config.seed
119
119
  end
120
+
121
+ # RSpec's stub_template method needs a differnet implementation for Rails 7.1, that
122
+ # isn't yet in an rspec-rails release.
123
+ #
124
+ # First rspec-rails tried this:
125
+ # https://github.com/rspec/rspec-rails/commit/4d65bea0619955acb15023b9c3f57a3a53183da8
126
+ #
127
+ # But it was subject to this problem:
128
+ # https://github.com/rspec/rspec-rails/issues/2696
129
+ #
130
+ # Below implementation appears to work for our purposes here, so we will patch it in
131
+ # if we are on Rails 7.1+, and not yet rspec-rails 6.1 which we expect to have it.
132
+
133
+ if ::Rails.version.to_f >= 7.1 && Gem.loaded_specs["rspec-rails"].version.release < Gem::Version.new('6.1')
134
+
135
+ module RSpec
136
+ module Rails
137
+ module ViewExampleGroup
138
+ module ExampleMethods
139
+ def stub_template(hash)
140
+ controller.prepend_view_path(StubResolverCache.resolver_for(hash))
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
146
+
147
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.34.0
4
+ version: 7.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2023-10-04 00:00:00.000000000 Z
20
+ date: 2024-01-18 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -28,7 +28,7 @@ dependencies:
28
28
  version: '5.1'
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
- version: '7.1'
31
+ version: '7.2'
32
32
  type: :runtime
33
33
  prerelease: false
34
34
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,7 +38,7 @@ dependencies:
38
38
  version: '5.1'
39
39
  - - "<"
40
40
  - !ruby/object:Gem::Version
41
- version: '7.1'
41
+ version: '7.2'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: globalid
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -181,14 +181,14 @@ dependencies:
181
181
  name: rspec-rails
182
182
  requirement: !ruby/object:Gem::Requirement
183
183
  requirements:
184
- - - "~>"
184
+ - - ">="
185
185
  - !ruby/object:Gem::Version
186
186
  version: '5.0'
187
187
  type: :development
188
188
  prerelease: false
189
189
  version_requirements: !ruby/object:Gem::Requirement
190
190
  requirements:
191
- - - "~>"
191
+ - - ">="
192
192
  - !ruby/object:Gem::Version
193
193
  version: '5.0'
194
194
  - !ruby/object:Gem::Dependency
@@ -894,6 +894,7 @@ files:
894
894
  - spec/presenters/thumbnail_presenter_spec.rb
895
895
  - spec/routing/catalog_routing_spec.rb
896
896
  - spec/routing/search_history_spec.rb
897
+ - spec/services/blacklight/field_retriever_spec.rb
897
898
  - spec/services/blacklight/search_service_spec.rb
898
899
  - spec/spec_helper.rb
899
900
  - spec/support/controller_level_helpers.rb
@@ -954,7 +955,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
954
955
  - !ruby/object:Gem::Version
955
956
  version: '0'
956
957
  requirements: []
957
- rubygems_version: 3.4.10
958
+ rubygems_version: 3.5.3
958
959
  signing_key:
959
960
  specification_version: 4
960
961
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
@@ -1077,6 +1078,7 @@ test_files:
1077
1078
  - spec/presenters/thumbnail_presenter_spec.rb
1078
1079
  - spec/routing/catalog_routing_spec.rb
1079
1080
  - spec/routing/search_history_spec.rb
1081
+ - spec/services/blacklight/field_retriever_spec.rb
1080
1082
  - spec/services/blacklight/search_service_spec.rb
1081
1083
  - spec/spec_helper.rb
1082
1084
  - spec/support/controller_level_helpers.rb