berkeley_library-tind 0.7.2 → 0.7.3
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 +37 -23
- data/.github/workflows/gem-push.yml +1 -1
- data/.rubocop.yml +232 -4
- data/.ruby-version +1 -1
- data/Dockerfile +3 -2
- data/Rakefile +1 -1
- data/berkeley_library-tind.gemspec +10 -5
- data/bin/alma-single-tind +1 -1
- data/bin/save_tind_records +3 -3
- data/bin/tind-marc +1 -1
- data/lib/berkeley_library/tind/api/api.rb +1 -1
- data/lib/berkeley_library/tind/api.rb +1 -1
- data/lib/berkeley_library/tind/export/column_group.rb +2 -2
- data/lib/berkeley_library/tind/export/column_group_list.rb +4 -4
- data/lib/berkeley_library/tind/export/export_format.rb +6 -3
- data/lib/berkeley_library/tind/export/exporter.rb +2 -1
- data/lib/berkeley_library/tind/export/table.rb +1 -1
- data/lib/berkeley_library/tind/export.rb +1 -1
- data/lib/berkeley_library/tind/mapping/data/one_to_one_mapping.csv +2 -1
- data/lib/berkeley_library/tind/mapping/external_tind_field.rb +2 -2
- data/lib/berkeley_library/tind/mapping/field_catalog_util.rb +4 -3
- data/lib/berkeley_library/tind/mapping.rb +1 -1
- data/lib/berkeley_library/tind/marc/xml_reader.rb +1 -1
- data/lib/berkeley_library/tind/marc.rb +1 -1
- data/lib/berkeley_library/tind/module_info.rb +3 -3
- data/lib/berkeley_library/tind.rb +1 -1
- data/lib/berkeley_library/util/ods/xml/namespace.rb +2 -1
- data/lib/berkeley_library/util/ods/xml/office/automatic_styles.rb +2 -1
- data/lib/berkeley_library/util/ods/xml/style/text_properties.rb +1 -1
- data/lib/berkeley_library/util/ods/xml/table/table_column.rb +2 -2
- data/lib/berkeley_library/util/ods/xml/text/p.rb +2 -1
- data/lib/berkeley_library/view +339 -0
- data/spec/berkeley_library/tind/api/collection_spec.rb +1 -1
- data/spec/berkeley_library/tind/api/search_spec.rb +3 -2
- data/spec/berkeley_library/tind/config_spec.rb +11 -8
- data/spec/berkeley_library/tind/export/config_spec.rb +3 -3
- data/spec/berkeley_library/tind/mapping/alma_spec.rb +11 -1
- data/spec/berkeley_library/tind/mapping/csv_mapper_spec.rb +2 -2
- data/spec/berkeley_library/tind/mapping/field_catalog_util_spec.rb +1 -1
- data/spec/berkeley_library/tind/mapping/tind_field_spec.rb +4 -4
- data/spec/berkeley_library/tind/mapping/tind_record_util_spec.rb +1 -1
- data/spec/berkeley_library/tind/mapping/util_spec.rb +4 -0
- data/spec/berkeley_library/tind/marc/xml_reader_spec.rb +1 -1
- data/spec/berkeley_library/util/ods/spreadsheet_spec.rb +4 -2
- data/spec/data/mapping/one_to_one_mapping.csv +2 -1
- data/spec/data/mapping/record_missing_control.xml +253 -0
- metadata +35 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0c5e5e73cff3d4fa52b47b3edf5f4900a15ccdd29920676cfb7f033551928db
|
4
|
+
data.tar.gz: 6d6699d565c14caf6df51817a57d9ab5be8aa51ea72879cba9dc00a98745365e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e9a96fb603c2dd38f1a237ff4a468aa89f7e577190a59365923392ccd5b815ca162afc7cfd7ade7947aeb001ae52fd09111ab42c874ef937a2571b7bc96545a
|
7
|
+
data.tar.gz: ca40e508696bd12f0d08082bc6bcf59898b041104554245b19d58513d508393e16cd6bb6a15141a83c9e52512a5adb5e77a40d99ce1d5a5bc2184b80284926fa
|
data/.github/workflows/build.yml
CHANGED
@@ -1,30 +1,44 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Build
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ "main" ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ "main" ]
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: read
|
18
|
+
|
3
19
|
jobs:
|
4
20
|
test:
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
5
23
|
strategy:
|
6
|
-
fail-fast: false
|
7
24
|
matrix:
|
8
|
-
|
9
|
-
ruby: [ '2.7', '3.0' ]
|
10
|
-
runs-on: ${{ matrix.os }}
|
25
|
+
ruby-version: ['3.3', '3.4']
|
11
26
|
|
12
27
|
steps:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
run: bundle exec rake
|
28
|
+
- uses: actions/checkout@v4
|
29
|
+
with:
|
30
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
31
|
+
- name: Set up Ruby
|
32
|
+
uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby-version }}
|
35
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
36
|
+
- name: Run tests
|
37
|
+
run: bundle exec rake
|
24
38
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
39
|
+
- name: Upload artifacts
|
40
|
+
if: ${{ always() }}
|
41
|
+
uses: actions/upload-artifact@v4
|
42
|
+
with:
|
43
|
+
name: artifacts-${{ matrix.ruby-version }}
|
44
|
+
path: artifacts/**
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
|
1
4
|
inherit_mode:
|
2
5
|
merge:
|
3
6
|
- Exclude
|
@@ -295,7 +298,7 @@ Lint/OrAssignmentToConstant: # (new in 1.9)
|
|
295
298
|
Lint/RedundantDirGlobSort: # (new in 1.8)
|
296
299
|
Enabled: true
|
297
300
|
Lint/SymbolConversion: # (new in 1.9)
|
298
|
-
Enabled:
|
301
|
+
Enabled: false
|
299
302
|
Lint/ToEnumArguments: # (new in 1.1)
|
300
303
|
Enabled: true
|
301
304
|
Lint/TripleQuotes: # (new in 1.9)
|
@@ -305,7 +308,7 @@ Lint/UnexpectedBlockArity: # (new in 1.5)
|
|
305
308
|
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
|
306
309
|
Enabled: true
|
307
310
|
Style/ArgumentsForwarding: # (new in 1.1)
|
308
|
-
Enabled:
|
311
|
+
Enabled: false
|
309
312
|
Style/CollectionCompact: # (new in 1.2)
|
310
313
|
Enabled: true
|
311
314
|
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
|
@@ -328,7 +331,232 @@ Style/SwapValues: # (new in 1.1)
|
|
328
331
|
############################################################
|
329
332
|
# Added in RuboCop 1.10
|
330
333
|
|
331
|
-
Gemspec/
|
334
|
+
Gemspec/DeprecatedAttributeAssignment:
|
332
335
|
Enabled: true
|
333
336
|
Style/HashConversion: # (new in 1.10)
|
334
|
-
Enabled: true
|
337
|
+
Enabled: true
|
338
|
+
|
339
|
+
#######################################
|
340
|
+
# Added in rubocop 1.77
|
341
|
+
|
342
|
+
Gemspec/AddRuntimeDependency: # new in 1.65
|
343
|
+
Enabled: true
|
344
|
+
Gemspec/AttributeAssignment: # new in 1.77
|
345
|
+
Enabled: true
|
346
|
+
Gemspec/DevelopmentDependencies: # new in 1.44
|
347
|
+
Enabled: true
|
348
|
+
Gemspec/RequireMFA: # new in 1.23
|
349
|
+
Enabled: true
|
350
|
+
Layout/LineContinuationLeadingSpace: # new in 1.31
|
351
|
+
Enabled: true
|
352
|
+
Layout/LineContinuationSpacing: # new in 1.31
|
353
|
+
Enabled: true
|
354
|
+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
355
|
+
Enabled: true
|
356
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
357
|
+
Enabled: true
|
358
|
+
Lint/AmbiguousRange: # new in 1.19
|
359
|
+
Enabled: true
|
360
|
+
Lint/ArrayLiteralInRegexp: # new in 1.71
|
361
|
+
Enabled: true
|
362
|
+
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
363
|
+
Enabled: true
|
364
|
+
Lint/ConstantReassignment: # new in 1.70
|
365
|
+
Enabled: true
|
366
|
+
Lint/CopDirectiveSyntax: # new in 1.72
|
367
|
+
Enabled: true
|
368
|
+
Lint/DuplicateMagicComment: # new in 1.37
|
369
|
+
Enabled: true
|
370
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
371
|
+
Enabled: true
|
372
|
+
Lint/DuplicateSetElement: # new in 1.67
|
373
|
+
Enabled: true
|
374
|
+
Lint/EmptyInPattern: # new in 1.16
|
375
|
+
Enabled: true
|
376
|
+
Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
|
377
|
+
Enabled: true
|
378
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
379
|
+
Enabled: true
|
380
|
+
Lint/ItWithoutArgumentsInBlock: # new in 1.59
|
381
|
+
Enabled: true
|
382
|
+
Lint/LiteralAssignmentInCondition: # new in 1.58
|
383
|
+
Enabled: true
|
384
|
+
Lint/MixedCaseRange: # new in 1.53
|
385
|
+
Enabled: true
|
386
|
+
Lint/NonAtomicFileOperation: # new in 1.31
|
387
|
+
Enabled: true
|
388
|
+
Lint/NumericOperationWithConstantResult: # new in 1.69
|
389
|
+
Enabled: true
|
390
|
+
Lint/RedundantRegexpQuantifiers: # new in 1.53
|
391
|
+
Enabled: true
|
392
|
+
Lint/RedundantTypeConversion: # new in 1.72
|
393
|
+
Enabled: true
|
394
|
+
Lint/RefinementImportMethods: # new in 1.27
|
395
|
+
Enabled: true
|
396
|
+
Lint/RequireRangeParentheses: # new in 1.32
|
397
|
+
Enabled: true
|
398
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
399
|
+
Enabled: true
|
400
|
+
Lint/SharedMutableDefault: # new in 1.70
|
401
|
+
Enabled: true
|
402
|
+
Lint/SuppressedExceptionInNumberConversion: # new in 1.72
|
403
|
+
Enabled: true
|
404
|
+
Lint/UnescapedBracketInRegexp: # new in 1.68
|
405
|
+
Enabled: true
|
406
|
+
Lint/UselessConstantScoping: # new in 1.72
|
407
|
+
Enabled: true
|
408
|
+
Lint/UselessDefaultValueArgument: # new in 1.76
|
409
|
+
Enabled: true
|
410
|
+
Lint/UselessDefined: # new in 1.69
|
411
|
+
Enabled: true
|
412
|
+
Lint/UselessNumericOperation: # new in 1.66
|
413
|
+
Enabled: true
|
414
|
+
Lint/UselessOr: # new in 1.76
|
415
|
+
Enabled: true
|
416
|
+
Lint/UselessRescue: # new in 1.43
|
417
|
+
Enabled: true
|
418
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
419
|
+
Enabled: true
|
420
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
421
|
+
Enabled: true
|
422
|
+
Naming/BlockForwarding: # new in 1.24
|
423
|
+
Enabled: false
|
424
|
+
Naming/PredicateMethod: # new in 1.76
|
425
|
+
Enabled: true
|
426
|
+
Security/CompoundHash: # new in 1.28
|
427
|
+
Enabled: true
|
428
|
+
Security/IoMethods: # new in 1.22
|
429
|
+
Enabled: true
|
430
|
+
Style/AmbiguousEndlessMethodDefinition: # new in 1.68
|
431
|
+
Enabled: true
|
432
|
+
Style/ArrayIntersect: # new in 1.40
|
433
|
+
Enabled: true
|
434
|
+
Style/BitwisePredicate: # new in 1.68
|
435
|
+
Enabled: true
|
436
|
+
Style/CollectionQuerying: # new in 1.77
|
437
|
+
Enabled: true
|
438
|
+
Style/CombinableDefined: # new in 1.68
|
439
|
+
Enabled: true
|
440
|
+
Style/ComparableBetween: # new in 1.74
|
441
|
+
Enabled: true
|
442
|
+
Style/ComparableClamp: # new in 1.44
|
443
|
+
Enabled: true
|
444
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
445
|
+
Enabled: true
|
446
|
+
Style/DataInheritance: # new in 1.49
|
447
|
+
Enabled: true
|
448
|
+
Style/DigChain: # new in 1.69
|
449
|
+
Enabled: true
|
450
|
+
Style/DirEmpty: # new in 1.48
|
451
|
+
Enabled: true
|
452
|
+
Style/EmptyHeredoc: # new in 1.32
|
453
|
+
Enabled: true
|
454
|
+
Style/EmptyStringInsideInterpolation: # new in 1.76
|
455
|
+
Enabled: true
|
456
|
+
Style/EnvHome: # new in 1.29
|
457
|
+
Enabled: true
|
458
|
+
Style/ExactRegexpMatch: # new in 1.51
|
459
|
+
Enabled: true
|
460
|
+
Style/FetchEnvVar: # new in 1.28
|
461
|
+
Enabled: true
|
462
|
+
Style/FileEmpty: # new in 1.48
|
463
|
+
Enabled: true
|
464
|
+
Style/FileNull: # new in 1.69
|
465
|
+
Enabled: true
|
466
|
+
Style/FileRead: # new in 1.24
|
467
|
+
Enabled: true
|
468
|
+
Style/FileTouch: # new in 1.69
|
469
|
+
Enabled: true
|
470
|
+
Style/FileWrite: # new in 1.24
|
471
|
+
Enabled: true
|
472
|
+
Style/HashFetchChain: # new in 1.75
|
473
|
+
Enabled: true
|
474
|
+
Style/HashSlice: # new in 1.71
|
475
|
+
Enabled: true
|
476
|
+
Style/InPatternThen: # new in 1.16
|
477
|
+
Enabled: true
|
478
|
+
Style/ItAssignment: # new in 1.70
|
479
|
+
Enabled: true
|
480
|
+
Style/ItBlockParameter: # new in 1.75
|
481
|
+
Enabled: true
|
482
|
+
Style/KeywordArgumentsMerging: # new in 1.68
|
483
|
+
Enabled: true
|
484
|
+
Style/MagicCommentFormat: # new in 1.35
|
485
|
+
Enabled: true
|
486
|
+
Style/MapCompactWithConditionalBlock: # new in 1.30
|
487
|
+
Enabled: true
|
488
|
+
Style/MapIntoArray: # new in 1.63
|
489
|
+
Enabled: true
|
490
|
+
Style/MapToHash: # new in 1.24
|
491
|
+
Enabled: true
|
492
|
+
Style/MapToSet: # new in 1.42
|
493
|
+
Enabled: true
|
494
|
+
Style/MinMaxComparison: # new in 1.42
|
495
|
+
Enabled: true
|
496
|
+
Style/MultilineInPatternThen: # new in 1.16
|
497
|
+
Enabled: true
|
498
|
+
Style/NestedFileDirname: # new in 1.26
|
499
|
+
Enabled: true
|
500
|
+
Style/NumberedParameters: # new in 1.22
|
501
|
+
Enabled: true
|
502
|
+
Style/NumberedParametersLimit: # new in 1.22
|
503
|
+
Enabled: true
|
504
|
+
Style/ObjectThen: # new in 1.28
|
505
|
+
Enabled: true
|
506
|
+
Style/OpenStructUse: # new in 1.23
|
507
|
+
Enabled: true
|
508
|
+
Style/OperatorMethodCall: # new in 1.37
|
509
|
+
Enabled: true
|
510
|
+
Style/QuotedSymbols: # new in 1.16
|
511
|
+
Enabled: true
|
512
|
+
Style/RedundantArrayConstructor: # new in 1.52
|
513
|
+
Enabled: true
|
514
|
+
Style/RedundantArrayFlatten: # new in 1.76
|
515
|
+
Enabled: true
|
516
|
+
Style/RedundantConstantBase: # new in 1.40
|
517
|
+
Enabled: true
|
518
|
+
Style/RedundantCurrentDirectoryInPath: # new in 1.53
|
519
|
+
Enabled: true
|
520
|
+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
521
|
+
Enabled: true
|
522
|
+
Style/RedundantEach: # new in 1.38
|
523
|
+
Enabled: true
|
524
|
+
Style/RedundantFilterChain: # new in 1.52
|
525
|
+
Enabled: true
|
526
|
+
Style/RedundantFormat: # new in 1.72
|
527
|
+
Enabled: true
|
528
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
529
|
+
Enabled: true
|
530
|
+
Style/RedundantInitialize: # new in 1.27
|
531
|
+
Enabled: true
|
532
|
+
Style/RedundantInterpolationUnfreeze: # new in 1.66
|
533
|
+
Enabled: true
|
534
|
+
Style/RedundantLineContinuation: # new in 1.49
|
535
|
+
Enabled: true
|
536
|
+
Style/RedundantRegexpArgument: # new in 1.53
|
537
|
+
Enabled: true
|
538
|
+
Style/RedundantRegexpConstructor: # new in 1.52
|
539
|
+
Enabled: true
|
540
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
541
|
+
Enabled: true
|
542
|
+
Style/RedundantStringEscape: # new in 1.37
|
543
|
+
Enabled: true
|
544
|
+
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
|
545
|
+
Enabled: true
|
546
|
+
Style/SafeNavigationChainLength: # new in 1.68
|
547
|
+
Enabled: true
|
548
|
+
Style/SelectByRegexp: # new in 1.22
|
549
|
+
Enabled: true
|
550
|
+
Style/SendWithLiteralMethodName: # new in 1.64
|
551
|
+
Enabled: true
|
552
|
+
Style/SingleLineDoEndBlock: # new in 1.57
|
553
|
+
Enabled: true
|
554
|
+
Style/StringChars: # new in 1.12
|
555
|
+
Enabled: true
|
556
|
+
Style/SuperArguments: # new in 1.64
|
557
|
+
Enabled: true
|
558
|
+
Style/SuperWithArgsParentheses: # new in 1.58
|
559
|
+
Enabled: true
|
560
|
+
Style/YAMLFileRead: # new in 1.53
|
561
|
+
Enabled: true
|
562
|
+
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.7
|
data/Dockerfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# =============================================================================
|
2
2
|
# Target: base
|
3
3
|
|
4
|
-
FROM ruby:
|
4
|
+
FROM ruby:3.3-alpine AS base
|
5
5
|
|
6
6
|
RUN apk --no-cache --update upgrade && \
|
7
7
|
apk --no-cache add \
|
@@ -26,11 +26,12 @@ FROM base AS development
|
|
26
26
|
RUN apk --update --no-cache add \
|
27
27
|
build-base \
|
28
28
|
coreutils \
|
29
|
+
yaml-dev \
|
29
30
|
git \
|
30
31
|
&& rm -rf /var/cache/apk/*
|
31
32
|
|
32
33
|
# The base image ships bundler 1.17.2, but we want something more recent
|
33
|
-
RUN gem install bundler -v 2.
|
34
|
+
RUN gem install bundler -v 2.5.22
|
34
35
|
|
35
36
|
# Copy codebase to WORKDIR. Unlike application projects, for a gem project
|
36
37
|
# we need to do this before running `bundle install`, in order for the gem
|
data/Rakefile
CHANGED
@@ -2,14 +2,16 @@ File.expand_path('lib', __dir__).tap do |lib|
|
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
end
|
4
4
|
|
5
|
-
ruby_version = '>=
|
5
|
+
ruby_version = '>= 3.3'
|
6
6
|
|
7
7
|
require 'berkeley_library/tind/module_info'
|
8
8
|
|
9
9
|
Gem::Specification.new do |spec|
|
10
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
11
|
+
|
10
12
|
spec.name = BerkeleyLibrary::TIND::ModuleInfo::NAME
|
11
|
-
spec.
|
12
|
-
spec.email = BerkeleyLibrary::TIND::ModuleInfo::
|
13
|
+
spec.authors = BerkeleyLibrary::TIND::ModuleInfo::AUTHORS
|
14
|
+
spec.email = BerkeleyLibrary::TIND::ModuleInfo::AUTHOR_EMAILS
|
13
15
|
spec.summary = BerkeleyLibrary::TIND::ModuleInfo::SUMMARY
|
14
16
|
spec.description = BerkeleyLibrary::TIND::ModuleInfo::DESCRIPTION
|
15
17
|
spec.license = BerkeleyLibrary::TIND::ModuleInfo::LICENSE
|
@@ -26,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
26
28
|
spec.add_dependency 'berkeley_library-logging', '~> 0.2'
|
27
29
|
spec.add_dependency 'berkeley_library-marc', '~> 0.3.0', '>= 0.3.1'
|
28
30
|
spec.add_dependency 'berkeley_library-util', '~> 0.1', '>= 0.1.2'
|
31
|
+
spec.add_dependency 'csv', '~> 3.2.2'
|
29
32
|
spec.add_dependency 'ice_nine', '~> 0.11'
|
30
33
|
spec.add_dependency 'marc', '~> 1.0'
|
31
34
|
spec.add_dependency 'rchardet', '~> 1.8'
|
@@ -33,6 +36,7 @@ Gem::Specification.new do |spec|
|
|
33
36
|
spec.add_dependency 'rubyzip', '~> 2.3', '< 3.0'
|
34
37
|
spec.add_dependency 'typesafe_enum', '~> 0.3'
|
35
38
|
|
39
|
+
# rubocop:disable Gemspec/DevelopmentDependencies
|
36
40
|
spec.add_development_dependency 'bundle-audit', '~> 0.1'
|
37
41
|
spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
|
38
42
|
spec.add_development_dependency 'colorize', '~> 0.8'
|
@@ -41,11 +45,12 @@ Gem::Specification.new do |spec|
|
|
41
45
|
spec.add_development_dependency 'rake', '~> 13.0'
|
42
46
|
spec.add_development_dependency 'roo', '~> 2.8'
|
43
47
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
44
|
-
spec.add_development_dependency 'rubocop', '= 1.
|
48
|
+
spec.add_development_dependency 'rubocop', '= 1.77'
|
45
49
|
spec.add_development_dependency 'rubocop-rake', '~> 0.5'
|
46
50
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.2'
|
47
|
-
spec.add_development_dependency 'ruby-prof', '~>
|
51
|
+
spec.add_development_dependency 'ruby-prof', '~> 1.7'
|
48
52
|
spec.add_development_dependency 'simplecov', '~> 0.21'
|
49
53
|
spec.add_development_dependency 'simplecov-rcov', '~> 0.2'
|
50
54
|
spec.add_development_dependency 'webmock', '~> 3.12'
|
55
|
+
# rubocop:enable Gemspec/DevelopmentDependencies
|
51
56
|
end
|
data/bin/alma-single-tind
CHANGED
@@ -29,7 +29,7 @@ def additional_tind_fields
|
|
29
29
|
txt = 'v001_0064'
|
30
30
|
url = 'https://digitalassets.lib.berkeley.edu/pre1912ChineseMaterials/ucb/ready/991032333019706532/991032333019706532_v001_0064.jpg'
|
31
31
|
fft = BerkeleyLibrary::TIND::Mapping::TindField.f_fft(url, txt)
|
32
|
-
f =
|
32
|
+
f = MARC::DataField.new('998', ' ', ' ', ['a', 'fake-value'])
|
33
33
|
[fft] << f
|
34
34
|
end
|
35
35
|
|
data/bin/save_tind_records
CHANGED
@@ -30,7 +30,7 @@ def fake_additional_tind_fields1
|
|
30
30
|
txt = '001'
|
31
31
|
url = 'https://digitalassets.lib.berkeley.edu/forestry/ucb/images/b142086125_i180839998/b142086125_i180839998_001.jpg'
|
32
32
|
fft = BerkeleyLibrary::TIND::Mapping::TindField.f_fft(url, txt)
|
33
|
-
f_998 =
|
33
|
+
f_998 = MARC::DataField.new('998', ' ', ' ', ['a', 'fake-value'])
|
34
34
|
f_035 = BerkeleyLibrary::TIND::Mapping::TindField.f_035('b142086125')
|
35
35
|
fields << f_998
|
36
36
|
fields << f_035
|
@@ -43,7 +43,7 @@ def fake_additional_tind_fields2
|
|
43
43
|
url = 'https://digitalassets.lib.berkeley.edu/forestry/ucb/images/b142086125_i180839998/b142086125_i180839998_002.jpg'
|
44
44
|
fft = BerkeleyLibrary::TIND::Mapping::TindField.f_fft(url, txt)
|
45
45
|
|
46
|
-
f_998 =
|
46
|
+
f_998 = MARC::DataField.new('998', ' ', ' ', ['a', 'fake-value'])
|
47
47
|
|
48
48
|
f_035 = BerkeleyLibrary::TIND::Mapping::TindField.f_035('b142107827')
|
49
49
|
fields << f_998
|
@@ -63,7 +63,7 @@ end
|
|
63
63
|
|
64
64
|
def save_batch(file, with_tind_xmlwritter)
|
65
65
|
setup
|
66
|
-
writer =
|
66
|
+
writer = MARC::XMLWriter.new(file)
|
67
67
|
writer = BerkeleyLibrary::TIND::MARC::XMLWriter.new(file) if with_tind_xmlwritter
|
68
68
|
|
69
69
|
tind_records.each do |record|
|
data/bin/tind-marc
CHANGED
@@ -47,7 +47,7 @@ other_external_tind_fields.concat tind_fields_from_alma_id
|
|
47
47
|
|
48
48
|
new_subfield1 = BerkeleyLibrary::TIND::Mapping::Util.subfield('a', 'https://digitalassets.lib.berkeley.edu/pre1912ChineseMaterials/ucb/ready/991032333019706532/991032333019706532_v001_0064.jpg')
|
49
49
|
new_subfield2 = BerkeleyLibrary::TIND::Mapping::Util.subfield('d', 'v001_0064')
|
50
|
-
fft_datafield = BerkeleyLibrary::TIND::Mapping::Util.datafield('FFT', [' ',
|
50
|
+
fft_datafield = BerkeleyLibrary::TIND::Mapping::Util.datafield('FFT', [' ', ' '], [new_subfield1, new_subfield2])
|
51
51
|
ffts = [fft_datafield]
|
52
52
|
|
53
53
|
# 5. put all external tind fields together
|
@@ -28,7 +28,7 @@ module BerkeleyLibrary
|
|
28
28
|
# Gets the API base URI.
|
29
29
|
# @return [URI] the API base URI
|
30
30
|
def api_base_uri
|
31
|
-
return if Config.blank?(
|
31
|
+
return if Config.blank?(base_uri = Config.base_uri)
|
32
32
|
|
33
33
|
URIs.append(base_uri, '/api/v1')
|
34
34
|
end
|
@@ -1 +1 @@
|
|
1
|
-
Dir.glob(File.expand_path('api/*.rb', __dir__)).
|
1
|
+
Dir.glob(File.expand_path('api/*.rb', __dir__)).each(&method(:require))
|
@@ -16,9 +16,9 @@ module BerkeleyLibrary
|
|
16
16
|
|
17
17
|
# Indicators SHOULD NOT be capital letters, but TIND internal fields
|
18
18
|
# don't respect that. Thus the /i flag.
|
19
|
-
INDICATOR_RE = /^[0-9a-z ]$/i
|
19
|
+
INDICATOR_RE = /^[0-9a-z ]$/i
|
20
20
|
|
21
|
-
SUBFIELD_CODE_RE = /^[0-9a-z]
|
21
|
+
SUBFIELD_CODE_RE = /^[0-9a-z]$/
|
22
22
|
|
23
23
|
# ------------------------------------------------------------
|
24
24
|
# Accessors
|
@@ -42,7 +42,7 @@ module BerkeleyLibrary
|
|
42
42
|
def add_data_fields(marc_record, row)
|
43
43
|
# TODO: what about control fields?
|
44
44
|
marc_record.data_fields_by_tag.each do |tag, data_fields|
|
45
|
-
next unless can_export_tag(tag)
|
45
|
+
next unless can_export_tag?(tag)
|
46
46
|
next if data_fields.empty?
|
47
47
|
|
48
48
|
add_fields_at(data_fields, row)
|
@@ -87,7 +87,7 @@ module BerkeleyLibrary
|
|
87
87
|
tag_column_groups = (column_groups_by_tag[tag] ||= [])
|
88
88
|
|
89
89
|
data_fields.inject(0) do |offset, df|
|
90
|
-
next offset unless can_export_df(df)
|
90
|
+
next offset unless can_export_df?(df)
|
91
91
|
|
92
92
|
1 + add_data_field(df, row, tag_column_groups, at_or_after: offset)
|
93
93
|
end
|
@@ -108,13 +108,13 @@ module BerkeleyLibrary
|
|
108
108
|
BerkeleyLibrary::Util::Arrays.find_index(in_array: tag_column_groups, start_index: at_or_after) { |cg| cg.maybe_add_at(row, df) }
|
109
109
|
end
|
110
110
|
|
111
|
-
def can_export_tag(tag)
|
111
|
+
def can_export_tag?(tag)
|
112
112
|
return true unless exportable_only?
|
113
113
|
|
114
114
|
Filter.can_export_tag?(tag)
|
115
115
|
end
|
116
116
|
|
117
|
-
def can_export_df(df)
|
117
|
+
def can_export_df?(df)
|
118
118
|
return true unless exportable_only?
|
119
119
|
|
120
120
|
Filter.can_export_data_field?(df)
|
@@ -13,17 +13,20 @@ module BerkeleyLibrary
|
|
13
13
|
|
14
14
|
def exporter_for(collection, exportable_only: true)
|
15
15
|
return CSVExporter.new(collection, exportable_only: exportable_only) if self == ExportFormat::CSV
|
16
|
-
|
16
|
+
|
17
|
+
ODSExporter.new(collection, exportable_only: exportable_only) if self == ExportFormat::ODS
|
17
18
|
end
|
18
19
|
|
19
20
|
def description
|
20
21
|
return 'CSV (comma-separated text)' if self == ExportFormat::CSV
|
21
|
-
|
22
|
+
|
23
|
+
'LibreOffice/OpenOffice spreadsheet' if self == ExportFormat::ODS
|
22
24
|
end
|
23
25
|
|
24
26
|
def mime_type
|
25
27
|
return 'text/csv' if self == ExportFormat::CSV
|
26
|
-
|
28
|
+
|
29
|
+
'application/vnd.oasis.opendocument.spreadsheet' if self == ExportFormat::ODS
|
27
30
|
end
|
28
31
|
|
29
32
|
def to_s
|
@@ -58,12 +58,13 @@ module BerkeleyLibrary
|
|
58
58
|
|
59
59
|
# ------------------------------------------------------------
|
60
60
|
# Object overrides
|
61
|
-
|
61
|
+
# rubocop:disable Style/RedundantParentheses
|
62
62
|
def respond_to?(*args)
|
63
63
|
return false if instance_of?(Exporter) && (args && args.first.to_s == 'export')
|
64
64
|
|
65
65
|
super
|
66
66
|
end
|
67
|
+
# rubocop:enable Style/RedundantParentheses
|
67
68
|
|
68
69
|
# ------------------------------------------------------------
|
69
70
|
# Protected methods
|
@@ -161,7 +161,7 @@ module BerkeleyLibrary
|
|
161
161
|
private
|
162
162
|
|
163
163
|
def log_record_added(marc_record)
|
164
|
-
|
164
|
+
logger.debug("Added record no. #{marc_record.record_id}: #{row_count} records total") if marc_record
|
165
165
|
end
|
166
166
|
|
167
167
|
def write_csv(out)
|
@@ -1 +1 @@
|
|
1
|
-
Dir.glob(File.expand_path('export/*.rb', __dir__)).
|
1
|
+
Dir.glob(File.expand_path('export/*.rb', __dir__)).each(&method(:require))
|
@@ -23,6 +23,7 @@
|
|
23
23
|
541,541,6,6,,"c,a,d",a,,,,,,,,"_,_",,,,,
|
24
24
|
545,545,"6,a","6,a",,,,,,,,,,,"_,_",,,,,
|
25
25
|
546,546,"6,a","6,a",,,,,,,,,,,"_,_",,,,,
|
26
|
+
561,561,"6,a","6,a",,,,,,,,,,,"_,_",,,,,
|
26
27
|
600,600,6,6,,"a,b,c,d,f,j,k,l,m,n,o,p,q,r,s,t",a,,"x,y,z,v",a,a--a,,,,"_,_",,,,,
|
27
28
|
610,610,6,6,,"a,b,c,d,f,j,k,l,m,n,o,p,q,r,s,t",a,,"x,y,z,v",a,a--a,,,,"_,_",,,,,
|
28
29
|
611,611,6,6,,"a,b,c,d,f,j,k,l,m,n,o,p,q,r,s,t",a,,"x,y,z,v",a,a--a,,,,"_,_",,,,,
|
@@ -36,4 +37,4 @@
|
|
36
37
|
720,700,"6,a,e","6,a,e",,,,,,,,,,,"1,_",,,,,
|
37
38
|
752,651,6,6,,,,,"a,b,c,d,f,g",a,a--a,,,,"_,_",,,,,
|
38
39
|
773,773,"6,t,j,k,o","6,t,j,k,o",,,,,,,,,,,"_,_",,,,,
|
39
|
-
907,901,"6,a","6,m",,,,,,,,,,,"_,_",,,,,
|
40
|
+
907,901,"6,a","6,m",,,,,,,,,,,"_,_",,,,,
|
@@ -81,7 +81,7 @@ module BerkeleyLibrary
|
|
81
81
|
|
82
82
|
def valid_collection_hash?(hash)
|
83
83
|
return false unless valid_item?(hash, '336', 1) &&
|
84
|
-
valid_item?(hash, '852', 1) && valid_item?(hash, '980', 1) && valid_item?(hash, '982', 2) && valid_991(hash)
|
84
|
+
valid_item?(hash, '852', 1) && valid_item?(hash, '980', 1) && valid_item?(hash, '982', 2) && valid_991?(hash)
|
85
85
|
|
86
86
|
true
|
87
87
|
end
|
@@ -90,7 +90,7 @@ module BerkeleyLibrary
|
|
90
90
|
(hash.key? key) && (hash[key].length == num)
|
91
91
|
end
|
92
92
|
|
93
|
-
def valid_991(hash)
|
93
|
+
def valid_991?(hash)
|
94
94
|
cout = hash['991'].length
|
95
95
|
[0, 1].include?(cout)
|
96
96
|
end
|
@@ -36,7 +36,8 @@ module BerkeleyLibrary
|
|
36
36
|
return [] if including_defined && excluding_defined # not allow to define both including and excluding tags
|
37
37
|
return fields unless including_defined || excluding_defined # Neither including nor excluding tags are defined
|
38
38
|
return fields_included(fields) if including_defined # including tags defined
|
39
|
-
|
39
|
+
|
40
|
+
fields_exclued(fields) if excluding_defined # excluding tags defined
|
40
41
|
end
|
41
42
|
|
42
43
|
private
|
@@ -72,7 +73,7 @@ module BerkeleyLibrary
|
|
72
73
|
|
73
74
|
def excluding_field?(f)
|
74
75
|
return false unless field_6xx?(f)
|
75
|
-
return false unless subfield2_fast(f)
|
76
|
+
return false unless subfield2_fast?(f)
|
76
77
|
|
77
78
|
true
|
78
79
|
end
|
@@ -83,7 +84,7 @@ module BerkeleyLibrary
|
|
83
84
|
tag =~ /^6\d{2}$/
|
84
85
|
end
|
85
86
|
|
86
|
-
def subfield2_fast(f)
|
87
|
+
def subfield2_fast?(f)
|
87
88
|
subject = f['2']
|
88
89
|
return false unless subject
|
89
90
|
|
@@ -1 +1 @@
|
|
1
|
-
Dir.glob(File.expand_path('mapping/*.rb', __dir__)).
|
1
|
+
Dir.glob(File.expand_path('mapping/*.rb', __dir__)).each(&method(:require))
|