blacklight 6.24.0 → 6.25.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: 57d198c6aed6d4e2cca7c1945904e4b13139ba1788acd6363d427aa30d436c14
4
- data.tar.gz: 92364314b9bbb7fcb9afc3f229a641afcd05ba43e1df4b19c8512e0e256523f9
3
+ metadata.gz: 7b214e0d7059ddd49b5406ed8e21d4c6b84cee26f4d0c84d626269690eff080d
4
+ data.tar.gz: 71a8fe0e8de23865a39746fb4fe21ac0f9bc9fa4e38b96ca216f1a846e838fc7
5
5
  SHA512:
6
- metadata.gz: 11048e0150ec7619375f56771faf38d1bdd0797f0f19cf67c8d8926f9f1e26adab9caf1a0f4fae084be28807aa0ab4e7320c149f688181f49eea8dedfd73d7c7
7
- data.tar.gz: ece97e66b4d5a6c1f91b5ea9491811d06983435e592936e973de5e253fcf8405351b601999480340384ef229affa3e703b261a628a41286975b20a83e789ea2e
6
+ metadata.gz: 689f552efd8be76a0c787b11028edd52552661e7da183ac3bc054275783c1ace2d2d338db88750875acf947d16576e051489e0aa3dd52827b707088b50b0705a
7
+ data.tar.gz: 423c4fb4cbdae0d3df70098f7e10827d9ba4ec84e8ff4faaa180e4f390f4932c3943b1ec9695a831d38f184621d6c3df201515a989655a504963f5d4ae8787a3
@@ -0,0 +1,28 @@
1
+ ARG ALPINE_RUBY_VERSION
2
+
3
+ FROM ruby:${ALPINE_RUBY_VERSION}-alpine
4
+
5
+ RUN apk add --update --no-cache \
6
+ bash \
7
+ build-base \
8
+ git \
9
+ libxml2-dev \
10
+ libxslt-dev \
11
+ nodejs \
12
+ shared-mime-info \
13
+ sqlite-dev \
14
+ tzdata \
15
+ yarn
16
+
17
+ RUN mkdir /app
18
+ WORKDIR /app
19
+
20
+ RUN gem update --system && \
21
+ gem install bundler && \
22
+ bundle config build.nokogiri --use-system-libraries
23
+
24
+ COPY . .
25
+
26
+ EXPOSE 3000
27
+
28
+ CMD [".docker/app/entrypoint.sh"]
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ rm -f /app/.internal_test_app/tmp/pids/server.pid
5
+ bundle install
6
+ exec bundle exec rake blacklight:server["-p 3000 -b 0.0.0.0"]
data/.dockerignore ADDED
@@ -0,0 +1,3 @@
1
+ Gemfile.lock
2
+ .internal_test_app
3
+ .solr_wrapper.yml
data/.env ADDED
@@ -0,0 +1,5 @@
1
+ ALPINE_RUBY_VERSION=2.7.6
2
+ RAILS_VERSION=5.2.8.1
3
+ SOLR_PORT=8983
4
+ SOLR_URL=http://solr:8983/solr/blacklight-core
5
+ SOLR_VERSION=8
@@ -0,0 +1,61 @@
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
+ - main
14
+ - 'release-*'
15
+ pull_request:
16
+
17
+ jobs:
18
+ lint:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: 2.7
26
+ - name: Install dependencies
27
+ run: bundle install
28
+ - name: Run linter
29
+ run: bundle exec rake rubocop
30
+ test:
31
+ runs-on: ubuntu-latest
32
+ name: test (ruby ${{ matrix.ruby }} / rails ${{ matrix.rails_version }} ${{ matrix.additional_name }})
33
+ strategy:
34
+ matrix:
35
+ ruby: [2.5, 2.6, 2.7]
36
+ rails_version: ['5.1.7', '5.2.8.1']
37
+ bootstrap_version: [null]
38
+ api: [null]
39
+ additional_engine_cart_rails_options: ['']
40
+ additional_name: ['']
41
+ env:
42
+ RAILS_VERSION: ${{ matrix.rails_version }}
43
+ BOOTSTRAP_VERSION: ${{ matrix.bootstrap_version }}
44
+ BLACKLIGHT_API_TEST: ${{ matrix.api }}
45
+ ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test ${{ matrix.engine_cart_rails_options }}"
46
+ steps:
47
+ - uses: actions/checkout@v3
48
+ - name: Set up Ruby
49
+ uses: ruby/setup-ruby@v1
50
+ with:
51
+ ruby-version: ${{ matrix.ruby }}
52
+ - name: Install dependencies
53
+ run: bundle install
54
+ - name: Run tests
55
+ run: bundle exec rake ci
56
+ docker_build:
57
+ runs-on: ubuntu-latest
58
+ steps:
59
+ - uses: actions/checkout@v3
60
+ - name: Build docker image
61
+ run: docker-compose build app
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.24.0
1
+ 6.25.0
data/app/models/search.rb CHANGED
@@ -4,7 +4,8 @@ class Search < ActiveRecord::Base
4
4
 
5
5
  belongs_to :user, belongs_to_arguments
6
6
 
7
- serialize :query_params
7
+ # use a backwards-compatible serializer until the Rails API stabilizes and we can evaluate for major-revision compatibility
8
+ serialize :query_params, Blacklight::SearchParamsYamlCoder
8
9
 
9
10
  attr_accessible :query_params if Blacklight::Utils.needs_attr_accessible?
10
11
 
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ # This is a custom YAML coder for (de)serializing blacklight search parameters that
5
+ # supports deserializing HashWithIndifferentAccess parameters (as was historically done by Blacklight).
6
+ class SearchParamsYamlCoder
7
+ # Serializes an attribute value to a string that will be stored in the database.
8
+ def self.dump(obj)
9
+ # Convert HWIA to an ordinary hash so we have some hope of using the regular YAML encoder in the future
10
+ obj = obj.to_hash if obj.is_a?(ActiveSupport::HashWithIndifferentAccess)
11
+
12
+ YAML.dump(obj)
13
+ end
14
+
15
+ # Deserializes a string from the database to an attribute value.
16
+ def self.load(yaml)
17
+ return yaml unless yaml.is_a?(String) && yaml.start_with?("---")
18
+
19
+ params = yaml_load(yaml)
20
+
21
+ params.with_indifferent_access
22
+ end
23
+
24
+ # rubocop:disable Security/YAMLLoad
25
+ if YAML.respond_to?(:unsafe_load)
26
+ def self.yaml_load(payload)
27
+ if ActiveRecord.try(:use_yaml_unsafe_load) || ActiveRecord::Base.try(:use_yaml_unsafe_load)
28
+ YAML.unsafe_load(payload)
29
+ else
30
+ permitted_classes = (ActiveRecord.try(:yaml_column_permitted_classes) || ActiveRecord::Base.try(:yaml_column_permitted_classes) || []) +
31
+ Blacklight::Engine.config.search_params_permitted_classes
32
+ YAML.safe_load(payload, permitted_classes, [], true)
33
+ end
34
+ end
35
+ else
36
+ def self.yaml_load(payload)
37
+ if ActiveRecord.try(:use_yaml_unsafe_load) || ActiveRecord::Base.try(:use_yaml_unsafe_load)
38
+ YAML.load(payload)
39
+ else
40
+ permitted_classes = (ActiveRecord.try(:yaml_column_permitted_classes) || ActiveRecord::Base.try(:yaml_column_permitted_classes) || []) +
41
+ Blacklight::Engine.config.search_params_permitted_classes
42
+ YAML.safe_load(payload, permitted_classes, [], true)
43
+ end
44
+ end
45
+ end
46
+ # rubocop:enable Security/YAMLLoad
47
+ end
48
+ end
@@ -3,12 +3,12 @@ de:
3
3
  pagination:
4
4
  first: '&laquo; Erste'
5
5
  last: 'Letzte &raquo;'
6
- previous: '&laquo; Vorig'
6
+ previous: '&laquo; Voherige'
7
7
  next: 'Nächste &raquo;'
8
8
  truncate: '…'
9
9
 
10
10
  pagination_compact:
11
- previous: '&laquo; Vorig'
11
+ previous: '&laquo; Voherige'
12
12
  next: 'Nächste &raquo;'
13
13
 
14
14
  blacklight:
@@ -19,9 +19,9 @@ de:
19
19
  logout: 'Ausloggen'
20
20
  bookmarks: 'Lesezeichen'
21
21
  saved_searches: 'Gespeicherte Suchen'
22
- search_history: 'Geschichte'
22
+ search_history: 'Suchverlauf'
23
23
 
24
- welcome: 'Wilkommen!'
24
+ welcome: 'Willkommen!'
25
25
  and: 'und'
26
26
  or: 'oder'
27
27
 
@@ -37,19 +37,19 @@ de:
37
37
  success:
38
38
  one: 'Lesezeichen erfolgreich hinzugefügt.'
39
39
  other: 'Lesezeichen erfolgreich hinzugefügt.'
40
- failure: 'Entschuldigung, es gab ein Problem beim speichern von Lesezeichen.'
40
+ failure: 'Entschuldigung, es gab ein Problem beim Speichern der Lesezeichen.'
41
41
  remove:
42
42
  button: 'Lesezeichen entfernen'
43
43
  success: 'Lesezeichen erfolgreich gelöscht.'
44
- failure: 'Entschuldigung, es gab ein Problem bein löschen von Lesezeichen.'
45
- action_confirm: 'Entfernen dieses Lesezeichen?'
44
+ failure: 'Entschuldigung, es gab ein Problem beim Löschen der Lesezeichen.'
45
+ action_confirm: 'Dieses Lesezeichen entfernen?'
46
46
  clear:
47
47
  action_title: 'Lesezeichen löschen'
48
- action_confirm: 'Löschen deine Lesezeichen?'
49
- success: 'Dein Lesezeichen sind gelöscht gewesen.'
50
- failure: 'Entschuldigung, es gab ein Problem beim löschen von Lesezeichen.'
51
- need_login: 'Bitte melden Sie sich an, um Ihre Lesezeichen verwalten und ansehen.'
52
- list_title: 'Dein Lesezeichen'
48
+ action_confirm: 'Ihre Lesezeichen löschen?'
49
+ success: 'Ihre Lesezeichen wurden gelöscht.'
50
+ failure: 'Entschuldigung, es gab ein Problem beim Löschen der Lesezeichen.'
51
+ need_login: 'Bitte melden Sie sich an, um Ihre Lesezeichen zu verwalten und anzusehen.'
52
+ list_title: 'Ihre Lesezeichen'
53
53
  delete: 'Löschen'
54
54
 
55
55
  saved_searches:
@@ -73,22 +73,22 @@ de:
73
73
 
74
74
  search_history:
75
75
  clear:
76
- action_title: 'Löschen Suchverlauf'
77
- action_confirm: 'Löschen dein Suchverlauf?'
76
+ action_title: 'Suchverlauf löschen'
77
+ action_confirm: 'Ihren Suchverlauf löschen?'
78
78
  success: 'Suchverlauf gelöscht.'
79
- failure: 'Es gab ein Problem beim löschen von Suchverlauf.'
79
+ failure: 'Es gab ein Problem beim Löschen des Suchverlaufs.'
80
80
  title: 'Suchverlauf'
81
81
  page_title: 'Suchverlauf - %{application_name}'
82
- no_history: 'Sie haben keine Suchverlauf'
83
- recent: 'Deine neueste Suchen'
82
+ no_history: 'Sie haben keinen Suchverlauf'
83
+ recent: 'Ihre neuesten Suchen'
84
84
  forget: 'vergessen'
85
85
  save: 'speichern'
86
86
 
87
87
  tools:
88
88
  title: 'Werkzeuge'
89
- cite: 'Zitieren'
90
- email: 'Email'
91
- sms: 'SMS dieses'
89
+ citation: 'Zitieren'
90
+ email: 'E-Mail'
91
+ sms: 'SMS'
92
92
  clear: 'Löschen'
93
93
 
94
94
  citation:
@@ -98,10 +98,10 @@ de:
98
98
 
99
99
  email:
100
100
  form:
101
- title: 'Email dieses'
102
- to: 'Email:'
103
- message: 'Meldung:'
104
- submit: 'Abgeben'
101
+ title: 'E-Mail'
102
+ to: 'E-Mail-Adresse:'
103
+ message: 'Nachricht:'
104
+ submit: 'Senden'
105
105
  text:
106
106
  default_title: 'N/A'
107
107
  title: 'Titel: %{value}'
@@ -114,34 +114,34 @@ de:
114
114
  url: 'URL: %{url}'
115
115
  message: 'Mitteilung: %{message}'
116
116
 
117
- success: "Email Verschickt"
117
+ success: "E-Mail verschickt"
118
118
 
119
119
  errors:
120
120
  to:
121
- invalid: 'Sie müssen ein gültige E-Mail-Addresse eingeben'
122
- blank: 'Sie müssen ein Empfänger eingeben, um dieses Mitteilung schicken'
121
+ invalid: 'Sie müssen eine gültige E-Mail-Addresse eingeben'
122
+ blank: 'Sie müssen einen Empfänger eingeben, um diese Mitteilung zu schicken'
123
123
  sms:
124
124
  form:
125
- title: 'SMS dieses'
125
+ title: 'SMS'
126
126
  to: 'Telefonnummer:'
127
- carrier: 'Netzbetrieber'
128
- carrier_prompt: 'Bitte auswählen dein Netzbetrieber'
127
+ carrier: 'Netzbetreiber'
128
+ carrier_prompt: 'Bitte wählen Sie Ihren Netzbetreiber aus'
129
129
  submit: 'Schicken'
130
130
  text:
131
131
  title: '%{value}'
132
132
  author: ' von %{value}'
133
133
  url: 'Link: %{url}'
134
- success: "SMS Verschicht"
134
+ success: "SMS verschickt"
135
135
  errors:
136
136
  to:
137
- invalid: 'Sie müssen ein gültig 10 Stelle Telefonnummer wählen'
138
- blank: "Sie müssen die Telefonnummer eines Empfängers eingeben, um dieses Mitteilung schicken"
137
+ invalid: 'Sie müssen eine gültige Telefonnummer mit 10 Stellen wählen'
138
+ blank: "Sie müssen die Telefonnummer eines Empfängers eingeben, um diese Mitteilung zu schicken"
139
139
  carrier:
140
- blank: 'Sie müssen ein Netzbetrieber wählen'
141
- invalid: "Sie müssen ein gültig Netzbetrieber wählen"
140
+ blank: 'Sie müssen einen Netzbetreiber wählen'
141
+ invalid: "Sie müssen einen gültigen Netzbetreiber wählen"
142
142
 
143
- back_to_search: 'Zurück nach suchen'
144
- back_to_bookmarks: 'Zuruch nach Lesezeichen'
143
+ back_to_search: 'Zurück zur Suche'
144
+ back_to_bookmarks: 'Zurück zu Lesezeichen'
145
145
 
146
146
  search:
147
147
  # i18n key 'title' is deprecated and will be removed in Blacklight 6.0
@@ -153,21 +153,21 @@ de:
153
153
  search_results_header: 'Suchen'
154
154
  search_results: 'Suchergebnisse'
155
155
  errors:
156
- request_error: "Entschuldigung, Ich habe dein Suche nicht verstanden."
157
- invalid_solr_id: "Entschuldigung, Sie einen nicht vorhandenen Datensatz angefordert haben."
156
+ request_error: "Entschuldigung, ich habe Ihre Suche nicht verstanden."
157
+ invalid_solr_id: "Entschuldigung, Sie haben einen nicht vorhandenen Datensatz angefordert."
158
158
  per_page:
159
159
  label: '%{count}<span class="sr-only"> pro Seite</span>'
160
160
  button_label: '%{count} pro Seite'
161
- title: 'Anzahl der Ergebnisse pro Seite angezeigt werden'
161
+ title: 'Anzahl der Ergebnisse, die pro Seite angezeigt werden'
162
162
  submit: 'Aktualisieren'
163
163
  aria_label: 'Ergebnisnavigation'
164
164
  sort:
165
- label: 'Ordnen bei %{field}'
165
+ label: 'Ordnen nach %{field}'
166
166
  submit: 'Ergebnisse ordnen'
167
167
  form:
168
168
  search_field:
169
169
  label: 'Suchen in'
170
- title: 'gezeilte Suchoptionen'
170
+ title: 'gezielte Suchoptionen'
171
171
  post_label: 'für'
172
172
  search:
173
173
  label: 'suchen nach'
@@ -187,7 +187,7 @@ de:
187
187
  documents:
188
188
  counter: '%{counter}. '
189
189
  facets:
190
- title: 'Beschränken dein Suche'
190
+ title: 'Suche beschränken'
191
191
  clear: 'Löschen'
192
192
  sort:
193
193
  count: 'Numerisch ordnen'
@@ -199,12 +199,12 @@ de:
199
199
  group:
200
200
  more: 'mehr »'
201
201
  filters:
202
- title: 'Sie suchte nach:'
202
+ title: 'Sie suchten nach:'
203
203
  label: '%{label}:'
204
204
  remove:
205
- value: 'Entfernen Zwang %{value}'
206
- label_value: 'Entfernen Zwang %{label}: %{value}'
207
- start_over: 'Wieder anfangen'
205
+ value: 'Filter %{value} entfernen'
206
+ label_value: 'Filter %{label}: %{value} entfernen'
207
+ start_over: 'Neu anfangen'
208
208
  index:
209
209
  label: '%{label}:'
210
210
  show:
@@ -215,20 +215,20 @@ de:
215
215
  fields:
216
216
  default: 'Stichwort'
217
217
  bookmarks:
218
- present: "Im Lesezeichen"
218
+ present: "In Lesezeichen"
219
219
  absent: "Lesezeichen"
220
220
  inprogress: "Speichern..."
221
221
  zero_results:
222
- title: "Kein Ergebnisse für Ihere Suche gefunden"
223
- modify_search: "Änderen Sie Ihere Suche"
224
- use_fewer_keywords: "Benutzen Sie weniger Stichworten am anfang, danach verfeinen Sie dein Suche mit die links an der Linken Seite."
225
- search_fields: "Sie haben bei %{search_fields} gesucht"
226
- search_everything: "Suchen Sie von allem"
227
- view_title: "Anschauen Ergebnisse als: "
222
+ title: "Keine Ergebnisse für Ihre Suche gefunden"
223
+ modify_search: "Ändern Sie Ihre Suche"
224
+ use_fewer_keywords: "Benutzen Sie anfangs weniger Stichworte, danach verfeinern Sie Ihre Suche mit den Links auf der linken Seite."
225
+ search_fields: "Sie haben nach %{search_fields} gesucht"
226
+ search_everything: "Suchen Sie nach allem"
227
+ view_title: "Ergebnisse ansehen als: "
228
228
  view:
229
229
  list: "Liste"
230
230
 
231
231
  entry_name:
232
- default: 'eintrag'
232
+ default: 'Eintrag'
233
233
 
234
- did_you_mean: 'Meinten Sie geben: %{options}?'
234
+ did_you_mean: 'Meinten Sie: %{options}?'
@@ -0,0 +1,38 @@
1
+ version: "3.7"
2
+
3
+ services:
4
+ app:
5
+ build:
6
+ context: .
7
+ dockerfile: .docker/app/Dockerfile
8
+ args:
9
+ - ALPINE_RUBY_VERSION
10
+ # mounting . is causing seg-fault on macosx
11
+ #volumes:
12
+ #- .:/app
13
+ depends_on:
14
+ - solr
15
+ ports:
16
+ - "3000:3000"
17
+ environment:
18
+ - SOLR_URL # Set via environment variable or use default defined in .env file
19
+ - RAILS_VERSION # Set via environment variable or use default defined in .env file
20
+ - SOLR_ENV=docker-compose
21
+ - ENGINE_CART_RAILS_OPTIONS=--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test --skip-solr
22
+
23
+ solr:
24
+ environment:
25
+ - SOLR_PORT # Set via environment variable or use default defined in .env file
26
+ - SOLR_VERSION # Set via environment variable or use default defined in .env file
27
+ image: "solr:${SOLR_VERSION}"
28
+ volumes:
29
+ - $PWD/solr/conf:/opt/solr/conf
30
+ ports:
31
+ - "${SOLR_PORT}:8983"
32
+ entrypoint:
33
+ - docker-entrypoint.sh
34
+ - solr-precreate
35
+ - blacklight-core
36
+ - /opt/solr/conf
37
+ - "-Xms256m"
38
+ - "-Xmx512m"
@@ -45,10 +45,12 @@ module Blacklight
45
45
 
46
46
  config.routes = OpenStruct.new
47
47
  # Set identifier_constraint to enforce a format for the document identifiers
48
- config.routes.identifier_constraint = /[\w-]+/
48
+ config.routes.identifier_constraint = /.+/
49
49
 
50
50
  config.bookmarks_http_method = :post
51
51
 
52
52
  config.email_regexp = defined?(Devise) ? Devise.email_regexp : /\A[^@\s]+@[^@\s]+\z/
53
+
54
+ Blacklight::Engine.config.search_params_permitted_classes = [ActiveSupport::HashWithIndifferentAccess, Symbol]
53
55
  end
54
56
  end
@@ -1,30 +1,51 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  describe Search do
4
+ let(:search) { described_class.new(user: user) }
4
5
  let(:user) { User.create! email: 'xyz@example.com', password: 'xyz12345'}
6
+ let(:hash_params) { { q: "query", f: { facet: "filter" } } }
7
+ let(:query_params) { hash_params }
8
+
5
9
  describe "query_params" do
6
- before(:each) do
7
- @search = Search.new(user: user)
8
- @query_params = { :q => "query", :f => "facet" }
10
+ shared_examples "persisting query_params" do
11
+ it "can save and retrieve the hash" do
12
+ search.query_params = query_params
13
+ search.save!
14
+ expect(described_class.find(search.id).query_params).to eq query_params.with_indifferent_access
15
+ end
16
+ end
17
+
18
+ context "are an indifferent hash" do
19
+ include_context "persisting query_params" do
20
+ let(:query_params) { hash_params.with_indifferent_access }
21
+ end
22
+ end
23
+
24
+ context "are a string-keyed hash" do
25
+ include_context "persisting query_params" do
26
+ let(:query_params) { hash_params.with_indifferent_access.to_hash }
27
+ end
9
28
  end
10
29
 
11
- it "can save and retrieve the hash" do
12
- @search.query_params = @query_params
13
- @search.save!
14
- expect(Search.find(@search.id).query_params).to eq @query_params
30
+ context "include symbol keys" do
31
+ include_context "persisting query_params" do
32
+ let(:query_params) { hash_params }
33
+ end
15
34
  end
16
35
  end
17
36
 
18
37
  describe "saved?" do
19
38
  it "is true when user_id is not NULL and greater than 0" do
20
- @search = Search.new(user: user)
21
- @search.save!
22
-
23
- expect(@search).to be_saved
39
+ search.save!
40
+ expect(search).to be_saved
24
41
  end
25
- it "is false when user_id is NULL or less than 1" do
26
- @search = Search.create
27
- expect(@search).not_to be_saved
42
+
43
+ context "when user_id is NULL or less than 1" do
44
+ let(:search) { described_class.create }
45
+
46
+ it "is false" do
47
+ expect(search).not_to be_saved
48
+ end
28
49
  end
29
50
  end
30
51
 
@@ -19,6 +19,9 @@ describe "Routing" do
19
19
  it "maps { :controller => 'catalog', :action => 'show', :id => 666 } to /catalog/666" do
20
20
  expect(:get => "/catalog/666").to route_to(:controller => 'catalog', :action => 'show', :id => "666")
21
21
  end
22
+ it "maps { :controller => 'catalog', :action => 'show', :id => 666, :format => 'json' } to /catalog/666.json" do
23
+ expect(:get => "/catalog/666.json").to route_to(:controller => 'catalog', :action => 'show', :id => "666", :format => 'json')
24
+ end
22
25
  end
23
26
 
24
27
  describe 'tracking' do
@@ -35,6 +38,14 @@ describe "Routing" do
35
38
  expect(post('/catalog/gallica.bnf.fr/track')).to route_to('catalog#track', id: 'gallica.bnf.fr')
36
39
  end
37
40
  end
41
+
42
+ it "routes ids with a literal ':'" do
43
+ expect(post('/catalog/this:that/track')).to route_to('catalog#track', id: 'this:that')
44
+ end
45
+
46
+ it "routes ids with a literal ':'" do
47
+ expect(post('/catalog/this:that/track.json')).to route_to('catalog#track', id: 'this:that', format: 'json')
48
+ end
38
49
  end
39
50
 
40
51
 
@@ -62,6 +73,10 @@ describe "Routing" do
62
73
  expect(:get => solr_document_path(SolrDocument.new(:id => 'this+that'))).to route_to(:controller => 'catalog', :action => 'show', :id => 'this+that')
63
74
  end
64
75
 
76
+ it "routes ids with a literal ':'" do
77
+ expect(get: solr_document_path(SolrDocument.new(:id => 'this:that'))).to route_to(:controller => 'catalog', :action => 'show', :id => 'this:that')
78
+ end
79
+
65
80
  it "routes ids with a literal '/" do
66
81
  skip "This works if you configure your routing to have very liberal constraints on :id.. not sure how to go about testing it though"
67
82
  expect(:get => solr_document_path(SolrDocument.new(:id => 'and/or'))).to route_to(:controller => 'catalog', :action => 'show', :id => 'and/or')
@@ -1,26 +1,54 @@
1
- require 'solr_wrapper'
1
+ # frozen_string_literal: true
2
+
2
3
  require 'engine_cart/rake_task'
3
4
 
4
5
  require 'rspec/core/rake_task'
5
6
  RSpec::Core::RakeTask.new(:spec) do |t|
6
- t.pattern = 'spec/**/*_spec.rb'
7
+ t.pattern = 'spec/**/*_spec.rb'
7
8
  end
8
9
 
9
10
  require 'rubocop/rake_task'
10
11
  RuboCop::RakeTask.new(:rubocop)
11
12
 
12
- desc "Run test suite"
13
- task ci: ['blacklight:generate'] do
14
- SolrWrapper.wrap do |solr|
15
- solr.with_collection do
16
- within_test_app do
17
- system "RAILS_ENV=test rake blacklight:index:seed"
18
- end
19
- Rake::Task['blacklight:coverage'].invoke
13
+ require 'solr_wrapper'
14
+ require 'open3'
15
+
16
+ def system_with_error_handling(*args)
17
+ Open3.popen3(*args) do |_stdin, stdout, stderr, thread|
18
+ puts stdout.read
19
+ raise "Unable to run #{args.inspect}: #{stderr.read}" unless thread.value.success?
20
+ end
21
+ end
22
+
23
+ def with_solr(&block)
24
+ # We're being invoked by the app entrypoint script and solr is already up via docker-compose
25
+ if ENV['SOLR_ENV'] == 'docker-compose'
26
+ yield
27
+ elsif system('docker-compose -v')
28
+ # We're not running docker-compose up but still want to use a docker instance of solr.
29
+ begin
30
+ puts "Starting Solr"
31
+ system_with_error_handling "docker-compose up -d solr"
32
+ yield
33
+ ensure
34
+ puts "Stopping Solr"
35
+ system_with_error_handling "docker-compose stop solr"
36
+ end
37
+ else
38
+ SolrWrapper.wrap do |solr|
39
+ solr.with_collection(&block)
20
40
  end
21
41
  end
22
42
  end
23
43
 
44
+ desc "Run test suite"
45
+ task :ci do
46
+ with_solr do
47
+ Rake::Task['blacklight:internal:seed'].invoke
48
+ Rake::Task['blacklight:coverage'].invoke
49
+ end
50
+ end
51
+
24
52
  namespace :blacklight do
25
53
  desc "Run tests with coverage"
26
54
  task :coverage do
@@ -28,35 +56,28 @@ namespace :blacklight do
28
56
  Rake::Task["spec"].invoke
29
57
  end
30
58
 
31
- desc "Create the test rails app"
32
- task :generate => ['engine_cart:generate'] do
33
- end
34
-
35
59
  namespace :internal do
36
- task :seed => ['engine_cart:generate'] do
60
+ desc 'Index seed data in test app'
61
+ task seed: ['engine_cart:generate'] do
37
62
  within_test_app do
38
- system "bundle exec rake blacklight:index:seed"
63
+ system "bin/rake blacklight:index:seed"
39
64
  end
40
65
  end
41
66
  end
42
67
 
43
68
  desc 'Run Solr and Blacklight for interactive development'
44
- task :server, [:rails_server_args] do |t, args|
45
- if File.exist? EngineCart.destination
46
- within_test_app do
47
- system "bundle update"
48
- end
49
- else
50
- Rake::Task['engine_cart:generate'].invoke
51
- end
52
-
53
- SolrWrapper.wrap do |solr|
54
- solr.with_collection do
55
- Rake::Task['blacklight:internal:seed'].invoke
69
+ task :server, [:rails_server_args] => ['engine_cart:generate'] do |_t, args|
70
+ with_solr do
71
+ Rake::Task['blacklight:internal:seed'].invoke
56
72
 
73
+ begin
57
74
  within_test_app do
58
- system "bundle exec rails s #{args[:rails_server_args]}"
75
+ puts "Starting Blacklight (Rails server)"
76
+ system "bin/rails s #{args[:rails_server_args]}"
59
77
  end
78
+ rescue Interrupt
79
+ # We expect folks to Ctrl-c to stop the server so don't barf at them
80
+ puts "\nStopping Blacklight (Rails server)"
60
81
  end
61
82
  end
62
83
  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: 6.24.0
4
+ version: 6.25.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: 2021-01-23 00:00:00.000000000 Z
20
+ date: 2022-07-14 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -342,6 +342,11 @@ executables: []
342
342
  extensions: []
343
343
  extra_rdoc_files: []
344
344
  files:
345
+ - ".docker/app/Dockerfile"
346
+ - ".docker/app/entrypoint.sh"
347
+ - ".dockerignore"
348
+ - ".env"
349
+ - ".github/workflows/ruby.yml"
345
350
  - ".gitignore"
346
351
  - ".hound.yml"
347
352
  - ".jshintrc"
@@ -349,7 +354,6 @@ files:
349
354
  - ".rubocop.yml"
350
355
  - ".rubocop_todo.yml"
351
356
  - ".solr_wrapper.yml"
352
- - ".travis.yml"
353
357
  - ".yardopts"
354
358
  - Gemfile
355
359
  - LICENSE
@@ -464,6 +468,7 @@ files:
464
468
  - app/presenters/blacklight/rendering/terminator.rb
465
469
  - app/presenters/blacklight/show_presenter.rb
466
470
  - app/services/blacklight/field_retriever.rb
471
+ - app/services/blacklight/search_params_yaml_coder.rb
467
472
  - app/values/blacklight/types.rb
468
473
  - app/views/_flash_msg.html.erb
469
474
  - app/views/_user_util_links.html.erb
@@ -564,6 +569,7 @@ files:
564
569
  - db/migrate/20140202020201_create_searches.rb
565
570
  - db/migrate/20140202020202_create_bookmarks.rb
566
571
  - db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb
572
+ - docker-compose.yml
567
573
  - lib/blacklight.rb
568
574
  - lib/blacklight/abstract_repository.rb
569
575
  - lib/blacklight/configuration.rb
@@ -771,7 +777,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
771
777
  - !ruby/object:Gem::Version
772
778
  version: '0'
773
779
  requirements: []
774
- rubygems_version: 3.1.4
780
+ rubygems_version: 3.1.6
775
781
  signing_key:
776
782
  specification_version: 4
777
783
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
data/.travis.yml DELETED
@@ -1,44 +0,0 @@
1
- dist: bionic
2
- addons:
3
- chrome: stable
4
- language: ruby
5
-
6
- notifications:
7
- email: false
8
-
9
- rvm:
10
- - 2.5.7
11
- - 2.6.5
12
- - 2.7.0
13
-
14
- before_install:
15
- - gem update --system
16
- - gem install bundler
17
- - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
18
-
19
- before_script:
20
- - if [[ "${RAILS_VERSION}" =~ ^4.2.* ]]; then perl -pi -e "s/ActiveRecord::Migration\[[\d\.]+\]/ActiveRecord::Migration/" db/migrate/*; fi
21
-
22
- env:
23
- - "RAILS_VERSION=5.1.7"
24
- - "RAILS_VERSION=5.2.0"
25
-
26
-
27
- notifications:
28
- irc: "irc.freenode.org#blacklight"
29
- email:
30
- - blacklight-commits@googlegroups.com
31
-
32
- global_env:
33
- - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
34
- - ENGINE_CART_RAILS_OPTIONS='--skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-test'
35
- - CC_TEST_REPORTER_ID=5042c7358c96b0b926088a4cda3e132fffe7a66ce8047cdb1dc6f0b4b6676b79
36
-
37
- jdk: openjdk11
38
-
39
- before_script:
40
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
41
- - chmod +x ./cc-test-reporter
42
- - ./cc-test-reporter before-build
43
- after_script:
44
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT