traject 3.8.1 → 3.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +10 -2
- data/CHANGES.md +15 -3
- data/lib/tasks/load_maps.rake +51 -8
- data/lib/traject/macros/marc21_semantics.rb +7 -1
- data/lib/traject/version.rb +1 -1
- data/lib/translation_maps/marc_languages.yaml +7500 -6
- data/test/command_line_test.rb +3 -5
- data/test/indexer/error_handler_test.rb +2 -2
- data/test/indexer/macros/macros_marc21_semantics_test.rb +20 -1
- data/test/test_support/iso639-3_lang.marc +1 -0
- data/traject.gemspec +3 -0
- metadata +33 -7
data/test/command_line_test.rb
CHANGED
@@ -24,21 +24,20 @@ describe "Shell out to command line" do
|
|
24
24
|
out, err, result = execute_with_args("-v")
|
25
25
|
|
26
26
|
assert result.success?, "Expected subprocess exit code to be success.\nSTDERR:\n#{err}\n\nSTDOUT:\n#{out}"
|
27
|
-
|
27
|
+
assert err.end_with?("traject version #{Traject::VERSION}\n")
|
28
28
|
end
|
29
29
|
|
30
30
|
it "can display help text" do
|
31
31
|
out, err, result = execute_with_args("-h")
|
32
32
|
|
33
33
|
assert result.success?, "Expected subprocess exit code to be success.\nSTDERR:\n#{err}\n\nSTDOUT:\n#{out}"
|
34
|
-
|
34
|
+
assert_includes err, "traject [options] -c configuration.rb [-c config2.rb] file.mrc"
|
35
35
|
end
|
36
36
|
|
37
37
|
it "handles bad argument" do
|
38
38
|
out, err, result = execute_with_args("--no-such-arg")
|
39
39
|
refute result.success?
|
40
|
-
|
41
|
-
assert err.start_with?("Error: unknown option `--no-such-arg'\nExiting...\n")
|
40
|
+
assert_includes err, "Error: unknown option `--no-such-arg'\nExiting...\n"
|
42
41
|
end
|
43
42
|
|
44
43
|
it "does basic dry run" do
|
@@ -49,4 +48,3 @@ describe "Shell out to command line" do
|
|
49
48
|
assert_match /bib_1000165 +author_sort +Collection la/, out
|
50
49
|
end
|
51
50
|
end
|
52
|
-
|
@@ -21,7 +21,7 @@ describe 'Custom mapping error handler' do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
assert_equal "I just like raising errors", e.message
|
24
|
-
assert output.string =~ /while executing \(to_field \"id\" at .*error_handler_test.rb:\d
|
24
|
+
assert output.string =~ /while executing \(to_field \"id\" at .*error_handler_test.rb:\d+.*\)/
|
25
25
|
assert output.string =~ /CustomFakeException: I just like raising errors/
|
26
26
|
end
|
27
27
|
|
@@ -38,7 +38,7 @@ describe 'Custom mapping error handler' do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
e = assert_raises(CustomFakeException) { indexer.map_record({}) }
|
41
|
-
assert e.message =~ /\(to_field \"id\" at .*error_handler_test.rb:\d
|
41
|
+
assert e.message =~ /\(to_field \"id\" at .*error_handler_test.rb:\d+.*\)/
|
42
42
|
end
|
43
43
|
|
44
44
|
it "custom handler can skip and continue" do
|
@@ -87,8 +87,9 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
87
87
|
|
88
88
|
assert_equal ["Business renaissance quarterly [electronic resource]."], output["author_sort"]
|
89
89
|
assert_equal [""], @indexer.map_record(empty_record)['author_sort']
|
90
|
-
|
91
90
|
end
|
91
|
+
|
92
|
+
|
92
93
|
end
|
93
94
|
|
94
95
|
describe "marc_sortable_title" do
|
@@ -107,6 +108,16 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
107
108
|
|
108
109
|
assert_equal ["Business renaissance quarterly"], output["title_sort"]
|
109
110
|
end
|
111
|
+
|
112
|
+
it "respects non-filing when the first subfield isn't alphabetic" do
|
113
|
+
@record = MARC::Reader.new(support_file_path "the_business_ren.marc").first
|
114
|
+
@record.fields("245").first.subfields.unshift MARC::Subfield.new("6", "245-03")
|
115
|
+
output = @indexer.map_record(@record)
|
116
|
+
assert_equal ["Business renaissance quarterly"], output["title_sort"]
|
117
|
+
|
118
|
+
|
119
|
+
end
|
120
|
+
|
110
121
|
it "works with a record with no 245$ab" do
|
111
122
|
@record = MARC::Reader.new(support_file_path "245_no_ab.marc").to_a.first
|
112
123
|
output = @indexer.map_record(@record)
|
@@ -127,6 +138,14 @@ describe "Traject::Macros::Marc21Semantics" do
|
|
127
138
|
assert_equal({}, @indexer.map_record(empty_record))
|
128
139
|
|
129
140
|
end
|
141
|
+
it "can handle ISO 639-3 language codes" do
|
142
|
+
@record = MARC::Reader.new(support_file_path "iso639-3_lang.marc").to_a.first
|
143
|
+
output = @indexer.map_record(@record)
|
144
|
+
|
145
|
+
assert_equal ["Norwegian", "English", "Norwegian (Bokmål)"], output["languages"]
|
146
|
+
assert_equal({}, @indexer.map_record(empty_record))
|
147
|
+
|
148
|
+
end
|
130
149
|
end
|
131
150
|
|
132
151
|
describe "marc_instrumentation_humanized" do
|
@@ -0,0 +1 @@
|
|
1
|
+
01498cam a2200385 i 45000010009000000050017000090080041000269060045000679250042001129550090001540100017002440200029002610350024002900400023003140410013003370410023003500420008003730430012003810500023003932450107004162640044005233000046005673360026006133370028006393380027006675040041006945460045007355850101007806500045008816500044009267000032009707100065010029230029010679850016010962206778720211129111712.0210529s2020 no a b 000 0 nor a7bcbccorigresd3encipf20gy-gencatlg0 aacquireb1 shelf copyxpolicy default ave21 2021-06-04bff16 2021-09-23aff00 2021-09-23 to GS/SBCGiff07 2021-11-29 to BCCD a 2021378586 a9788293654162qpaperback a(GyWOH)har205007114 aDLCbengcDLCerda1 anoraeng17anobaeng2iso639-3 apcc af------00aN7380.5b.A47 202000aAlpha Crucis :bcontemporary African art /credaktør: Gunnar B. Kvaran ; oversettelse: Halvor Haugen. 1aOslo :bAstrup Fearnley Museet,c[2020] a272 pages :bcolor illustrations ;c26 cm atextbtxt2rdacontent aunmediatedbn2rdamedia avolumebnc2rdacarrier aIncludes bibliographical references. aParallel texts in English and Norwegian. aIn conjunction with an exhibition held at Astrup Fearnley Museum, Oslo, January 31-May 17, 2020. 0aArt, Africany21st centuryvExhibitions. 0aArt, Moderny21st centuryvExhibitions.1 aKvaran, Gunnar B.,eeditor.2 aAstrup Fearnley museet for moderne kunst,ehost institution. d20210531n0255802sGyWOH eVENDOR LOAD
|
data/traject.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
|
24
24
|
spec.add_dependency "concurrent-ruby", ">= 0.8.0"
|
25
|
+
spec.add_dependency "csv"
|
25
26
|
spec.add_dependency "marc", "~> 1.0"
|
26
27
|
|
27
28
|
spec.add_dependency "hashie", ">= 3.1", "< 6" # used for Indexer#settings
|
@@ -29,6 +30,8 @@ Gem::Specification.new do |spec|
|
|
29
30
|
spec.add_dependency "yell" # logging
|
30
31
|
spec.add_dependency "dot-properties", ">= 0.1.1" # reading java style .properties
|
31
32
|
spec.add_dependency "httpclient", "~> 2.5"
|
33
|
+
spec.add_dependency "mutex_m" # httpclient has an undelcared dep needed in ruby 3.4+, not yet released. https://github.com/nahi/httpclient/pull/455
|
34
|
+
|
32
35
|
spec.add_dependency "http", ">= 3.0", "< 6" # used in oai_pmh_reader, may use more extensively in future instead of httpclient
|
33
36
|
spec.add_dependency 'marc-fastxmlwriter', '~>1.0' # fast marc->xml
|
34
37
|
spec.add_dependency "nokogiri", "~> 1.9" # NokogiriIndexer
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.8.
|
4
|
+
version: 3.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
8
8
|
- Bill Dueber
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-01-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: concurrent-ruby
|
@@ -25,6 +24,20 @@ dependencies:
|
|
25
24
|
- - ">="
|
26
25
|
- !ruby/object:Gem::Version
|
27
26
|
version: 0.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: csv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
28
41
|
- !ruby/object:Gem::Dependency
|
29
42
|
name: marc
|
30
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +128,20 @@ dependencies:
|
|
115
128
|
- - "~>"
|
116
129
|
- !ruby/object:Gem::Version
|
117
130
|
version: '2.5'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: mutex_m
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :runtime
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
118
145
|
- !ruby/object:Gem::Dependency
|
119
146
|
name: http
|
120
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -225,7 +252,6 @@ dependencies:
|
|
225
252
|
- - "~>"
|
226
253
|
- !ruby/object:Gem::Version
|
227
254
|
version: '3.4'
|
228
|
-
description:
|
229
255
|
email:
|
230
256
|
- none@nowhere.org
|
231
257
|
executables:
|
@@ -346,6 +372,7 @@ files:
|
|
346
372
|
- test/test_support/escaped_character_reference.marc8.marc
|
347
373
|
- test/test_support/george_eliot.marc
|
348
374
|
- test/test_support/hebrew880s.marc
|
375
|
+
- test/test_support/iso639-3_lang.marc
|
349
376
|
- test/test_support/louis_armstrong.marc
|
350
377
|
- test/test_support/manufacturing_consent.marc
|
351
378
|
- test/test_support/manuscript_online_thesis.marc
|
@@ -387,7 +414,6 @@ homepage: http://github.com/traject/traject
|
|
387
414
|
licenses:
|
388
415
|
- MIT
|
389
416
|
metadata: {}
|
390
|
-
post_install_message:
|
391
417
|
rdoc_options: []
|
392
418
|
require_paths:
|
393
419
|
- lib
|
@@ -402,8 +428,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
402
428
|
- !ruby/object:Gem::Version
|
403
429
|
version: '0'
|
404
430
|
requirements: []
|
405
|
-
rubygems_version: 3.
|
406
|
-
signing_key:
|
431
|
+
rubygems_version: 3.6.2
|
407
432
|
specification_version: 4
|
408
433
|
summary: An easy to use, high-performance, flexible and extensible metadata transformation
|
409
434
|
system, focused on library-archives-museums input, and indexing to Solr as output.
|
@@ -452,6 +477,7 @@ test_files:
|
|
452
477
|
- test/test_support/escaped_character_reference.marc8.marc
|
453
478
|
- test/test_support/george_eliot.marc
|
454
479
|
- test/test_support/hebrew880s.marc
|
480
|
+
- test/test_support/iso639-3_lang.marc
|
455
481
|
- test/test_support/louis_armstrong.marc
|
456
482
|
- test/test_support/manufacturing_consent.marc
|
457
483
|
- test/test_support/manuscript_online_thesis.marc
|