berkeley_library-tind 0.4.2 → 0.5.1
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 +4 -4
- data/.github/workflows/build.yml +1 -1
- data/.idea/inspectionProfiles/Project_Default.xml +18 -0
- data/.idea/tind.iml +91 -87
- data/.ruby-version +1 -1
- data/CHANGES.md +28 -1
- data/README.md +15 -1
- data/berkeley_library-tind.gemspec +2 -1
- data/lib/berkeley_library/tind/marc/xml_builder.rb +70 -0
- data/lib/berkeley_library/tind/marc/xml_reader.rb +32 -19
- data/lib/berkeley_library/tind/marc/xml_writer.rb +152 -0
- data/lib/berkeley_library/tind/module_info.rb +1 -1
- data/lib/berkeley_library/util/files.rb +39 -0
- data/spec/berkeley_library/tind/export/table_spec.rb +2 -0
- data/spec/berkeley_library/tind/marc/xml_reader_spec.rb +42 -1
- data/spec/berkeley_library/tind/marc/xml_writer_spec.rb +194 -0
- data/spec/data/issue-4.xml +157 -0
- data/spec/data/new-records.xml +46 -0
- metadata +34 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24232cda73f63d90367c05453c325f468d6103d667e820671f19c251cabd3814
|
4
|
+
data.tar.gz: 98d09880d886d8f351f0a038b8513aefe5dfe5c3a72108f634d79f7ad2485506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15c2560d8bee4b55fbb66a51f101afd731ef02bf542c7e4433ea0b095efa492a9b7429a7bb8929226079bb24a40a9f5e27432c6c855812a0a29d913d6877958e
|
7
|
+
data.tar.gz: 6133181a93ef7a1204e6c73ea56a5fdee80f40817bfbe87c3c03ed063ec070e8c6f50dff732bbd987e30b929c14ba6e0b056a0b259f8327273f24e7048a069dc
|
data/.github/workflows/build.yml
CHANGED
@@ -10,6 +10,24 @@
|
|
10
10
|
<inspection_tool class="LanguageDetectionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
11
11
|
<inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
|
12
12
|
<inspection_tool class="RubyCaseWithoutElseBlockInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
13
|
+
<inspection_tool class="RubyMismatchedArgumentType" enabled="true" level="WARNING" enabled_by_default="true">
|
14
|
+
<option name="myCheckNilability" value="false" />
|
15
|
+
</inspection_tool>
|
16
|
+
<inspection_tool class="RubyMismatchedConstantType" enabled="true" level="WARNING" enabled_by_default="true">
|
17
|
+
<option name="myCheckNilability" value="false" />
|
18
|
+
</inspection_tool>
|
19
|
+
<inspection_tool class="RubyMismatchedGlobalVariableType" enabled="true" level="WARNING" enabled_by_default="true">
|
20
|
+
<option name="myCheckNilability" value="false" />
|
21
|
+
</inspection_tool>
|
22
|
+
<inspection_tool class="RubyMismatchedParameterType" enabled="true" level="WARNING" enabled_by_default="true">
|
23
|
+
<option name="myCheckNilability" value="false" />
|
24
|
+
</inspection_tool>
|
25
|
+
<inspection_tool class="RubyMismatchedReturnType" enabled="true" level="WARNING" enabled_by_default="true">
|
26
|
+
<option name="myCheckNilability" value="false" />
|
27
|
+
</inspection_tool>
|
28
|
+
<inspection_tool class="RubyMismatchedVariableType" enabled="true" level="WARNING" enabled_by_default="true">
|
29
|
+
<option name="myCheckNilability" value="false" />
|
30
|
+
</inspection_tool>
|
13
31
|
<inspection_tool class="RubyStringKeysInHashInspection" enabled="true" level="INFORMATION" enabled_by_default="true" />
|
14
32
|
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
15
33
|
<option name="processCode" value="true" />
|
data/.idea/tind.iml
CHANGED
@@ -6,94 +6,98 @@
|
|
6
6
|
<component name="NewModuleRootManager">
|
7
7
|
<content url="file://$MODULE_DIR$">
|
8
8
|
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
-
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
-
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
9
|
</content>
|
12
|
-
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.
|
10
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.5" jdkType="RUBY_SDK" />
|
13
11
|
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="actionpack (
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="actionview (
|
16
|
-
<orderEntry type="library" scope="PROVIDED" name="activesupport (
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, RVM: ruby-2.7.
|
18
|
-
<orderEntry type="library" scope="PROVIDED" name="amazing_print (v1.
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.
|
20
|
-
<orderEntry type="library" scope="PROVIDED" name="berkeley_library-logging (v0.2.
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="berkeley_library-marc (v0.
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="berkeley_library-util (v0.1.
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, RVM: ruby-2.7.
|
24
|
-
<orderEntry type="library" scope="PROVIDED" name="bundle-audit (v0.1.0, RVM: ruby-2.7.
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.
|
26
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler-audit (v0.9.0.1, RVM: ruby-2.7.
|
27
|
-
<orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.0.0, RVM: ruby-2.7.
|
28
|
-
<orderEntry type="library" scope="PROVIDED" name="ci_reporter_rspec (v1.0.0, RVM: ruby-2.7.
|
29
|
-
<orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.
|
30
|
-
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.5, RVM: ruby-2.7.
|
32
|
-
<orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, RVM: ruby-2.7.
|
33
|
-
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.
|
34
|
-
<orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, RVM: ruby-2.7.
|
35
|
-
<orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20190701, RVM: ruby-2.7.
|
36
|
-
<orderEntry type="library" scope="PROVIDED" name="dotenv (v2.7.6, RVM: ruby-2.7.
|
37
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
38
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
39
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
40
|
-
<orderEntry type="library" scope="PROVIDED" name="http-
|
41
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
42
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
43
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
44
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
45
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
46
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
47
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
48
|
-
<orderEntry type="library" scope="PROVIDED" name="mime-types
|
49
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
50
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
51
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
52
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
53
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
54
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
55
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
56
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
57
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
58
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
59
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
60
|
-
<orderEntry type="library" scope="PROVIDED" name="rack
|
61
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
62
|
-
<orderEntry type="library" scope="PROVIDED" name="rails-
|
63
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
64
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
65
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
66
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
67
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
68
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
69
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
70
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
71
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
72
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
73
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec
|
74
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-
|
75
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-
|
76
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-
|
77
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
78
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop
|
79
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-
|
80
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-
|
81
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
82
|
-
<orderEntry type="library" scope="PROVIDED" name="ruby-
|
83
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
84
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
85
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
86
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
87
|
-
<orderEntry type="library" scope="PROVIDED" name="simplecov
|
88
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
89
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
90
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
91
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
92
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
93
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
94
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
95
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
96
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="actionpack (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="actionview (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="amazing_print (v1.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.5) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="berkeley_library-logging (v0.2.6, RVM: ruby-2.7.5) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="berkeley_library-marc (v0.3.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="berkeley_library-util (v0.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="bundle-audit (v0.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.31, RVM: ruby-2.7.5) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler-audit (v0.9.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="ci_reporter_rspec (v1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.10, RVM: ruby-2.7.5) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.5, RVM: ruby-2.7.5) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, RVM: ruby-2.7.5) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20190701, RVM: ruby-2.7.5) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="dotenv (v2.7.6, RVM: ruby-2.7.5) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="equivalent-xml (v0.6.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.10.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="hashdiff (v1.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="http-accept (v1.7.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.10.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="ice_nine (v0.11.2, RVM: ruby-2.7.5) [gem]" level="application" />
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="lograge (v0.11.2, RVM: ruby-2.7.5) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.15.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
44
|
+
<orderEntry type="library" scope="PROVIDED" name="marc (v1.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
45
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
46
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.4.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
47
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2022.0105, RVM: ruby-2.7.5) [gem]" level="application" />
|
48
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.15.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.13.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
51
|
+
<orderEntry type="library" scope="PROVIDED" name="oj (v3.13.11, RVM: ruby-2.7.5) [gem]" level="application" />
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="ougai (v1.9.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.21.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
54
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
55
|
+
<orderEntry type="library" scope="PROVIDED" name="parslet (v2.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.6, RVM: ruby-2.7.5) [gem]" level="application" />
|
57
|
+
<orderEntry type="library" scope="PROVIDED" name="racc (v1.6.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
58
|
+
<orderEntry type="library" scope="PROVIDED" name="rack (v2.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
59
|
+
<orderEntry type="library" scope="PROVIDED" name="rack-test (v1.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
60
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
61
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.4.2, RVM: ruby-2.7.5) [gem]" level="application" />
|
62
|
+
<orderEntry type="library" scope="PROVIDED" name="railties (v7.0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
63
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
64
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.5) [gem]" level="application" />
|
65
|
+
<orderEntry type="library" scope="PROVIDED" name="rchardet (v1.8.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
66
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.2.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
67
|
+
<orderEntry type="library" scope="PROVIDED" name="request_store (v1.5.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
68
|
+
<orderEntry type="library" scope="PROVIDED" name="rest-client (v2.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
69
|
+
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.5) [gem]" level="application" />
|
70
|
+
<orderEntry type="library" scope="PROVIDED" name="roo (v2.8.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
71
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
72
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
73
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
74
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
75
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
76
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
77
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.15.2, RVM: ruby-2.7.5) [gem]" level="application" />
|
78
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.6.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
79
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
80
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-marc-spec (v0.1.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
81
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-prof (v0.17.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
82
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
83
|
+
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.3.2, RVM: ruby-2.7.5) [gem]" level="application" />
|
84
|
+
<orderEntry type="library" scope="PROVIDED" name="scrub_rb (v1.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
85
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.21.2, RVM: ruby-2.7.5) [gem]" level="application" />
|
86
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
87
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov-rcov (v0.2.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
88
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
89
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
90
|
+
<orderEntry type="library" scope="PROVIDED" name="typesafe_enum (v0.3.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
91
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
92
|
+
<orderEntry type="library" scope="PROVIDED" name="unf (v0.1.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
93
|
+
<orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.8.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
94
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
95
|
+
<orderEntry type="library" scope="PROVIDED" name="webmock (v3.14.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
96
|
+
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
97
|
+
</component>
|
98
|
+
<component name="RModuleSettingsStorage">
|
99
|
+
<LOAD_PATH number="2" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" />
|
100
|
+
<I18N_FOLDERS number="0" />
|
97
101
|
</component>
|
98
102
|
<component name="RakeTasksCache">
|
99
103
|
<option name="myRootTask">
|
@@ -106,7 +110,7 @@
|
|
106
110
|
</RakeTaskImpl>
|
107
111
|
<RakeTaskImpl description="Run all specs in spec directory, with coverage" fullCommand="coverage" id="coverage" />
|
108
112
|
<RakeTaskImpl description="Run tests, check test coverage, check code style, check for vulnerabilities, build gem" fullCommand="default" id="default" />
|
109
|
-
<RakeTaskImpl description="Build berkeley_library-tind.gemspec as berkeley_library-tind-0.4.
|
113
|
+
<RakeTaskImpl description="Build berkeley_library-tind.gemspec as berkeley_library-tind-0.4.3.gem" fullCommand="gem" id="gem" />
|
110
114
|
<RakeTaskImpl description="Run RuboCop with auto-correct, and output results to console" fullCommand="ra" id="ra" />
|
111
115
|
<RakeTaskImpl description="Run rubocop with HTML output" fullCommand="rubocop" id="rubocop" />
|
112
116
|
<RakeTaskImpl id="rubocop">
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7
|
1
|
+
2.7.5
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
# 0.5.1 (2023-03-23)
|
2
|
+
|
3
|
+
- Fix an issue where `BerkeleyLibrary::TIND::MARC::XMLWriter` would drop fields with nonstandard tags (e.g. `FFT` fields)
|
4
|
+
and would group and sort fields by tag instead of preserving the original order.
|
5
|
+
|
6
|
+
# 0.5.0 (2022-01-17)
|
7
|
+
|
8
|
+
- Adds a class `BerkeleyLibrary::TIND::MARC::XMLWriter` to write MARCXML in the format expected by the TIND batch uploader:
|
9
|
+
|
10
|
+
- MARC leader is written to control field 000 as required by TIND
|
11
|
+
- control fields (including the leader) use `\` (0x5c), not space (0x32), for unspecified positional
|
12
|
+
values
|
13
|
+
|
14
|
+
In addition, a `nil` or empty MARC leader is not written at all.
|
15
|
+
- Modifies `BerkeleyLibrary::TIND::MARC::XMLReader` to take into account the same peculiarities:
|
16
|
+
control field 000 is read into the leader of the MARC record, and slashes in control field values
|
17
|
+
(including the leader) are replaced with spaces.
|
18
|
+
|
19
|
+
# 0.4.3 (2022-01-26)
|
20
|
+
|
21
|
+
- Pins `berkeley_library-marc` to version 0.3.x (0.3.1 or higher).
|
22
|
+
- `BerkeleyLibrary::TIND::XMLReader#new` and `#read`: Fix issue with options/kwargs
|
23
|
+
cross-compatibility between Ruby 2.7 and 3.x
|
24
|
+
- Adjusts `BerkeleyLibrary::TIND::MARC::XMLReader` to take advantage of proper `freeze:`
|
25
|
+
option implementation in `berkeley_library-marc` 3.x.
|
26
|
+
|
1
27
|
# 0.4.2 (2021-09-23)
|
2
28
|
|
3
29
|
- Extract `BerkeleyLibrary::Util` module to [separate gem](https://github.com/BerkeleyLibrary/util)
|
@@ -28,7 +54,8 @@
|
|
28
54
|
# 0.3.0 (2021-05-11)
|
29
55
|
|
30
56
|
- Extracts `MARCExtensions` into a separate gem,
|
31
|
-
[`ucblit-marc`](https://git.lib.berkeley.edu/lap/ucblit-marc
|
57
|
+
[`ucblit-marc`](https://git.lib.berkeley.edu/lap/ucblit-marc).
|
58
|
+
- *Note:* As of August 2021 this is now [berkeley_library-marc](https://rubygems.org/gems/berkeley_library-marc).
|
32
59
|
|
33
60
|
# 0.2.4 (2021-05-06)
|
34
61
|
|
data/README.md
CHANGED
@@ -1,10 +1,24 @@
|
|
1
1
|
# BerkeleyLibrary::TIND
|
2
2
|
|
3
3
|
[](https://github.com/BerkeleyLibrary/tind/actions/workflows/build.yml)
|
4
|
-
[](https://
|
4
|
+
[](https://rubygems.org/gems/berkeley_library-tind)
|
5
5
|
|
6
6
|
Utility gem for working with the TIND DA digital archive.
|
7
7
|
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
In your Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'berkeley_library-tind'
|
14
|
+
```
|
15
|
+
|
16
|
+
In your code:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
require 'berkeley_library/tind'
|
20
|
+
```
|
21
|
+
|
8
22
|
## Configuration
|
9
23
|
|
10
24
|
To access the TIND API, you will need to set:
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.required_ruby_version = ruby_version
|
25
25
|
|
26
26
|
spec.add_dependency 'berkeley_library-logging', '~> 0.2'
|
27
|
-
spec.add_dependency 'berkeley_library-marc', '~> 0.
|
27
|
+
spec.add_dependency 'berkeley_library-marc', '~> 0.3.0', '>= 0.3.1'
|
28
28
|
spec.add_dependency 'berkeley_library-util', '~> 0.1'
|
29
29
|
spec.add_dependency 'ice_nine', '~> 0.11'
|
30
30
|
spec.add_dependency 'marc', '~> 1.0'
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
|
38
38
|
spec.add_development_dependency 'colorize', '~> 0.8'
|
39
39
|
spec.add_development_dependency 'dotenv', '~> 2.7'
|
40
|
+
spec.add_development_dependency 'equivalent-xml', '~> 0.6'
|
40
41
|
spec.add_development_dependency 'rake', '~> 13.0'
|
41
42
|
spec.add_development_dependency 'roo', '~> 2.8'
|
42
43
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module BerkeleyLibrary
|
4
|
+
module TIND
|
5
|
+
module MARC
|
6
|
+
class XMLBuilder
|
7
|
+
attr_reader :marc_record
|
8
|
+
|
9
|
+
def initialize(marc_record)
|
10
|
+
@marc_record = marc_record
|
11
|
+
end
|
12
|
+
|
13
|
+
def build
|
14
|
+
builder.doc.root.tap(&:unlink)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def builder
|
20
|
+
Nokogiri::XML::Builder.new do |xml|
|
21
|
+
xml.record do
|
22
|
+
add_leader(xml)
|
23
|
+
marc_record.each { |f| add_field(xml, f) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_leader(xml)
|
29
|
+
leader = marc_record.leader
|
30
|
+
return if leader.nil? || leader == ''
|
31
|
+
|
32
|
+
# TIND uses <controlfield tag="000"/> instead of <leader/>
|
33
|
+
leader_as_cf = ::MARC::ControlField.new('000', clean_leader(leader))
|
34
|
+
add_control_field(xml, leader_as_cf)
|
35
|
+
end
|
36
|
+
|
37
|
+
def add_data_field(xml, df)
|
38
|
+
xml.datafield(tag: df.tag, ind1: df.indicator1, ind2: df.indicator2) do
|
39
|
+
df.subfields.each do |sf|
|
40
|
+
xml.subfield(sf.value, code: sf.code)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_control_field(xml, cf)
|
46
|
+
# TIND uses \ (0x5c), not space (0x32), for unspecified values in positional fields
|
47
|
+
value = cf.value&.gsub(' ', '\\')
|
48
|
+
xml.controlfield(value, tag: cf.tag)
|
49
|
+
end
|
50
|
+
|
51
|
+
def add_field(xml, f)
|
52
|
+
case f
|
53
|
+
when ::MARC::ControlField
|
54
|
+
add_control_field(xml, f)
|
55
|
+
when ::MARC::DataField
|
56
|
+
add_data_field(xml, f)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def clean_leader(leader)
|
61
|
+
leader.gsub(/[^\w|^\s]/, 'Z').tap do |ldr|
|
62
|
+
ldr[20..23] = '4500' unless ldr[20..23] == '4500'
|
63
|
+
ldr[6..6] = 'Z' if ldr[6..6] == ' '
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'nokogiri'
|
2
2
|
require 'marc/xml_parsers'
|
3
3
|
require 'marc_extensions'
|
4
|
+
require 'berkeley_library/util/files'
|
4
5
|
|
5
6
|
module BerkeleyLibrary
|
6
7
|
module TIND
|
@@ -9,6 +10,7 @@ module BerkeleyLibrary
|
|
9
10
|
class XMLReader
|
10
11
|
include Enumerable
|
11
12
|
include ::MARC::NokogiriReader
|
13
|
+
include BerkeleyLibrary::Util::Files
|
12
14
|
|
13
15
|
# ############################################################
|
14
16
|
# Constant
|
@@ -43,10 +45,10 @@ module BerkeleyLibrary
|
|
43
45
|
# ############################################################
|
44
46
|
# Initializer
|
45
47
|
|
46
|
-
# Reads MARC records from an XML datasource given either as a file path,
|
48
|
+
# Reads MARC records from an XML datasource given either as an XML string, a file path,
|
47
49
|
# or as an IO object.
|
48
50
|
#
|
49
|
-
# @param source [String, Pathname, IO] the path to a file, or an IO to read from directly
|
51
|
+
# @param source [String, Pathname, IO] an XML string, the path to a file, or an IO to read from directly
|
50
52
|
# @param freeze [Boolean] whether to freeze each record after reading
|
51
53
|
def initialize(source, freeze: false)
|
52
54
|
@handle = ensure_io(source)
|
@@ -55,14 +57,26 @@ module BerkeleyLibrary
|
|
55
57
|
end
|
56
58
|
|
57
59
|
class << self
|
58
|
-
|
60
|
+
# Reads MARC records from an XML datasource given either as an XML string, a file path,
|
61
|
+
# or as an IO object.
|
62
|
+
#
|
63
|
+
# @param source [String, Pathname, IO] an XML string, the path to a file, or an IO to read from directly
|
64
|
+
# @param freeze [Boolean] whether to freeze each record after reading
|
65
|
+
def read(source, freeze: false)
|
66
|
+
new(source, freeze: freeze)
|
67
|
+
end
|
59
68
|
end
|
60
69
|
|
61
70
|
# ############################################################
|
62
71
|
# MARC::GenericPullParser overrides
|
63
72
|
|
64
73
|
def yield_record
|
65
|
-
@record[:record].
|
74
|
+
@record[:record].tap do |record|
|
75
|
+
clean_cf_values(record)
|
76
|
+
move_cf000_to_leader(record)
|
77
|
+
record.freeze if @freeze
|
78
|
+
end
|
79
|
+
|
66
80
|
super
|
67
81
|
ensure
|
68
82
|
increment_records_yielded!
|
@@ -113,26 +127,25 @@ module BerkeleyLibrary
|
|
113
127
|
|
114
128
|
private
|
115
129
|
|
116
|
-
|
117
|
-
|
118
|
-
return
|
119
|
-
return StringIO.new(file) if file =~ /^\s*</x
|
130
|
+
# TIND uses <controlfield tag="000"/> instead of <leader/>
|
131
|
+
def move_cf000_to_leader(record)
|
132
|
+
return unless (cf_000 = record['000'])
|
120
133
|
|
121
|
-
|
134
|
+
record.leader = cf_000.value
|
135
|
+
record.fields.delete(cf_000)
|
122
136
|
end
|
123
137
|
|
124
|
-
#
|
125
|
-
|
126
|
-
|
127
|
-
# @param obj [Object] the object that might be an IO
|
128
|
-
# @see https://github.com/sparklemotion/nokogiri/blob/v1.11.1/lib/nokogiri/xml/sax/parser.rb#L81 Nokogiri::XML::SAX::Parser#parse
|
129
|
-
def io_like?(obj)
|
130
|
-
obj.respond_to?(:read) && obj.respond_to?(:close)
|
138
|
+
# TIND uses \ (0x5c), not space (0x32), for unspecified values in positional fields
|
139
|
+
def clean_cf_values(record)
|
140
|
+
record.each_control_field { |cf| cf.value = cf.value&.gsub('\\', ' ') }
|
131
141
|
end
|
132
142
|
|
133
|
-
def
|
134
|
-
|
135
|
-
|
143
|
+
def ensure_io(file)
|
144
|
+
return file if reader_like?(file)
|
145
|
+
return File.new(file) if file_exists?(file)
|
146
|
+
return StringIO.new(file) if file =~ /^\s*</x
|
147
|
+
|
148
|
+
raise ArgumentError, "Don't know how to read XML from #{file.inspect}: not an IO, file path, or XML text"
|
136
149
|
end
|
137
150
|
|
138
151
|
def increment_records_yielded!
|