berkeley_library-marc 0.2.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 +7 -0
- data/.github/workflows/build.yml +18 -0
- data/.gitignore +388 -0
- data/.idea/inspectionProfiles/Project_Default.xml +20 -0
- data/.idea/marc.iml +101 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rubocop.yml +334 -0
- data/.ruby-version +1 -0
- data/.simplecov +8 -0
- data/.yardopts +1 -0
- data/CHANGES.md +12 -0
- data/Dockerfile +57 -0
- data/Gemfile +3 -0
- data/Jenkinsfile +18 -0
- data/LICENSE.md +21 -0
- data/README.md +4 -0
- data/Rakefile +20 -0
- data/berkeley_library-marc.gemspec +42 -0
- data/docker-compose.yml +15 -0
- data/lib/.rubocop.yml +6 -0
- data/lib/berkeley_library/marc.rb +3 -0
- data/lib/berkeley_library/marc/field_info.rb +1 -0
- data/lib/berkeley_library/marc/field_info/ctrl_fields/data/ctrl_fields_standard.txt +2143 -0
- data/lib/berkeley_library/marc/field_info/leader/data/leader_standard.txt +87 -0
- data/lib/berkeley_library/marc/field_info/var_fields.rb +46 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data.rb +4 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data/mapping-orig.tsv +265 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data/var_fields_berkeley_9xx.txt +53 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data/var_fields_berkeley_9xx_parsed.rb +51 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data/var_fields_standard.txt +5458 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data/var_fields_standard_parsed.rb +6577 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data/var_fields_tind_reserved.txt +44 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data/var_fields_tind_reserved_parsed.rb +30 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data/var_fields_ucblit_tind.txt +105 -0
- data/lib/berkeley_library/marc/field_info/var_fields/data/var_fields_ucblit_tind_parsed.rb +114 -0
- data/lib/berkeley_library/marc/field_info/var_fields/ind_def.rb +39 -0
- data/lib/berkeley_library/marc/field_info/var_fields/ind_val_def.rb +27 -0
- data/lib/berkeley_library/marc/field_info/var_fields/instrument_or_voices_code.rb +26 -0
- data/lib/berkeley_library/marc/field_info/var_fields/obsolescible.rb +55 -0
- data/lib/berkeley_library/marc/field_info/var_fields/section.rb +50 -0
- data/lib/berkeley_library/marc/field_info/var_fields/subfield_def.rb +50 -0
- data/lib/berkeley_library/marc/field_info/var_fields/subfield_val.rb +24 -0
- data/lib/berkeley_library/marc/field_info/var_fields/var_field_def.rb +62 -0
- data/lib/berkeley_library/marc/field_info/var_fields/var_field_list.rb +43 -0
- data/lib/berkeley_library/marc/field_info/var_fields/var_field_parser.rb +136 -0
- data/lib/berkeley_library/marc/field_info/var_fields/var_field_transform.rb +160 -0
- data/lib/berkeley_library/marc/module_info.rb +14 -0
- data/lib/marc_extensions.rb +1 -0
- data/lib/marc_extensions/data_field.rb +29 -0
- data/lib/marc_extensions/field_map.rb +63 -0
- data/lib/marc_extensions/record.rb +100 -0
- data/lib/marc_extensions/subfield.rb +21 -0
- data/lib/marc_extensions/xml_reader.rb +19 -0
- data/rakelib/bundle.rake +8 -0
- data/rakelib/coverage.rake +11 -0
- data/rakelib/gem.rake +54 -0
- data/rakelib/rubocop.rake +18 -0
- data/rakelib/spec.rake +2 -0
- data/spec/.rubocop.yml +37 -0
- data/spec/berkeley_library/marc/field_info/var_fields/var_field_def_spec.rb +26 -0
- data/spec/berkeley_library/marc/field_info/var_fields/var_field_parser_spec.rb +596 -0
- data/spec/berkeley_library/marc/field_info/var_fields/var_field_transform_spec.rb +173 -0
- data/spec/berkeley_library/marc/field_info/var_fields_spec.rb +112 -0
- data/spec/data/field_info/vf_046.txt +32 -0
- data/spec/data/field_info/vf_048.txt +112 -0
- data/spec/data/record-187888.xml +78 -0
- data/spec/marc_extensions/data_field_spec.rb +13 -0
- data/spec/marc_extensions/record_spec.rb +211 -0
- data/spec/spec_helper.rb +27 -0
- metadata +354 -0
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
data/.idea/vcs.xml
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,334 @@
|
|
1
|
+
inherit_mode:
|
2
|
+
merge:
|
3
|
+
- Exclude
|
4
|
+
- Include
|
5
|
+
|
6
|
+
# Allow one line around block body (Layout/EmptyLines will still disallow two or more)
|
7
|
+
Layout/EmptyLinesAroundBlockBody:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
# Allow one line around class body (Layout/EmptyLines will still disallow two or more)
|
11
|
+
Layout/EmptyLinesAroundClassBody:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
# Allow one line around module body (Layout/EmptyLines will still disallow two or more)
|
15
|
+
Layout/EmptyLinesAroundModuleBody:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
# Reasonable line-length check; it's too easy for the cure to be worse than the disease
|
19
|
+
Layout/LineLength:
|
20
|
+
Max: 150
|
21
|
+
|
22
|
+
# Make indents consistent regardless of the lengths of variables and method names and whatnot
|
23
|
+
Layout/MultilineMethodCallIndentation:
|
24
|
+
EnforcedStyle: indented
|
25
|
+
|
26
|
+
# Produces monsters
|
27
|
+
Layout/MultilineOperationIndentation:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
# We meant to do that
|
31
|
+
Naming/MemoizedInstanceVariableName:
|
32
|
+
Enabled: False
|
33
|
+
|
34
|
+
# It works in context, trust us
|
35
|
+
Naming/MethodParameterName:
|
36
|
+
Enabled: False
|
37
|
+
|
38
|
+
# Confusing and weird
|
39
|
+
Naming/VariableNumber:
|
40
|
+
Enabled: False
|
41
|
+
|
42
|
+
# Do what's readable in the context you're in
|
43
|
+
Style/AccessModifierDeclarations:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
# 👎 to cultural imperialism
|
47
|
+
Style/AsciiComments:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
# Seriously?
|
51
|
+
Style/CommentedKeyword:
|
52
|
+
Enabled: False
|
53
|
+
|
54
|
+
# Disable problematic module documentation check (see https://github.com/bbatsov/rubocop/issues/947)
|
55
|
+
Style/Documentation:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
# Adding more line noise to format strings will not improve them
|
59
|
+
Style/FormatStringToken:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
# Putting '# frozen_string_literal: true' everywhere does not make the world a better place
|
63
|
+
Style/FrozenStringLiteralComment:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
# Requiring the lambda() method just makes wordy calls wordier
|
67
|
+
Style/Lambda:
|
68
|
+
EnforcedStyle: literal
|
69
|
+
|
70
|
+
# `foo.positive?` is cute, but it's not actually more readable than `foo > 0`
|
71
|
+
Style/NumericPredicate:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
# Unclear why it's a good idea to give parameters semantically meaningless names
|
75
|
+
Style/SingleLineBlockParams:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
# The semantics of `foo&.bar` are a lot less interchangeable with `foo && foo.bar` than RuboCop thinks
|
79
|
+
Style/SafeNavigation:
|
80
|
+
Enabled: false
|
81
|
+
|
82
|
+
# Short arrays are often more readable as plain arrays
|
83
|
+
Style/WordArray:
|
84
|
+
MinSize: 3
|
85
|
+
|
86
|
+
############################################################
|
87
|
+
# Added in RuboCop 0.80
|
88
|
+
|
89
|
+
Style/HashEachMethods:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
Style/HashTransformKeys:
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
Style/HashTransformValues:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
############################################################
|
99
|
+
# Added in RuboCop 0.81
|
100
|
+
|
101
|
+
Lint/StructNewOverride:
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
Lint/RaiseException:
|
105
|
+
Enabled: true
|
106
|
+
|
107
|
+
############################################################
|
108
|
+
# Added in RuboCop 0.82
|
109
|
+
|
110
|
+
Layout/SpaceAroundMethodCallOperator:
|
111
|
+
Enabled: true
|
112
|
+
|
113
|
+
Style/ExponentialNotation:
|
114
|
+
Enabled: false
|
115
|
+
|
116
|
+
############################################################
|
117
|
+
# Added in RuboCop 0.83
|
118
|
+
|
119
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
120
|
+
Enabled: true
|
121
|
+
|
122
|
+
Style/SlicingWithRange:
|
123
|
+
Enabled: true
|
124
|
+
|
125
|
+
############################################################
|
126
|
+
# Added in RuboCop 0.84
|
127
|
+
|
128
|
+
Lint/DeprecatedOpenSSLConstant:
|
129
|
+
Enabled: true
|
130
|
+
|
131
|
+
############################################################
|
132
|
+
# Added in RuboCop 0.85
|
133
|
+
|
134
|
+
Lint/MixedRegexpCaptureTypes:
|
135
|
+
Enabled: true
|
136
|
+
|
137
|
+
Style/RedundantRegexpEscape:
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
Style/RedundantRegexpCharacterClass:
|
141
|
+
Enabled: true
|
142
|
+
|
143
|
+
############################################################
|
144
|
+
# Added in Rubocop 0.86
|
145
|
+
|
146
|
+
Style/RedundantFetchBlock:
|
147
|
+
Enabled: true
|
148
|
+
|
149
|
+
############################################################
|
150
|
+
# Added in Rubocop 0.87
|
151
|
+
|
152
|
+
# Sometimes we separate things for a reason
|
153
|
+
Style/AccessorGrouping:
|
154
|
+
Enabled: false
|
155
|
+
|
156
|
+
Style/BisectedAttrAccessor:
|
157
|
+
Enabled: true
|
158
|
+
|
159
|
+
Style/RedundantAssignment:
|
160
|
+
Enabled: true
|
161
|
+
|
162
|
+
############################################################
|
163
|
+
# Added in Rubocop 0.88
|
164
|
+
|
165
|
+
Lint/DuplicateElsifCondition:
|
166
|
+
Enabled: true
|
167
|
+
|
168
|
+
Style/ArrayCoercion:
|
169
|
+
Enabled: true
|
170
|
+
|
171
|
+
Style/CaseLikeIf:
|
172
|
+
Enabled: true
|
173
|
+
|
174
|
+
Style/HashAsLastArrayItem:
|
175
|
+
Enabled: true
|
176
|
+
|
177
|
+
Style/HashLikeCase:
|
178
|
+
Enabled: true
|
179
|
+
|
180
|
+
Style/RedundantFileExtensionInRequire:
|
181
|
+
Enabled: true
|
182
|
+
|
183
|
+
############################################################
|
184
|
+
# Added in Rubocop 0.89
|
185
|
+
|
186
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
187
|
+
Enabled: true
|
188
|
+
|
189
|
+
Lint/DuplicateRescueException:
|
190
|
+
Enabled: true
|
191
|
+
|
192
|
+
Lint/EmptyConditionalBody:
|
193
|
+
Enabled: true
|
194
|
+
|
195
|
+
Lint/FloatComparison:
|
196
|
+
Enabled: true
|
197
|
+
|
198
|
+
Lint/MissingSuper:
|
199
|
+
Enabled: true
|
200
|
+
|
201
|
+
Lint/OutOfRangeRegexpRef:
|
202
|
+
Enabled: true
|
203
|
+
|
204
|
+
Lint/SelfAssignment:
|
205
|
+
Enabled: true
|
206
|
+
|
207
|
+
Lint/TopLevelReturnWithArgument:
|
208
|
+
Enabled: true
|
209
|
+
|
210
|
+
Lint/UnreachableLoop:
|
211
|
+
Enabled: true
|
212
|
+
|
213
|
+
Style/ExplicitBlockArgument:
|
214
|
+
Enabled: true
|
215
|
+
|
216
|
+
Style/GlobalStdStream:
|
217
|
+
Enabled: true
|
218
|
+
|
219
|
+
Style/OptionalBooleanParameter:
|
220
|
+
Enabled: true
|
221
|
+
|
222
|
+
Style/SingleArgumentDig:
|
223
|
+
Enabled: true
|
224
|
+
|
225
|
+
Style/SoleNestedConditional:
|
226
|
+
Enabled: true
|
227
|
+
|
228
|
+
Style/StringConcatenation:
|
229
|
+
Enabled: true
|
230
|
+
|
231
|
+
############################################################
|
232
|
+
# Added in Rubocop 0.90
|
233
|
+
|
234
|
+
Lint/DuplicateRequire:
|
235
|
+
Enabled: true
|
236
|
+
|
237
|
+
Lint/EmptyFile:
|
238
|
+
Enabled: true
|
239
|
+
|
240
|
+
Lint/TrailingCommaInAttributeDeclaration:
|
241
|
+
Enabled: true
|
242
|
+
|
243
|
+
Lint/UselessMethodDefinition:
|
244
|
+
Enabled: true
|
245
|
+
|
246
|
+
Style/CombinableLoops:
|
247
|
+
Enabled: true
|
248
|
+
|
249
|
+
Style/KeywordParametersOrder:
|
250
|
+
Enabled: true
|
251
|
+
|
252
|
+
Style/RedundantSelfAssignment:
|
253
|
+
Enabled: true
|
254
|
+
|
255
|
+
############################################################
|
256
|
+
# Added in Rubocop 0.91
|
257
|
+
|
258
|
+
Layout/BeginEndAlignment:
|
259
|
+
Enabled: true
|
260
|
+
|
261
|
+
Lint/ConstantDefinitionInBlock:
|
262
|
+
Enabled: true
|
263
|
+
|
264
|
+
Lint/IdentityComparison:
|
265
|
+
Enabled: true
|
266
|
+
|
267
|
+
Lint/UselessTimes:
|
268
|
+
Enabled: true
|
269
|
+
|
270
|
+
############################################################
|
271
|
+
# Added in Rubocop 1.1–1.9
|
272
|
+
|
273
|
+
Layout/SpaceBeforeBrackets: # (new in 1.7)
|
274
|
+
Enabled: true
|
275
|
+
Lint/AmbiguousAssignment: # (new in 1.7)
|
276
|
+
Enabled: true
|
277
|
+
Lint/DeprecatedConstants: # (new in 1.8)
|
278
|
+
Enabled: true
|
279
|
+
Lint/DuplicateBranch: # (new in 1.3)
|
280
|
+
Enabled: true
|
281
|
+
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
|
282
|
+
Enabled: true
|
283
|
+
Lint/EmptyBlock: # (new in 1.1)
|
284
|
+
Enabled: true
|
285
|
+
Lint/EmptyClass: # (new in 1.3)
|
286
|
+
Enabled: true
|
287
|
+
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
|
288
|
+
Enabled: true
|
289
|
+
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
|
290
|
+
Enabled: true
|
291
|
+
Lint/NumberedParameterAssignment: # (new in 1.9)
|
292
|
+
Enabled: true
|
293
|
+
Lint/OrAssignmentToConstant: # (new in 1.9)
|
294
|
+
Enabled: true
|
295
|
+
Lint/RedundantDirGlobSort: # (new in 1.8)
|
296
|
+
Enabled: true
|
297
|
+
Lint/SymbolConversion: # (new in 1.9)
|
298
|
+
Enabled: true
|
299
|
+
Lint/ToEnumArguments: # (new in 1.1)
|
300
|
+
Enabled: true
|
301
|
+
Lint/TripleQuotes: # (new in 1.9)
|
302
|
+
Enabled: true
|
303
|
+
Lint/UnexpectedBlockArity: # (new in 1.5)
|
304
|
+
Enabled: true
|
305
|
+
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
|
306
|
+
Enabled: true
|
307
|
+
Style/ArgumentsForwarding: # (new in 1.1)
|
308
|
+
Enabled: true
|
309
|
+
Style/CollectionCompact: # (new in 1.2)
|
310
|
+
Enabled: true
|
311
|
+
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
|
312
|
+
Enabled: true
|
313
|
+
Style/EndlessMethod: # (new in 1.8)
|
314
|
+
Enabled: true
|
315
|
+
Style/HashExcept: # (new in 1.7)
|
316
|
+
Enabled: true
|
317
|
+
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
|
318
|
+
Enabled: true
|
319
|
+
Style/NegatedIfElseCondition: # (new in 1.2)
|
320
|
+
Enabled: true
|
321
|
+
Style/NilLambda: # (new in 1.3)
|
322
|
+
Enabled: true
|
323
|
+
Style/RedundantArgument: # (new in 1.4)
|
324
|
+
Enabled: true
|
325
|
+
Style/SwapValues: # (new in 1.1)
|
326
|
+
Enabled: true
|
327
|
+
|
328
|
+
############################################################
|
329
|
+
# Added in RuboCop 1.10
|
330
|
+
|
331
|
+
Gemspec/DateAssignment: # (new in 1.10)
|
332
|
+
Enabled: true
|
333
|
+
Style/HashConversion: # (new in 1.10)
|
334
|
+
Enabled: true
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7
|
data/.simplecov
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--no-private --protected lib/**/*.rb -m markdown
|
data/CHANGES.md
ADDED
data/Dockerfile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# =============================================================================
|
2
|
+
# Target: base
|
3
|
+
|
4
|
+
FROM ruby:2.7-alpine AS base
|
5
|
+
|
6
|
+
RUN apk --no-cache --update upgrade && \
|
7
|
+
apk --no-cache add \
|
8
|
+
bash \
|
9
|
+
ca-certificates \
|
10
|
+
git \
|
11
|
+
libc6-compat \
|
12
|
+
openssl \
|
13
|
+
tzdata \
|
14
|
+
xz-libs \
|
15
|
+
&& rm -rf /var/cache/apk/*
|
16
|
+
|
17
|
+
WORKDIR /opt/app
|
18
|
+
|
19
|
+
# =============================================================================
|
20
|
+
# Target: development
|
21
|
+
#
|
22
|
+
|
23
|
+
FROM base AS development
|
24
|
+
|
25
|
+
# Install system packages needed to build gems with C extensions.
|
26
|
+
RUN apk --update --no-cache add \
|
27
|
+
build-base \
|
28
|
+
coreutils \
|
29
|
+
git \
|
30
|
+
&& rm -rf /var/cache/apk/*
|
31
|
+
|
32
|
+
# The base image ships bundler 1.17.2, but we want something more recent
|
33
|
+
RUN gem install bundler -v 2.1.4
|
34
|
+
|
35
|
+
# Copy codebase to WORKDIR. Unlike application projects, for a gem project
|
36
|
+
# we need to do this before running `bundle install`, in order for the gem
|
37
|
+
# we're building to be able to "install" itself.
|
38
|
+
COPY . .
|
39
|
+
|
40
|
+
# Install gems.
|
41
|
+
RUN bundle install --path=/usr/local/bundle
|
42
|
+
|
43
|
+
# =============================================================================
|
44
|
+
# Target: production
|
45
|
+
|
46
|
+
FROM base AS production
|
47
|
+
|
48
|
+
# Copy the built codebase from the dev stage
|
49
|
+
COPY --from=development /opt/app /opt/app
|
50
|
+
COPY --from=development /usr/local/bundle /usr/local/bundle
|
51
|
+
|
52
|
+
# Sanity-check that everything was installed correctly and still runs in the
|
53
|
+
# slimmed-down production image.
|
54
|
+
RUN bundle config set deployment 'true'
|
55
|
+
RUN bundle install --local --path=/usr/local/bundle
|
56
|
+
|
57
|
+
CMD ['bundle', 'exec', 'rake']
|
data/Gemfile
ADDED