blacklight-marc 7.0.1 → 7.2.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: 432d7a660db81b2bbeca3baec8b83caba9a5a774cc3d0e81aba21f9ed14299dd
4
- data.tar.gz: e86995f1d734859fa0c498bc84620fa7e0452ccd48b21b78b4a2be0cc880ef06
3
+ metadata.gz: 4c370b1c69a4ed2a7c2e77de6dbdeedbf6314fa1334ae1c3f88f216bd7dad23a
4
+ data.tar.gz: cf92a4865a958b67d9f9eec4f352e5cc666f5b1c052661d2e1d0899ce1e45419
5
5
  SHA512:
6
- metadata.gz: a088b5bc21a4ff7325e552b07ef618e5ed60a09b74ba409277b14dea661616bd6a4999d25f090505ec46644a489f4651afce800a63c47d5f9e0b09ca5c432b49
7
- data.tar.gz: 71712bc65b078fa2ad1c32b75e5aa2cbbf98e1ac3f0a4bc3784ff13991656ced7076fe729955d607fd9679c4bc618051ad639a15b184435692b641d46e57e7e7
6
+ metadata.gz: 54ddf02511c8fa185842d66f0f1f30a9ae988485fc0108e7f099fc6b4a8b4be83b56f96c6757949d7b3c95b9e1444fb08c219e68c3c5d2c1a81c560d092848e8
7
+ data.tar.gz: f1d1c86c9635a4519c898763d7a6fc80a05088a3060c4dd41dae28d2b7b763806cd3f577094d9d69f4760a9dbbf26944ac47bf92ef6181c144e96711d8acff1c
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ rails_version: [6.1.4.7, 7.0.2.3]
15
+ ruby: [2.7, '3.0']
16
+ include:
17
+ - rails_version: 5.2.4.4
18
+ ruby: 2.7
19
+ - rails_version: 6.0.3.4
20
+ ruby: 2.7
21
+ env:
22
+ RAILS_VERSION: ${{ matrix.rails_version }}
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - name: Set up Ruby ${{ matrix.ruby }}
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby }}
29
+ - name: Install dependencies with Rails ${{ matrix.rails_version }}
30
+ run: bundle install
31
+ - name: Run tests
32
+ run: bundle exec rake
@@ -1,11 +1,12 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  # -*- coding: utf-8 -*-
3
- # Written for use with Blacklight::Solr::Document::Marc, but you can use
3
+
4
+ # Written for use with Blacklight::Marc::DocumentExtension, but you can use
4
5
  # it for your own custom Blacklight document Marc extension too -- just
5
6
  # include this module in any document extension (or any other class)
6
7
  # that provides a #to_marc returning a ruby-marc object. This module will add
7
8
  # in export_as translation methods for a variety of formats.
8
- module Blacklight::Solr::Document::MarcExport
9
+ module Blacklight::Marc::DocumentExport
9
10
 
10
11
  def self.register_export_formats(document)
11
12
  document.will_export_as(:xml)
@@ -126,9 +127,7 @@ module Blacklight::Solr::Document::MarcExport
126
127
  # As of 11 May 2010, Refworks has a problem with UTF-8 if it's decomposed,
127
128
  # it seems to want C form normalization, although RefWorks support
128
129
  # couldn't tell me that. -jrochkind
129
- text = ActiveSupport::Multibyte::Unicode.normalize(text, :c)
130
-
131
- return text
130
+ text.unicode_normalize(:nfc)
132
131
  end
133
132
 
134
133
  # Endnote Import Format. See the EndNote User Guide at:
@@ -9,7 +9,7 @@
9
9
  # This extension would normally be registered using
10
10
  # Blacklight::Solr::Document#use_extension. eg:
11
11
  #
12
- # SolrDocument.use_extension( Blacklight::Solr::Document::Marc ) { |document| my_logic_for_document_has_marc?( document ) }
12
+ # SolrDocument.use_extension( Blacklight::Marc::DocumentExtension ) { |document| my_logic_for_document_has_marc?( document ) }
13
13
  #
14
14
  # This extension also expects a :marc_source_field and :marc_format_type to
15
15
  # be registered with the hosting classes extension_parameters. In an initializer
@@ -18,15 +18,16 @@
18
18
  # SolrDocument.extension_parameters[:marc_format_type] = :marc21 # or :marcxml
19
19
  require 'marc'
20
20
 
21
- module Blacklight::Solr::Document::Marc
21
+ module Blacklight::Marc
22
+ module DocumentExtension
22
23
 
23
- include Blacklight::Solr::Document::MarcExport # All our export_as stuff based on to_marc.
24
+ include Blacklight::Marc::DocumentExport # All our export_as stuff based on to_marc.
24
25
 
25
26
  class UnsupportedMarcFormatType < RuntimeError; end
26
27
 
27
28
  def self.extended(document)
28
29
  # Register our exportable formats, we inherit these from MarcExport
29
- Blacklight::Solr::Document::MarcExport.register_export_formats( document )
30
+ Blacklight::Marc::DocumentExport.register_export_formats( document )
30
31
  end
31
32
 
32
33
  # ruby-marc object
@@ -59,7 +60,9 @@ module Blacklight::Solr::Document::Marc
59
60
  end
60
61
 
61
62
  def marc_record_from_marcxml
62
- MARC::XMLReader.new(StringIO.new( fetch(_marc_source_field) )).to_a.first
63
+ marcxml = fetch(_marc_source_field)
64
+ marcxml = marcxml.first if marcxml.kind_of? Array
65
+ MARC::XMLReader.new(StringIO.new(marcxml)).to_a.first
63
66
  end
64
67
 
65
68
  def _marc_helper
@@ -76,4 +79,5 @@ module Blacklight::Solr::Document::Marc
76
79
  self.class.extension_parameters[:marc_format_type]
77
80
  end
78
81
 
82
+ end
79
83
  end
@@ -1,21 +1,10 @@
1
- require "blacklight/marc"
2
- require "rails"
3
-
4
1
  module Blacklight::Marc
5
2
  class Engine < Rails::Engine
6
- config.autoload_paths += %W(
7
- #{config.root}/app/presenters
8
- #{config.root}/app/controllers/concerns
9
- #{config.root}/app/models/concerns
10
- )
11
-
12
3
  rake_tasks do
13
4
  load "railties/solr_marc.rake"
14
5
  end
15
6
 
16
7
  initializer 'blacklight_marc.initialize' do |app|
17
- require 'blacklight/solr/document'
18
-
19
8
  Mime::Type.register_alias "text/plain", :refworks_marc_txt
20
9
  Mime::Type.register_alias "text/plain", :openurl_kev
21
10
  Mime::Type.register "application/x-endnote-refer", :endnote
@@ -23,6 +12,13 @@ module Blacklight::Marc
23
12
  Mime::Type.register "application/marcxml+xml", :marcxml,
24
13
  ["application/x-marc+xml", "application/x-marcxml+xml",
25
14
  "application/marc+xml"]
15
+
16
+ # these are here for backwards compatibility with the old class names,
17
+ # which zeitwerk didn't care for
18
+ config.after_initialize do
19
+ Blacklight::Solr::Document::Marc = Blacklight::Marc::DocumentExtension
20
+ Blacklight::Solr::Document::MarcExport = Blacklight::Marc::DocumentExport
21
+ end
26
22
  end
27
23
  end
28
24
  end
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Marc
3
- VERSION = '7.0.1'
3
+ VERSION = '7.2.0'
4
4
  end
5
5
  end
@@ -40,11 +40,11 @@ EOF
40
40
  # The following shows how to setup this blacklight document to display marc documents
41
41
  extension_parameters[:marc_source_field] = :marc_ss
42
42
  extension_parameters[:marc_format_type] = :marcxml
43
- use_extension( Blacklight::Solr::Document::Marc) do |document|
44
- document.key?( SolrDocument.extension_parameters[:marc_source_field] )
43
+ use_extension(Blacklight::Marc::DocumentExtension) do |document|
44
+ document.key?(SolrDocument.extension_parameters[:marc_source_field])
45
45
  end
46
-
47
- field_semantics.merge!(
46
+
47
+ field_semantics.merge!(
48
48
  :title => "title_ssm",
49
49
  :author => "author_ssm",
50
50
  :language => "language_ssim",
@@ -1,2 +1 @@
1
- gem 'blacklight', github: 'projectblacklight/blacklight'
2
1
  gem "traject", '~>3.0'
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe 'bookmarks/_endnote.html.erb' do
3
+ RSpec.describe 'bookmarks/_endnote' do
4
4
  before do
5
5
  allow(controller).to receive(:blacklight_config)
6
6
  .and_return(CatalogController.blacklight_config)
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe 'bookmarks/_refworks.html.erb' do
3
+ RSpec.describe 'bookmarks/_refworks' do
4
4
  before do
5
5
  allow(controller).to receive(:blacklight_config)
6
6
  .and_return(CatalogController.blacklight_config)
@@ -29,7 +29,7 @@ describe "catalog/index" do
29
29
  params.merge!( @params )
30
30
  allow(view).to receive(:blacklight_config).and_return(@config)
31
31
  allow(view).to receive(:search_field_options_for_select).and_return([])
32
-
32
+ allow(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)
33
33
  render :template => 'catalog/index', :formats => [:atom]
34
34
 
35
35
  # We need to use rexml to test certain things that have_tag wont' test
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-marc
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 7.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-16 00:00:00.000000000 Z
11
+ date: 2022-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blacklight
@@ -219,17 +219,17 @@ executables: []
219
219
  extensions: []
220
220
  extra_rdoc_files: []
221
221
  files:
222
+ - ".github/workflows/ruby.yml"
222
223
  - ".gitignore"
223
224
  - ".solr_wrapper.yaml"
224
- - ".travis.yml"
225
225
  - Gemfile
226
226
  - LICENSE
227
227
  - README.md
228
228
  - Rakefile
229
229
  - app/assets/stylesheets/blacklight_marc.scss
230
230
  - app/helpers/blacklight_marc_helper.rb
231
- - app/models/concerns/blacklight/solr/document/marc.rb
232
- - app/models/concerns/blacklight/solr/document/marc_export.rb
231
+ - app/models/concerns/blacklight/marc/document_export.rb
232
+ - app/models/concerns/blacklight/marc/document_extension.rb
233
233
  - app/views/bookmarks/_endnote.html.erb
234
234
  - app/views/bookmarks/_marc_tools.html.erb
235
235
  - app/views/bookmarks/_refworks.html.erb
@@ -310,7 +310,7 @@ homepage: https://github.com/projectblacklight/blacklight-marc
310
310
  licenses:
311
311
  - Apache-2.0
312
312
  metadata: {}
313
- post_install_message:
313
+ post_install_message:
314
314
  rdoc_options: []
315
315
  require_paths:
316
316
  - lib
@@ -325,8 +325,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
325
  - !ruby/object:Gem::Version
326
326
  version: '0'
327
327
  requirements: []
328
- rubygems_version: 3.1.2
329
- signing_key:
328
+ rubygems_version: 3.2.32
329
+ signing_key:
330
330
  specification_version: 4
331
331
  summary: MARC support for Blacklight
332
332
  test_files:
data/.travis.yml DELETED
@@ -1,27 +0,0 @@
1
- language: ruby
2
- sudo: false
3
-
4
- notifications:
5
- email: false
6
-
7
- matrix:
8
- include:
9
- - rvm: 2.7.1
10
- env: "RAILS_VERSION=6.0.3.2"
11
- - rvm: 2.6.6
12
- env: "RAILS_VERSION=6.0.3.2"
13
- - rvm: 2.6.6
14
- env: "RAILS_VERSION=5.2.4.3"
15
-
16
- before_install:
17
- - gem install bundler
18
-
19
- notifications:
20
- irc: "irc.freenode.org#blacklight"
21
- email:
22
- - blacklight-commits@googlegroups.com
23
-
24
- global_env:
25
- - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
26
-
27
- jdk: openjdk11