blacklight_oai_provider 6.1.1 → 7.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ describe 'OIA-PMH Identify Request' do
12
12
  end
13
13
 
14
14
  it "contains repository name" do
15
- expect(xml.at_xpath('//xmlns:repositoryName').text).to eql 'Test Repository'
15
+ expect(xml.at_xpath('//xmlns:repositoryName').text).to eql 'Catalog Repository'
16
16
  end
17
17
 
18
18
  it "contains base url" do
@@ -11,6 +11,7 @@ class TestAppGenerator < Rails::Generators::Base
11
11
  say_status("warning", "GENERATING BL", :yellow)
12
12
 
13
13
  generate 'blacklight:install', '--devise'
14
+ generate 'blacklight:test_support'
14
15
  end
15
16
 
16
17
  def change_migrations_if_rails_4_2
@@ -45,24 +46,41 @@ class TestAppGenerator < Rails::Generators::Base
45
46
  end
46
47
  end
47
48
 
48
- def overwrite_catalog_controller
49
- copy_file "templates/catalog_controller.rb", "app/controllers/catalog_controller.rb", force: true
50
- end
51
-
52
49
  def install_engine
53
50
  say_status("warning", "GENERATING BL OAI PLUGIN", :yellow)
54
51
 
55
52
  generate 'blacklight_oai_provider:install'
56
53
  end
57
54
 
58
- def add_test_blacklight_oai_config
55
+ def add_test_blacklight_oai_controller_config
56
+ %w[catalog alternate].each { |cn| add_test_config_for(cn) }
57
+ end
58
+
59
+ def add_test_blacklight_oai_model_config
60
+ insert_into_file "app/models/solr_document.rb", after: "include BlacklightOaiProvider::SolrDocument\n" do
61
+ <<-CONFIG
62
+ field_semantics.merge!(
63
+ title: "title_tsim",
64
+ date: "pub_date_ssim",
65
+ subject: "subject_ssim",
66
+ creator: "author_tsim",
67
+ format: "format",
68
+ language: "language_ssim",
69
+ )
70
+ CONFIG
71
+ end
72
+ end
73
+
74
+ private
75
+
76
+ def add_test_config_for(controller_basename)
59
77
  say_status("warning", "ADDING BL OIA-PMH CONFIG")
60
78
 
61
- insert_into_file "app/controllers/catalog_controller.rb", after: "config.default_solr_params = {" do
79
+ insert_into_file "app/controllers/#{controller_basename}_controller.rb", after: "config.default_solr_params = {" do
62
80
  "\n fl: '*',\n"
63
81
  end
64
82
 
65
- insert_into_file "app/controllers/catalog_controller.rb", after: " configure_blacklight do |config|\n" do
83
+ insert_into_file "app/controllers/#{controller_basename}_controller.rb", after: " configure_blacklight do |config|\n" do
66
84
  <<-CONFIG
67
85
  config.default_document_solr_params = {
68
86
  qt: 'search',
@@ -73,12 +91,12 @@ class TestAppGenerator < Rails::Generators::Base
73
91
  CONFIG
74
92
  end
75
93
 
76
- insert_into_file "app/controllers/catalog_controller.rb", after: "configure_blacklight do |config|\n" do
94
+ insert_into_file "app/controllers/#{controller_basename}_controller.rb", after: "configure_blacklight do |config|\n" do
77
95
  <<-CONFIG
78
96
  config.oai = {
79
97
  provider: {
80
- repository_name: 'Test Repository',
81
- repository_url: 'http://localhost/catalog/oai',
98
+ repository_name: '#{controller_basename.titleize} Repository',
99
+ repository_url: 'http://localhost/#{controller_basename}/oai',
82
100
  record_prefix: 'oai:test',
83
101
  admin_email: 'root@localhost',
84
102
  deletion_support: 'persistent',
@@ -93,18 +111,5 @@ class TestAppGenerator < Rails::Generators::Base
93
111
  }
94
112
  CONFIG
95
113
  end
96
-
97
- insert_into_file "app/models/solr_document.rb", after: "include BlacklightOaiProvider::SolrDocument\n" do
98
- <<-CONFIG
99
- field_semantics.merge!(
100
- title: "title_tsim",
101
- date: "pub_date_ssim",
102
- subject: "subject_ssim",
103
- creator: "author_tsim",
104
- format: "format",
105
- language: "language_ssim",
106
- )
107
- CONFIG
108
- end
109
114
  end
110
115
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_oai_provider
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.1
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  - Carla Galarza
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-02-04 00:00:00.000000000 Z
12
+ date: 2022-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight
@@ -17,28 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '6.0'
20
+ version: '7.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '6.0'
27
+ version: '7.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: oai
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.0'
34
+ version: '1.2'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.0'
41
+ version: '1.2'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rexml
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: rspec-rails
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -143,29 +157,29 @@ dependencies:
143
157
  requirements:
144
158
  - - "~>"
145
159
  - !ruby/object:Gem::Version
146
- version: 0.50.0
160
+ version: 0.64.0
147
161
  type: :development
148
162
  prerelease: false
149
163
  version_requirements: !ruby/object:Gem::Requirement
150
164
  requirements:
151
165
  - - "~>"
152
166
  - !ruby/object:Gem::Version
153
- version: 0.50.0
167
+ version: 0.64.0
154
168
  - !ruby/object:Gem::Dependency
155
169
  name: rubocop-rspec
156
170
  requirement: !ruby/object:Gem::Requirement
157
171
  requirements:
158
172
  - - "~>"
159
173
  - !ruby/object:Gem::Version
160
- version: 1.18.0
174
+ version: '1.8'
161
175
  type: :development
162
176
  prerelease: false
163
177
  version_requirements: !ruby/object:Gem::Requirement
164
178
  requirements:
165
179
  - - "~>"
166
180
  - !ruby/object:Gem::Version
167
- version: 1.18.0
168
- description:
181
+ version: '1.8'
182
+ description:
169
183
  email:
170
184
  - chris@cbeer.info
171
185
  - cmg2228@columbia.edu
@@ -220,6 +234,7 @@ files:
220
234
  - solr/sample_solr_documents.yml
221
235
  - spec/controllers/catalog_controller_spec.rb
222
236
  - spec/features/html_rendering_spec.rb
237
+ - spec/integration/blacklight_oai_provider/solr_document_wrapper_spec.rb
223
238
  - spec/lib/blacklight_oai_provider/solr_document_provider_spec.rb
224
239
  - spec/lib/blacklight_oai_provider/solr_document_wrapper_spec.rb
225
240
  - spec/lib/blacklight_oai_provider/solr_set_spec.rb
@@ -233,11 +248,10 @@ files:
233
248
  - spec/spec_helper.rb
234
249
  - spec/test_app_templates/config/solr.yml
235
250
  - spec/test_app_templates/lib/generators/test_app_generator.rb
236
- - spec/test_app_templates/templates/catalog_controller.rb
237
251
  homepage: http://projectblacklight.org/
238
252
  licenses: []
239
253
  metadata: {}
240
- post_install_message:
254
+ post_install_message:
241
255
  rdoc_options: []
242
256
  require_paths:
243
257
  - lib
@@ -252,8 +266,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
266
  - !ruby/object:Gem::Version
253
267
  version: '0'
254
268
  requirements: []
255
- rubygems_version: 3.1.4
256
- signing_key:
269
+ rubygems_version: 3.2.3
270
+ signing_key:
257
271
  specification_version: 4
258
272
  summary: Blacklight Oai Provider plugin
259
- test_files: []
273
+ test_files:
274
+ - spec/controllers/catalog_controller_spec.rb
275
+ - spec/features/html_rendering_spec.rb
276
+ - spec/integration/blacklight_oai_provider/solr_document_wrapper_spec.rb
277
+ - spec/lib/blacklight_oai_provider/solr_document_provider_spec.rb
278
+ - spec/lib/blacklight_oai_provider/solr_document_wrapper_spec.rb
279
+ - spec/lib/blacklight_oai_provider/solr_set_spec.rb
280
+ - spec/models/solr_document_spec.rb
281
+ - spec/requests/get_record_spec.rb
282
+ - spec/requests/identify_spec.rb
283
+ - spec/requests/list_identifiers_spec.rb
284
+ - spec/requests/list_metadata_formats_spec.rb
285
+ - spec/requests/list_records_spec.rb
286
+ - spec/requests/list_sets_spec.rb
287
+ - spec/spec_helper.rb
288
+ - spec/test_app_templates/config/solr.yml
289
+ - spec/test_app_templates/lib/generators/test_app_generator.rb
@@ -1,196 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CatalogController < ApplicationController
4
- include Blacklight::Catalog
5
- include BlacklightOaiProvider::Controller
6
-
7
- configure_blacklight do |config|
8
- ## Class for sending and receiving requests from a search index
9
- # config.repository_class = Blacklight::Solr::Repository
10
- #
11
- ## Class for converting Blacklight's url parameters to into request parameters for the search index
12
- # config.search_builder_class = ::SearchBuilder
13
- #
14
- ## Model that maps search index responses to the blacklight response model
15
- # config.response_model = Blacklight::Solr::Response
16
-
17
- ## Default parameters to send to solr for all search-like requests. See also SearchBuilder#processed_parameters
18
- config.default_solr_params = {
19
- rows: 10
20
- }
21
-
22
- # solr path which will be added to solr base url before the other solr params.
23
- # config.solr_path = 'select'
24
-
25
- # items to show per page, each number in the array represent another option to choose from.
26
- # config.per_page = [10,20,50,100]
27
-
28
- ## Default parameters to send on single-document requests to Solr. These settings are the Blackligt defaults (see SearchHelper#solr_doc_params) or
29
- ## parameters included in the Blacklight-jetty document requestHandler.
30
- #
31
- # config.default_document_solr_params = {
32
- # qt: 'document',
33
- # ## These are hard-coded in the blacklight 'document' requestHandler
34
- # # fl: '*',
35
- # # rows: 1,
36
- # # q: '{!term f=id v=$id}'
37
- # }
38
-
39
- # solr field configuration for search results/index views
40
- config.index.title_field = 'title_tsim'
41
- config.index.display_type_field = 'format'
42
- # config.index.thumbnail_field = 'thumbnail_path_ss'
43
-
44
- # solr field configuration for document/show views
45
- # config.show.title_field = 'title_ssim'
46
- # config.show.display_type_field = 'format'
47
- # config.show.thumbnail_field = 'thumbnail_path_ss'
48
-
49
- # solr fields that will be treated as facets by the blacklight application
50
- # The ordering of the field names is the order of the display
51
- #
52
- # Setting a limit will trigger Blacklight's 'more' facet values link.
53
- # * If left unset, then all facet values returned by solr will be displayed.
54
- # * If set to an integer, then "f.somefield.facet.limit" will be added to
55
- # solr request, with actual solr request being +1 your configured limit --
56
- # you configure the number of items you actually want _ssimed_ in a page.
57
- # * If set to 'true', then no additional parameters will be sent to solr,
58
- # but any 'sniffed' request limit parameters will be used for paging, with
59
- # paging at requested limit -1. Can sniff from facet.limit or
60
- # f.specific_field.facet.limit solr request params. This 'true' config
61
- # can be used if you set limits in :default_solr_params, or as defaults
62
- # on the solr side in the request handler itself. Request handler defaults
63
- # sniffing requires solr requests to be made with "echoParams=all", for
64
- # app code to actually have it echo'd back to see it.
65
- #
66
- # :show may be set to false if you don't want the facet to be drawn in the
67
- # facet bar
68
- #
69
- # set :index_range to true if you want the facet pagination view to have facet prefix-based navigation
70
- # (useful when user clicks "more" on a large facet and wants to navigate alphabetically across a large set of results)
71
- # :index_range can be an array or range of prefixes that will be used to create the navigation (note: It is case sensitive when searching values)
72
-
73
- config.add_facet_field 'format', label: 'Format'
74
- config.add_facet_field 'pub_date_ssim', label: 'Publication Year', single: true
75
- config.add_facet_field 'subject_tsim', label: 'Topic', limit: 20, index_range: 'A'..'Z'
76
- config.add_facet_field 'language_ssim', label: 'Language', limit: true
77
- config.add_facet_field 'lc_1letter_ssim', label: 'Call Number'
78
- config.add_facet_field 'subject_geo_ssim', label: 'Region'
79
- config.add_facet_field 'subject_era_ssim', label: 'Era'
80
-
81
- config.add_facet_field 'example_pivot_field', label: 'Pivot Field', pivot: %w[format language_ssim]
82
-
83
- config.add_facet_field 'example_query_facet_field', label: 'Publish Date', query: {
84
- years_5: { label: 'within 5 Years', fq: "pub_date_ssim:[#{Time.zone.now.year - 5} TO *]" },
85
- years_10: { label: 'within 10 Years', fq: "pub_date_ssim:[#{Time.zone.now.year - 10} TO *]" },
86
- years_25: { label: 'within 25 Years', fq: "pub_date_ssim:[#{Time.zone.now.year - 25} TO *]" }
87
- }
88
-
89
- # Have BL send all facet field names to Solr, which has been the default
90
- # previously. Simply remove these lines if you'd rather use Solr request
91
- # handler defaults, or have no facets.
92
- config.add_facet_fields_to_solr_request!
93
-
94
- # solr fields to be displayed in the index (search results) view
95
- # The ordering of the field names is the order of the display
96
- config.add_index_field 'title_tsim', label: 'Title'
97
- config.add_index_field 'title_vern_tsim', label: 'Title'
98
- config.add_index_field 'author_tsim', label: 'Author'
99
- config.add_index_field 'author_vern_tsim', label: 'Author'
100
- config.add_index_field 'format', label: 'Format'
101
- config.add_index_field 'language_ssim', label: 'Language'
102
- config.add_index_field 'published_ssim', label: 'Published'
103
- config.add_index_field 'published_vern_ssim', label: 'Published'
104
- config.add_index_field 'lc_callnum_ssim', label: 'Call number'
105
-
106
- # solr fields to be displayed in the show (single result) view
107
- # The ordering of the field names is the order of the display
108
- config.add_show_field 'title_ssim', label: 'Title'
109
- config.add_show_field 'title_vern_ssim', label: 'Title'
110
- config.add_show_field 'subtitle_tsim', label: 'Subtitle'
111
- config.add_show_field 'subtitle_vern_tsim', label: 'Subtitle'
112
- config.add_show_field 'author_tsim', label: 'Author'
113
- config.add_show_field 'author_vern_tsim', label: 'Author'
114
- config.add_show_field 'format', label: 'Format'
115
- config.add_show_field 'url_fulltext_ssim', label: 'URL'
116
- config.add_show_field 'url_suppl_ssim', label: 'More Information'
117
- config.add_show_field 'language_ssim', label: 'Language'
118
- config.add_show_field 'published_ssim', label: 'Published'
119
- config.add_show_field 'published_vern_ssim', label: 'Published'
120
- config.add_show_field 'lc_callnum_ssim', label: 'Call number'
121
- config.add_show_field 'isbn_ssim', label: 'ISBN'
122
-
123
- # "fielded" search configuration. Used by pulldown among other places.
124
- # For supported keys in hash, see rdoc for Blacklight::SearchFields
125
- #
126
- # Search fields will inherit the :qt solr request handler from
127
- # config[:default_solr_parameters], OR can specify a different one
128
- # with a :qt key/value. Below examples inherit, except for subject
129
- # that specifies the same :qt as default for our own internal
130
- # testing purposes.
131
- #
132
- # The :key is what will be used to identify this BL search field internally,
133
- # as well as in URLs -- so changing it after deployment may break bookmarked
134
- # urls. A display label will be automatically calculated from the :key,
135
- # or can be specified manually to be different.
136
-
137
- # This one uses all the defaults set by the solr request handler. Which
138
- # solr request handler? The one set in config[:default_solr_parameters][:qt],
139
- # since we aren't specifying it otherwise.
140
-
141
- config.add_search_field 'all_fields', label: 'All Fields'
142
-
143
- # Now we see how to over-ride Solr request handler defaults, in this
144
- # case for a BL "search field", which is really a dismax aggregate
145
- # of Solr search fields.
146
-
147
- config.add_search_field('title') do |field|
148
- # solr_parameters hash are sent to Solr as ordinary url query params.
149
- field.solr_parameters = {
150
- 'spellcheck.dictionary': 'title',
151
- qf: '${title_qf}',
152
- pf: '${title_pf}'
153
- }
154
- end
155
-
156
- config.add_search_field('author') do |field|
157
- field.solr_parameters = {
158
- 'spellcheck.dictionary': 'author',
159
- qf: '${author_qf}',
160
- pf: '${author_pf}'
161
- }
162
- end
163
-
164
- # Specifying a :qt only to show it's possible, and so our internal automated
165
- # tests can test it. In this case it's the same as
166
- # config[:default_solr_parameters][:qt], so isn't actually neccesary.
167
- config.add_search_field('subject') do |field|
168
- field.qt = 'search'
169
- field.solr_parameters = {
170
- 'spellcheck.dictionary': 'subject',
171
- qf: '${subject_qf}',
172
- pf: '${subject_pf}'
173
- }
174
- end
175
-
176
- # "sort results by" select (pulldown)
177
- # label in pulldown is followed by the name of the SOLR field to sort by and
178
- # whether the sort is ascending or descending (it must be asc or desc
179
- # except in the relevancy case).
180
- config.add_sort_field 'score desc, pub_date_ssim desc, title_si asc', label: 'relevance'
181
- config.add_sort_field 'pub_date_ssim desc, title_si asc', label: 'year'
182
- config.add_sort_field 'author_si asc, title_si asc', label: 'author'
183
- config.add_sort_field 'title_si asc, pub_date_ssim desc', label: 'title'
184
-
185
- # If there are more than this many search results, no spelling ("did you
186
- # mean") suggestion is offered.
187
- config.spell_max = 5
188
-
189
- # Configuration for autocomplete suggestor
190
- config.autocomplete_enabled = true
191
- config.autocomplete_path = 'suggest'
192
- # if the name of the solr.SuggestComponent provided in your solrcongig.xml is not the
193
- # default 'mySuggester', uncomment and provide it below
194
- # config.autocomplete_suggester = 'mySuggester'
195
- end
196
- end