iiif_print 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build-lint-test-action.yaml +4 -5
  3. data/CONTRIBUTING.md +1 -1
  4. data/Dockerfile +1 -1
  5. data/Gemfile.lock +113 -100
  6. data/README.md +3 -3
  7. data/app/controllers/iiif_print/split_pdfs_controller.rb +4 -3
  8. data/app/helpers/iiif_print/iiif_helper_decorator.rb +3 -0
  9. data/app/indexers/concerns/iiif_print/child_work_indexer_decorator.rb +1 -1
  10. data/app/jobs/iiif_print/jobs/child_works_from_pdf_job.rb +2 -1
  11. data/app/jobs/iiif_print/jobs/request_split_pdf_job.rb +7 -7
  12. data/app/models/concerns/iiif_print/solr_document_decorator.rb +9 -4
  13. data/app/models/iiif_print/iiif_search_decorator.rb +1 -1
  14. data/app/models/iiif_print/iiif_search_response_decorator.rb +1 -1
  15. data/app/presenters/iiif_print/iiif_manifest_presenter_factory_decorator.rb +8 -1
  16. data/app/presenters/iiif_print/work_show_presenter_decorator.rb +8 -1
  17. data/app/services/iiif_print/manifest_builder_service_decorator.rb +2 -2
  18. data/app/services/iiif_print/simple_schema_loader_decorator.rb +1 -1
  19. data/app/views/catalog/_index_header_list_default.html.erb +2 -2
  20. data/docker-compose.yml +1 -1
  21. data/iiif_print.gemspec +1 -1
  22. data/lib/iiif_print/blacklight_iiif_search/annotation_decorator.rb +1 -1
  23. data/lib/iiif_print/configuration.rb +6 -0
  24. data/lib/iiif_print/engine.rb +2 -0
  25. data/lib/iiif_print/image_tool.rb +17 -3
  26. data/lib/iiif_print/lineage_service.rb +4 -13
  27. data/lib/iiif_print/persistence_layer/active_fedora_adapter.rb +9 -0
  28. data/lib/iiif_print/persistence_layer/valkyrie_adapter.rb +37 -11
  29. data/lib/iiif_print/persistence_layer.rb +4 -0
  30. data/lib/iiif_print/split_pdfs/child_work_creation_from_pdf_service.rb +14 -6
  31. data/lib/iiif_print/split_pdfs/derivative_rodeo_splitter.rb +1 -1
  32. data/lib/iiif_print/version.rb +1 -1
  33. data/lib/iiif_print.rb +1 -0
  34. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42aafdbd6969538637551e48a96a176cc928b2e9e1a4df887b1cb79e4864a6a0
4
- data.tar.gz: afbefd582dd694b4168481c2bdbc1d7b3f7866529266433188b3eaa1bf4d6f79
3
+ metadata.gz: 157690b7a7cc4421d63f7097e28136c642c5ca5b97a598124fca1304cedcda5f
4
+ data.tar.gz: 31bc61900538c311562a7274d2e419d9fa7370ef0d49bfb65d43a7861679306e
5
5
  SHA512:
6
- metadata.gz: 21c03a9ad7de46c271b8296bc65636d02d2b66fa4881c3eb9f669211300c563e40dc2ec3483b0d04d62f2546346f32fbd417577dc64336479b6ed2f049da8305
7
- data.tar.gz: 7be1097dea227d4ac82b27fbe31cd5553c46fdc376541afea62023d0adda2b18f2ca74b346da8add4b7e50d78bc8b37c525d0ce3bd52acb118c58b59631893af
6
+ metadata.gz: 6a92f15f5b538c393de264fd7330fc841257bfa6bcded9ddccfa9fa84a2686fed1bf4b28cd7d80f87788fe2009433d15489574e58e7fadc76ef655921541be04
7
+ data.tar.gz: bc559c66f29d3d9596b47496c6d251526f2d0ded5f4697cae689d7e8d926fd9ce31f9bd340faaaf2701cdc9aead9f4de8a8329e14f0ee50d3463d4c1d71a85ca
@@ -16,17 +16,16 @@ on:
16
16
 
17
17
  jobs:
18
18
  build:
19
- uses: scientist-softserv/actions/.github/workflows/build.yaml@v0.0.13
19
+ uses: notch8/actions/.github/workflows/build.yaml@v0.0.15
20
20
  secrets: inherit
21
21
  with:
22
22
  platforms: "linux/amd64"
23
- target: hyku-base
24
- worker: false
23
+ webTarget: hyku-base
25
24
  test:
26
25
  needs: build
27
- uses: scientist-softserv/actions/.github/workflows/test.yaml@v0.0.13
26
+ uses: notch8/actions/.github/workflows/test.yaml@v0.0.15
28
27
  with:
29
28
  setup_db_cmd: bundle exec rake prepare_and_run_tests
30
29
  lint:
31
30
  needs: build
32
- uses: scientist-softserv/actions/.github/workflows/lint.yaml@v0.0.13
31
+ uses: notch8/actions/.github/workflows/lint.yaml@v0.0.15
data/CONTRIBUTING.md CHANGED
@@ -45,7 +45,7 @@ further details.
45
45
  ### Reporting Issues
46
46
 
47
47
  - Make sure you have a [GitHub account](https://github.com/signup/free)
48
- - Submit a [Github issue](https://github.com/scientist-softserv/iiif_print/issues/) by:
48
+ - Submit a [Github issue](https://github.com/notch8/iiif_print/issues/) by:
49
49
  - Clearly describing the issue
50
50
  - Provide a descriptive summary
51
51
  - Explain the expected behavior
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ghcr.io/scientist-softserv/dev-ops/samvera:e9200061 as hyku-base
1
+ FROM ghcr.io/notch8/dev-ops/samvera:e9200061 as hyku-base
2
2
  USER root
3
3
  RUN apk add --no-cache sqlite
4
4
  USER app
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: .
2
+ remote: /app/samvera/hyrax-webapp
3
3
  specs:
4
- iiif_print (3.0.1)
4
+ iiif_print (3.0.2)
5
5
  blacklight_iiif_search (>= 1.0, < 3.0)
6
6
  derivative-rodeo (~> 0.5)
7
7
  hyrax (>= 2.5, < 6)
@@ -57,15 +57,15 @@ GEM
57
57
  globalid (>= 0.3.6)
58
58
  activemodel (5.2.8.1)
59
59
  activesupport (= 5.2.8.1)
60
- activemodel-serializers-xml (1.0.2)
61
- activemodel (> 5.x)
62
- activesupport (> 5.x)
60
+ activemodel-serializers-xml (1.0.3)
61
+ activemodel (>= 5.0.0.a)
62
+ activesupport (>= 5.0.0.a)
63
63
  builder (~> 3.1)
64
64
  activerecord (5.2.8.1)
65
65
  activemodel (= 5.2.8.1)
66
66
  activesupport (= 5.2.8.1)
67
67
  arel (>= 9.0)
68
- activerecord-import (1.7.0)
68
+ activerecord-import (2.0.0)
69
69
  activerecord (>= 4.2)
70
70
  activestorage (5.2.8.1)
71
71
  actionpack (= 5.2.8.1)
@@ -84,26 +84,26 @@ GEM
84
84
  ast (2.4.2)
85
85
  autoprefixer-rails (10.4.16.0)
86
86
  execjs (~> 2)
87
- awesome_nested_set (3.6.0)
88
- activerecord (>= 4.0.0, < 7.2)
87
+ awesome_nested_set (3.8.0)
88
+ activerecord (>= 4.0.0, < 8.1)
89
89
  aws-eventstream (1.3.0)
90
- aws-partitions (1.951.0)
91
- aws-sdk-core (3.201.0)
90
+ aws-partitions (1.1043.0)
91
+ aws-sdk-core (3.217.0)
92
92
  aws-eventstream (~> 1, >= 1.3.0)
93
- aws-partitions (~> 1, >= 1.651.0)
94
- aws-sigv4 (~> 1.8)
93
+ aws-partitions (~> 1, >= 1.992.0)
94
+ aws-sigv4 (~> 1.9)
95
95
  jmespath (~> 1, >= 1.6.1)
96
- aws-sdk-kms (1.88.0)
97
- aws-sdk-core (~> 3, >= 3.201.0)
96
+ aws-sdk-kms (1.97.0)
97
+ aws-sdk-core (~> 3, >= 3.216.0)
98
98
  aws-sigv4 (~> 1.5)
99
- aws-sdk-s3 (1.156.0)
100
- aws-sdk-core (~> 3, >= 3.201.0)
99
+ aws-sdk-s3 (1.179.0)
100
+ aws-sdk-core (~> 3, >= 3.216.0)
101
101
  aws-sdk-kms (~> 1)
102
102
  aws-sigv4 (~> 1.5)
103
- aws-sdk-sqs (1.80.0)
104
- aws-sdk-core (~> 3, >= 3.201.0)
103
+ aws-sdk-sqs (1.91.0)
104
+ aws-sdk-core (~> 3, >= 3.216.0)
105
105
  aws-sigv4 (~> 1.5)
106
- aws-sigv4 (1.8.0)
106
+ aws-sigv4 (1.11.0)
107
107
  aws-eventstream (~> 1, >= 1.0.2)
108
108
  babel-source (5.8.35)
109
109
  babel-transpiler (0.7.0)
@@ -113,8 +113,9 @@ GEM
113
113
  base64 (0.2.0)
114
114
  bcp47 (0.3.3)
115
115
  i18n
116
+ bcrypt (3.1.20)
116
117
  benchmark (0.3.0)
117
- bigdecimal (3.1.8)
118
+ bigdecimal (3.1.9)
118
119
  bindex (0.8.1)
119
120
  bixby (5.0.2)
120
121
  rubocop (= 1.28.2)
@@ -149,17 +150,17 @@ GEM
149
150
  autoprefixer-rails (>= 5.2.1)
150
151
  sassc (>= 2.0.0)
151
152
  breadcrumbs_on_rails (3.0.1)
152
- browse-everything (1.3.0)
153
+ browse-everything (1.5.0)
153
154
  addressable (~> 2.5)
154
155
  aws-sdk-s3
155
156
  dropbox_api (>= 0.1.20)
156
157
  google-apis-drive_v3
157
158
  googleauth (>= 0.6.6, < 2.0)
158
- rails (>= 4.2, < 7.2)
159
+ rails (>= 4.2, < 8.1)
159
160
  ruby-box
160
161
  signet (~> 0.8)
161
162
  typhoeus
162
- builder (3.3.0)
163
+ builder (3.2.4)
163
164
  byebug (11.1.3)
164
165
  cancancan (1.17.0)
165
166
  carrierwave (1.3.4)
@@ -175,8 +176,8 @@ GEM
175
176
  coffee-script-source
176
177
  execjs
177
178
  coffee-script-source (1.12.2)
178
- concurrent-ruby (1.3.3)
179
- connection_pool (2.4.1)
179
+ concurrent-ruby (1.2.2)
180
+ connection_pool (2.5.0)
180
181
  coveralls (0.8.23)
181
182
  json (>= 1.8, < 3)
182
183
  simplecov (~> 0.16.1)
@@ -184,7 +185,7 @@ GEM
184
185
  thor (>= 0.19.4, < 2.0)
185
186
  tins (~> 1.6)
186
187
  crass (1.0.6)
187
- csv (3.3.0)
188
+ csv (3.3.2)
188
189
  database_cleaner (1.99.0)
189
190
  date (3.3.4)
190
191
  declarative (0.0.20)
@@ -202,6 +203,14 @@ GEM
202
203
  mime-types
203
204
  mini_magick
204
205
  nokogiri
206
+ devise (4.9.4)
207
+ bcrypt (~> 3.0)
208
+ orm_adapter (~> 0.1)
209
+ railties (>= 4.1.0)
210
+ responders
211
+ warden (~> 1.2.3)
212
+ devise-guests (0.8.3)
213
+ devise
205
214
  diff-lcs (1.5.0)
206
215
  disposable (0.4.7)
207
216
  declarative (>= 0.0.9, < 1.0.0)
@@ -210,7 +219,7 @@ GEM
210
219
  representable (>= 2.4.0, <= 3.1.0)
211
220
  uber (< 0.2.0)
212
221
  docile (1.4.0)
213
- draper (4.0.2)
222
+ draper (4.0.4)
214
223
  actionpack (>= 5.0)
215
224
  activemodel (>= 5.0)
216
225
  activemodel-serializers-xml (>= 1.0)
@@ -283,11 +292,11 @@ GEM
283
292
  scanf (~> 1.0)
284
293
  sxp (~> 1.2)
285
294
  unicode-types (~> 1.8)
286
- engine_cart (2.6.0)
295
+ engine_cart (2.5.0)
287
296
  rails (>= 5.0)
288
297
  equivalent-xml (0.6.0)
289
298
  nokogiri (>= 1.4.3)
290
- erubi (1.13.0)
299
+ erubi (1.12.0)
291
300
  ethon (0.16.0)
292
301
  ffi (>= 1.15.0)
293
302
  execjs (2.9.1)
@@ -295,19 +304,19 @@ GEM
295
304
  activesupport (>= 3.0.0)
296
305
  faraday (0.17.6)
297
306
  multipart-post (>= 1.2, < 3)
298
- faraday-encoding (0.0.5)
307
+ faraday-encoding (0.0.6)
299
308
  faraday
300
309
  fcrepo_wrapper (0.9.0)
301
310
  ruby-progressbar
302
311
  ffi (1.17.0)
303
- flipflop (2.7.1)
312
+ flipflop (2.8.0)
304
313
  activesupport (>= 4.0)
305
314
  terminal-table (>= 1.8)
306
315
  flot-rails (0.0.7)
307
316
  jquery-rails
308
- font-awesome-rails (4.7.0.8)
309
- railties (>= 3.2, < 8.0)
310
- geocoder (1.8.3)
317
+ font-awesome-rails (4.7.0.9)
318
+ railties (>= 3.2, < 9.0)
319
+ geocoder (1.8.5)
311
320
  base64 (>= 0.1.0)
312
321
  csv (>= 3.0.0)
313
322
  globalid (1.1.0)
@@ -374,13 +383,13 @@ GEM
374
383
  hydra-access-controls (= 11.0.7)
375
384
  hydra-core (= 11.0.7)
376
385
  rails (>= 5.2, < 6.1)
377
- hydra-pcdm (1.3.0)
378
- active-fedora (>= 10, < 15)
386
+ hydra-pcdm (1.4.0)
387
+ active-fedora (>= 10)
379
388
  mime-types (>= 1)
380
389
  rdf-vocab
381
- hydra-works (2.1.0)
382
- activesupport (>= 5.2, < 7.1)
383
- hydra-derivatives (~> 3.6)
390
+ hydra-works (2.2.0)
391
+ activesupport (>= 5.2, < 8.0)
392
+ hydra-derivatives (>= 3.6)
384
393
  hydra-file_characterization (~> 1.0)
385
394
  hydra-pcdm (>= 0.9)
386
395
  hyrax (3.6.0)
@@ -441,17 +450,17 @@ GEM
441
450
  signet
442
451
  tinymce-rails (~> 5.10)
443
452
  valkyrie (~> 2, >= 2.1.1)
444
- i18n (1.14.5)
453
+ i18n (1.14.1)
445
454
  concurrent-ruby (~> 1.0)
446
455
  ice_nine (0.11.2)
447
456
  iiif-presentation (1.1.0)
448
457
  activesupport (>= 3.2.18)
449
458
  faraday (>= 0.9)
450
459
  json
451
- iiif_manifest (1.5.0)
460
+ iiif_manifest (1.6.0)
452
461
  activesupport (>= 4)
453
462
  jaro_winkler (1.5.6)
454
- jbuilder (2.11.5)
463
+ jbuilder (2.12.0)
455
464
  actionview (>= 5.0.0)
456
465
  activesupport (>= 5.0.0)
457
466
  jmespath (1.6.2)
@@ -466,7 +475,7 @@ GEM
466
475
  thor (>= 0.14, < 2.0)
467
476
  jquery-ui-rails (6.0.1)
468
477
  railties (>= 3.2.16)
469
- json (2.7.2)
478
+ json (2.6.3)
470
479
  json-canonicalization (0.3.1)
471
480
  json-ld (3.1.10)
472
481
  htmlentities (~> 4.3)
@@ -478,9 +487,10 @@ GEM
478
487
  json-ld-preloaded (3.1.6)
479
488
  json-ld (~> 3.1)
480
489
  rdf (~> 3.1)
481
- json-schema (4.3.0)
482
- addressable (>= 2.8)
483
- jwt (2.8.2)
490
+ json-schema (5.1.1)
491
+ addressable (~> 2.8)
492
+ bigdecimal (~> 3.1)
493
+ jwt (2.10.1)
484
494
  base64
485
495
  kaminari (1.2.2)
486
496
  activesupport (>= 4.1.0)
@@ -551,7 +561,7 @@ GEM
551
561
  shex (~> 0.6, >= 0.6.4)
552
562
  sparql (~> 3.1, >= 3.1.8)
553
563
  sparql-client (~> 3.1, >= 3.1.2)
554
- logger (1.6.0)
564
+ logger (1.6.5)
555
565
  loofah (2.22.0)
556
566
  crass (~> 1.0.2)
557
567
  nokogiri (>= 1.12.0)
@@ -563,42 +573,41 @@ GEM
563
573
  mailboxer (0.15.1)
564
574
  carrierwave (>= 0.5.8)
565
575
  rails (>= 5.0.0)
566
- marcel (1.0.4)
576
+ marcel (1.0.2)
567
577
  matrix (0.4.2)
568
578
  method_source (1.0.0)
569
- mime-types (3.5.2)
579
+ mime-types (3.6.0)
580
+ logger
570
581
  mime-types-data (~> 3.2015)
571
- mime-types-data (3.2024.0702)
572
- mini_magick (4.13.1)
582
+ mime-types-data (3.2025.0107)
583
+ mini_magick (4.13.2)
573
584
  mini_mime (1.1.5)
574
- mini_portile2 (2.8.7)
575
- minitest (5.24.1)
576
- mize (0.4.1)
577
- protocol (~> 2.0)
585
+ mini_portile2 (2.8.5)
586
+ minitest (5.20.0)
578
587
  multi_json (1.15.0)
579
588
  multi_xml (0.6.0)
580
- multipart-post (2.4.1)
589
+ multipart-post (2.3.0)
581
590
  nest (3.2.0)
582
591
  redic
583
- net-http-persistent (4.0.2)
592
+ net-http-persistent (4.0.5)
584
593
  connection_pool (~> 2.2)
585
- net-imap (0.4.14)
594
+ net-imap (0.4.6)
586
595
  date
587
596
  net-protocol
588
597
  net-pop (0.1.2)
589
598
  net-protocol
590
599
  net-protocol (0.2.2)
591
600
  timeout
592
- net-smtp (0.5.0)
601
+ net-smtp (0.4.0)
593
602
  net-protocol
594
603
  newspaper_works_fixtures (0.3.1)
595
604
  rails (~> 5.0)
596
- nio4r (2.7.3)
605
+ nio4r (2.6.1)
597
606
  noid (0.9.0)
598
607
  noid-rails (3.0.3)
599
608
  actionpack (>= 5.0.0, < 7)
600
609
  noid (~> 0.9)
601
- nokogiri (1.15.6)
610
+ nokogiri (1.15.5)
602
611
  mini_portile2 (~> 2.8.2)
603
612
  racc (~> 1.4)
604
613
  oauth (1.1.0)
@@ -615,30 +624,29 @@ GEM
615
624
  rack (>= 1.2, < 4)
616
625
  openseadragon (0.6.0)
617
626
  rails (> 3.2.0)
627
+ orm_adapter (0.5.0)
618
628
  os (1.1.4)
619
- parallel (1.25.1)
620
- parser (3.3.3.0)
629
+ parallel (1.23.0)
630
+ parser (3.2.2.4)
621
631
  ast (~> 2.4.1)
622
632
  racc
623
633
  parslet (2.0.0)
624
634
  posix-spawn (0.3.15)
625
635
  power_converter (0.1.2)
626
- protocol (2.0.0)
627
- ruby_parser (~> 3.0)
628
636
  psych (3.3.4)
629
637
  public_suffix (5.1.1)
630
638
  puma (3.12.6)
631
- qa (5.11.0)
639
+ qa (5.14.0)
632
640
  activerecord-import
633
641
  deprecation
634
642
  faraday (< 3.0, != 2.0.0)
635
643
  geocoder
636
644
  ldpath
637
645
  nokogiri (~> 1.6)
638
- rails (>= 5.0, < 7.2)
646
+ rails (>= 5.0, < 8.1)
639
647
  rdf
640
- racc (1.8.0)
641
- rack (2.2.9)
648
+ racc (1.7.3)
649
+ rack (2.2.8)
642
650
  rack-test (2.1.0)
643
651
  rack (>= 1.3)
644
652
  rails (5.2.8.1)
@@ -676,11 +684,11 @@ GEM
676
684
  rake (>= 0.8.7)
677
685
  thor (>= 0.19.0, < 2.0)
678
686
  rainbow (3.1.1)
679
- rake (13.2.1)
687
+ rake (13.1.0)
680
688
  rb-fsevent (0.11.2)
681
689
  rb-inotify (0.11.1)
682
690
  ffi (~> 1.0)
683
- rdf (3.2.11)
691
+ rdf (3.2.12)
684
692
  link_header (~> 0.0, >= 0.0.8)
685
693
  rdf-aggregate-repo (3.2.1)
686
694
  rdf (~> 3.2)
@@ -754,13 +762,16 @@ GEM
754
762
  reform-rails (0.2.6)
755
763
  activemodel (>= 5.0)
756
764
  reform (>= 2.3.1, < 3.0.0)
757
- regexp_parser (2.9.2)
765
+ regexp_parser (2.8.2)
758
766
  representable (3.0.4)
759
767
  declarative (< 0.1.0)
760
768
  declarative-option (< 0.2.0)
761
769
  uber (< 0.2.0)
762
770
  request_store (1.7.0)
763
771
  rack (>= 1.4)
772
+ responders (3.1.1)
773
+ actionpack (>= 5.2)
774
+ railties (>= 5.2)
764
775
  retriable (3.1.2)
765
776
  reverse_markdown (2.1.1)
766
777
  nokogiri
@@ -768,18 +779,18 @@ GEM
768
779
  rsolr (2.6.0)
769
780
  builder (>= 2.1.2)
770
781
  faraday (>= 0.9, < 3, != 2.0.0)
771
- rspec-activemodel-mocks (1.2.0)
782
+ rspec-activemodel-mocks (1.1.0)
772
783
  activemodel (>= 3.0)
773
784
  activesupport (>= 3.0)
774
785
  rspec-mocks (>= 2.99, < 4.0)
775
- rspec-core (3.13.0)
776
- rspec-support (~> 3.13.0)
777
- rspec-expectations (3.13.1)
786
+ rspec-core (3.12.2)
787
+ rspec-support (~> 3.12.0)
788
+ rspec-expectations (3.12.3)
778
789
  diff-lcs (>= 1.2.0, < 2.0)
779
- rspec-support (~> 3.13.0)
780
- rspec-mocks (3.13.1)
790
+ rspec-support (~> 3.12.0)
791
+ rspec-mocks (3.12.6)
781
792
  diff-lcs (>= 1.2.0, < 2.0)
782
- rspec-support (~> 3.13.0)
793
+ rspec-support (~> 3.12.0)
783
794
  rspec-rails (5.1.2)
784
795
  actionpack (>= 5.2)
785
796
  activesupport (>= 5.2)
@@ -788,7 +799,7 @@ GEM
788
799
  rspec-expectations (~> 3.10)
789
800
  rspec-mocks (~> 3.10)
790
801
  rspec-support (~> 3.10)
791
- rspec-support (3.13.1)
802
+ rspec-support (3.12.1)
792
803
  rubocop (1.28.2)
793
804
  parallel (~> 1.10)
794
805
  parser (>= 3.1.0.0)
@@ -798,8 +809,8 @@ GEM
798
809
  rubocop-ast (>= 1.17.0, < 2.0)
799
810
  ruby-progressbar (~> 1.7)
800
811
  unicode-display_width (>= 1.4.0, < 3.0)
801
- rubocop-ast (1.31.3)
802
- parser (>= 3.3.1.0)
812
+ rubocop-ast (1.30.0)
813
+ parser (>= 3.2.1.0)
803
814
  rubocop-performance (1.19.1)
804
815
  rubocop (>= 1.7.0, < 2.0)
805
816
  rubocop-ast (>= 0.4.0)
@@ -816,9 +827,6 @@ GEM
816
827
  oauth2
817
828
  ruby-progressbar (1.13.0)
818
829
  ruby2_keywords (0.0.5)
819
- ruby_parser (3.21.0)
820
- racc (~> 1.5)
821
- sexp_processor (~> 4.16)
822
830
  rubyzip (2.3.2)
823
831
  samvera-nesting_indexer (2.0.0)
824
832
  dry-equalizer
@@ -837,7 +845,6 @@ GEM
837
845
  ffi (~> 1.9)
838
846
  scanf (1.0.0)
839
847
  select2-rails (3.5.11)
840
- sexp_processor (4.17.1)
841
848
  shacl (0.1.1)
842
849
  json-ld (~> 3.1, >= 3.1.7)
843
850
  rdf (~> 3.1, >= 3.1.8)
@@ -903,8 +910,7 @@ GEM
903
910
  sparql-client (3.2.2)
904
911
  net-http-persistent (~> 4.0, >= 4.0.2)
905
912
  rdf (~> 3.2, >= 3.2.11)
906
- sprockets (3.7.3)
907
- base64
913
+ sprockets (3.7.2)
908
914
  concurrent-ruby (~> 1.0)
909
915
  rack (> 1, < 3)
910
916
  sprockets-es6 (0.9.2)
@@ -923,17 +929,15 @@ GEM
923
929
  rdf (~> 3.2)
924
930
  sync (0.5.0)
925
931
  temple (0.10.3)
926
- term-ansicolor (1.10.2)
927
- mize
932
+ term-ansicolor (1.7.1)
928
933
  tins (~> 1.0)
929
- terminal-table (3.0.2)
930
- unicode-display_width (>= 1.1.1, < 3)
931
- thor (1.3.1)
934
+ terminal-table (4.0.0)
935
+ unicode-display_width (>= 1.1.1, < 4)
936
+ thor (1.3.0)
932
937
  thread_safe (0.3.6)
933
- tilt (2.4.0)
938
+ tilt (2.3.0)
934
939
  timeout (0.4.1)
935
- tins (1.33.0)
936
- bigdecimal
940
+ tins (1.32.1)
937
941
  sync
938
942
  tinymce-rails (5.10.9)
939
943
  railties (>= 3.1.1)
@@ -952,7 +956,7 @@ GEM
952
956
  uglifier (4.2.0)
953
957
  execjs (>= 0.3.0, < 3)
954
958
  unicode-display_width (2.5.0)
955
- unicode-types (1.9.0)
959
+ unicode-types (1.10.0)
956
960
  valkyrie (2.2.0)
957
961
  activemodel
958
962
  activesupport
@@ -969,6 +973,8 @@ GEM
969
973
  reform (~> 2.2)
970
974
  reform-rails
971
975
  version_gem (1.1.4)
976
+ warden (1.2.9)
977
+ rack (>= 2.0.9)
972
978
  web-console (3.7.0)
973
979
  actionview (>= 5.0)
974
980
  activemodel (>= 5.0)
@@ -978,35 +984,42 @@ GEM
978
984
  websocket-extensions (>= 0.1.0)
979
985
  websocket-extensions (0.1.5)
980
986
  yard (0.9.34)
981
- zeitwerk (2.6.16)
987
+ zeitwerk (2.6.18)
982
988
 
983
989
  PLATFORMS
984
990
  ruby
985
991
 
986
992
  DEPENDENCIES
987
993
  bixby
994
+ bootstrap-sass (~> 3.0)
988
995
  byebug
989
996
  coffee-rails (~> 4.2)
990
997
  coveralls
991
998
  database_cleaner (~> 1.3)
999
+ devise
1000
+ devise-guests (~> 0.6)
992
1001
  engine_cart (~> 2.2)
993
1002
  factory_bot (~> 4.4)
994
- fcrepo_wrapper (~> 0.5, >= 0.5.1)
1003
+ fcrepo_wrapper
995
1004
  iiif_print!
996
1005
  jbuilder (~> 2.5)
1006
+ jquery-rails
997
1007
  json-canonicalization (= 0.3.1)
998
1008
  newspaper_works_fixtures (~> 0.3, >= 0.3.1)
999
1009
  puma (~> 3.11)
1000
1010
  rails (~> 5.2.8, >= 5.2.8.1)
1001
1011
  rails-controller-testing (~> 1)
1012
+ redis (= 4.8.1)
1013
+ rsolr (>= 1.0, < 3)
1002
1014
  rspec-activemodel-mocks
1003
1015
  rspec-rails
1004
1016
  sass-rails (~> 5.0)
1005
1017
  shoulda-matchers (~> 3.1)
1006
1018
  solargraph
1007
- solr_wrapper (>= 1.1, < 3.0)
1019
+ solr_wrapper (>= 0.3)
1008
1020
  sqlite3
1009
1021
  turbolinks (~> 5)
1022
+ twitter-typeahead-rails (= 0.11.1.pre.corejavascript)
1010
1023
  tzinfo-data
1011
1024
  uglifier (>= 1.3.0)
1012
1025
  web-console (>= 3.3.0)
data/README.md CHANGED
@@ -39,10 +39,10 @@ IiifPrint supports:
39
39
  * excluding specified work types to be found in the catalog search
40
40
  * external IIIF image urls that work with services such as serverless-iiif or cantaloup
41
41
 
42
- A complete list of features can be found [here](https://github.com/scientist-softserv/iiif_print/wiki/Features-List).
42
+ A complete list of features can be found [here](https://github.com/notch8/iiif_print/wiki/Features-List).
43
43
 
44
44
  ## Documentation
45
- A set of helpful documents to help you learn more and deploy IiifPrint can be found on the [Project Wiki](https://github.com/scientist-softserv/iiif_print/wiki).
45
+ A set of helpful documents to help you learn more and deploy IiifPrint can be found on the [Project Wiki](https://github.com/notch8/iiif_print/wiki).
46
46
 
47
47
  IiifPrint was developed against [Hyku](https://github.com/samvera/hyku) v4.0-v5.0. If your application uses [Bulkrax](https://github.com/samvera-labs/bulkrax), please ensure that its version is 5.0.1 or greater.
48
48
 
@@ -232,7 +232,7 @@ end
232
232
 
233
233
  #### Pre-Process Location
234
234
 
235
- The [DerivativeRodeo](https://github.com/scientist-softserv/derivative_rodeo) allows for specifying a location where you've done pre-processing (e.g. you ran splitting and derivative generation in AWS's Lambda).
235
+ The [DerivativeRodeo](https://github.com/notch8/derivative_rodeo) allows for specifying a location where you've done pre-processing (e.g. you ran splitting and derivative generation in AWS's Lambda).
236
236
 
237
237
  By default the preprocess location is S3, as that is where SoftServ has been running pre-processing. However that default may not be adequate for local development.
238
238
 
@@ -4,9 +4,10 @@ module IiifPrint
4
4
  before_action :authenticate_user!
5
5
 
6
6
  def create
7
- @file_set = FileSet.where(id: params[:file_set_id]).first
7
+ @file_set = IiifPrint.find_by(id: params[:file_set_id])
8
8
  authorize_create_split_request!(@file_set)
9
- IiifPrint::Jobs::RequestSplitPdfJob.perform_later(file_set: @file_set, user: current_user)
9
+
10
+ IiifPrint::Jobs::RequestSplitPdfJob.perform_later(file_set_id: @file_set.to_param, user: current_user)
10
11
  respond_to do |wants|
11
12
  wants.html { redirect_to polymorphic_path([main_app, @file_set]), notice: t("iiif_print.file_set.split_submitted", id: @file_set.id) }
12
13
  wants.json { render json: { id: @file_set.id, to_param: @file_set.to_param }, status: :ok }
@@ -27,7 +28,7 @@ module IiifPrint
27
28
  # Rely on CanCan's authorize! method. We could add the :split_pdf action to the ability
28
29
  # class. But we're pigging backing on the idea that you can do this if you can edit the work.
29
30
  authorize!(:edit, file_set)
30
- raise "Expected #{file_set.class} ID=#{file_set.id} #to_param=#{file_set.to_param} to be a PDF. Instead found mime_type of #{file_set.mime_type}." unless file_set.pdf?
31
+ raise "Expected #{file_set.class} ID=#{file_set.id} #to_param=#{file_set.to_param} to be a PDF. Instead found mime_type of #{file_set.mime_type}." unless IiifPrint.pdf?(file_set)
31
32
 
32
33
  work = IiifPrint.parent_for(file_set)
33
34
  raise WorkNotConfiguredToSplitFileSetError.new(file_set: file_set, work: work) unless work&.iiif_print_config&.pdf_splitter_job&.presence
@@ -26,8 +26,11 @@ module IiifPrint
26
26
  search_params = current_search_session.try(:query_params) || {}
27
27
  q = search_params['q'].presence || ''
28
28
 
29
+ return unless search_params[:highlight] || params[:highlight]
30
+
29
31
  "&q=#{url_encode(q)}" if q.present?
30
32
  end
31
33
  end
32
34
  end
35
+
33
36
  Hyrax::IiifHelper.prepend(IiifPrint::IiifHelperDecorator)
@@ -21,7 +21,7 @@ module IiifPrint
21
21
  solr_doc['is_child_bsi'] ||= object.try(:is_child)
22
22
  solr_doc['split_from_pdf_id_ssi'] ||= object.try(:split_from_pdf_id)
23
23
  solr_doc['is_page_of_ssim'] = iiif_print_lineage_service.ancestor_ids_for(object)
24
- solr_doc['member_ids_ssim'] = iiif_print_lineage_service.descendent_member_ids_for(object)
24
+ solr_doc['descendent_member_ids_ssim'] = iiif_print_lineage_service.descendent_member_ids_for(object)
25
25
  end
26
26
  end
27
27
  end
@@ -33,7 +33,8 @@ module IiifPrint
33
33
  # However, there seem to be cases where we still don't have the file when we get here, so to be sure, we
34
34
  # re-do the same command that was previously used to prepare the file path. If the file is already here, it
35
35
  # simply returns the path, but if not it will copy the file there, giving us one more chance to have what we need.
36
- pdf_paths = [Hyrax::WorkingDirectory.find_or_retrieve(pdf_file_set.original_file.id, pdf_file_set.id, pdf_paths.first)] if pdf_file_set
36
+ redownload = pdf_file_set&.is_a?(ActiveFedora::Base)
37
+ pdf_paths = [Hyrax::WorkingDirectory.find_or_retrieve(pdf_file_set.original_file.id, pdf_file_set.id, pdf_paths.first)] if redownload
37
38
  # handle each input pdf (when input is a file set, we will only have one).
38
39
  pdf_paths.each do |original_pdf_path|
39
40
  split_pdf(original_pdf_path, user, child_model, pdf_file_set)
@@ -4,12 +4,12 @@ module IiifPrint
4
4
  # Encapsulates logic for cleanup when the PDF is destroyed after pdf splitting into child works
5
5
  class RequestSplitPdfJob < IiifPrint::Jobs::ApplicationJob
6
6
  ##
7
- # @param file_set [FileSet]
7
+ # @param file_set_id [FileSet id]
8
8
  # @param user [User]
9
9
  # rubocop:disable Metrics/MethodLength
10
- def perform(file_set:, user:)
11
- return true unless file_set.pdf?
12
-
10
+ def perform(file_set_id:, user:)
11
+ file_set = IiifPrint.find_by(id: file_set_id)
12
+ return true unless IiifPrint.pdf?(file_set)
13
13
  work = IiifPrint.parent_for(file_set)
14
14
 
15
15
  # Woe is ye who changes the configuration of the model, thus removing the splitting.
@@ -18,11 +18,11 @@ module IiifPrint
18
18
  # clean up any existing spawned child works of this file_set
19
19
  IiifPrint::SplitPdfs::DestroyPdfChildWorksService.conditionally_destroy_spawned_children_of(
20
20
  file_set: file_set,
21
- work: work
21
+ work: work,
22
+ user: user
22
23
  )
23
24
 
24
- location = Hyrax::WorkingDirectory.find_or_retrieve(file_set.files.first.id, file_set.id)
25
-
25
+ location = IiifPrint.pdf_path_for(file_set: file_set)
26
26
  IiifPrint.conditionally_submit_split_for(work: work, file_set: file_set, locations: [location], user: user)
27
27
  end
28
28
  # rubocop:enable Metrics/MethodLength
@@ -15,17 +15,22 @@ module IiifPrint
15
15
  iiif_print_solr_field_names.include?(method_name.to_s) || super
16
16
  end
17
17
 
18
- # @see https://github.com/samvera/hyrax/commit/7108409c619cd2ba4ae8c836b9f3b429a7e9837b
18
+ # consists of member_ids_ssim + its descendents' member_ids (recursively)
19
19
  def file_set_ids
20
- # Yes, this looks a little odd. But the truth is the prior key (e.g. `file_set_ids_ssim`) was
21
- # an alias of `member_ids_ssim`.
22
- self['member_ids_ssim']
20
+ self['descendent_member_ids_ssim'] || self['member_ids_ssim']
23
21
  end
24
22
 
25
23
  def any_highlighting?
26
24
  response&.[]('highlighting')&.[](id)&.present?
27
25
  end
28
26
 
27
+ def any_highlighting_in_all_text_fields?
28
+ [CatalogController.blacklight_config.iiif_search[:full_text_field]].any? do |field|
29
+ highlights = response&.dig('highlighting', id, field)
30
+ highlights&.any? { |text| text.include?("<span class='highlight'>") }
31
+ end
32
+ end
33
+
29
34
  def solr_document
30
35
  self
31
36
  end
@@ -26,7 +26,7 @@ module IiifPrint
26
26
  return { q: 'nil:nil' } unless q
27
27
 
28
28
  {
29
- q: "#{q} AND (#{iiif_config[:object_relation_field]}:\"#{parent_document.id}\" OR id:\"#{parent_document.id}\")",
29
+ q: "#{q} AND has_model_ssim:FileSet AND (#{iiif_config[:object_relation_field]}:\"#{parent_document.id}\" OR id:\"#{parent_document.id}\")",
30
30
  rows: rows,
31
31
  page: page
32
32
  }
@@ -1,7 +1,7 @@
1
1
  module IiifPrint
2
2
  module IiifSearchResponseDecorator
3
3
  # Enable the user to search for child metadata in the parent's UV
4
- # @see https://github.com/scientist-softserv/louisville-hyku/commit/67467e5cf9fdb755f54419f17d3c24c87032d0af
4
+ # @see https://github.com/notch8/louisville-hyku/commit/67467e5cf9fdb755f54419f17d3c24c87032d0af
5
5
  def annotation_list
6
6
  json_results = super
7
7
 
@@ -14,7 +14,7 @@ module IiifPrint
14
14
  presenter_class.for(solr_doc)
15
15
  elsif Hyrax.config.curation_concerns.include?(solr_doc.hydra_model)
16
16
  # look up file set ids and loop through those
17
- file_set_docs = load_file_set_docs(solr_doc.try(:member_ids) || solr_doc.try(:[], 'member_ids_ssim'))
17
+ file_set_docs = load_file_set_docs(load_file_set_ids(solr_doc))
18
18
  file_set_docs.map { |doc| presenter_class.for(doc) } if file_set_docs.length
19
19
  end
20
20
  end.flatten.compact
@@ -22,6 +22,13 @@ module IiifPrint
22
22
 
23
23
  private
24
24
 
25
+ def load_file_set_ids(solr_doc)
26
+ solr_doc.try(:descendent_member_ids_ssim) ||
27
+ solr_doc.try(:[], 'descendent_member_ids_ssim') ||
28
+ solr_doc.try(:member_ids_ssim) ||
29
+ solr_doc.try(:[], 'member_ids_ssim')
30
+ end
31
+
25
32
  # still create the manifest if the parent work has images attached but the child works do not
26
33
  def load_file_set_docs(file_set_ids)
27
34
  return [] if file_set_ids.nil?
@@ -24,13 +24,20 @@ module IiifPrint
24
24
  #
25
25
  # @todo Review if this is necessary for Hyrax 5.
26
26
  def members_include_viewable_image?
27
- all_member_ids = solr_document.try(:member_ids) || solr_document.try(:[], 'member_ids_ssim')
27
+ all_member_ids = load_file_set_ids(solr_document)
28
28
  Array.wrap(all_member_ids).each do |id|
29
29
  return true if file_type_and_permissions_valid?(member_presenters_for([id]).first)
30
30
  end
31
31
  false
32
32
  end
33
33
 
34
+ def load_file_set_ids(solr_doc)
35
+ solr_doc.try(:descendent_member_ids_ssim) ||
36
+ solr_doc.try(:[], 'descendent_member_ids_ssim') ||
37
+ solr_doc.try(:member_ids_ssim) ||
38
+ solr_doc.try(:[], 'member_ids_ssim')
39
+ end
40
+
34
41
  # This method allows for overriding to add additional file types to mix in with IiifAv
35
42
  # TODO: add configuration setting for file types to loop through so an override is unneeded.
36
43
  def file_type_and_permissions_valid?(presenter)
@@ -79,7 +79,7 @@ module IiifPrint
79
79
  # uses the 'id' property for v3 manifest and `@id' for v2, which is a URL that contains the FileSet id
80
80
  file_set_id = (canvas['id'] || canvas['@id']).split('/').last
81
81
  # finds the image that the FileSet is attached to and creates metadata on that canvas
82
- image = solr_doc_hits.find { |hit| hit[:member_ids_ssim]&.include?(file_set_id) }
82
+ image = solr_doc_hits.find { |hit| (hit[:descendent_member_ids_ssim] || hit[:member_ids_ssim])&.include?(file_set_id) }
83
83
  return unless image
84
84
  # prevents duplicating the child and parent metadata
85
85
  return if image.id == presenter.id
@@ -124,7 +124,7 @@ module IiifPrint
124
124
  end
125
125
 
126
126
  def member_ids_for(presenter)
127
- member_ids = presenter.try(:ordered_ids) || presenter.try(:member_ids)
127
+ member_ids = presenter.object.solr_document['descendent_member_ids_ssim'] || presenter.try(:ordered_ids) || presenter.try(:member_ids)
128
128
  member_ids.nil? ? [] : member_ids
129
129
  end
130
130
 
@@ -9,4 +9,4 @@ module IiifPrint
9
9
  end
10
10
  end
11
11
  end
12
- Hyrax::SimpleSchemaLoader.prepend(IiifPrint::SimpleSchemaLoaderDecorator)
12
+ Hyrax::SimpleSchemaLoader.prepend(IiifPrint::SimpleSchemaLoaderDecorator) unless Hyrax.config.respond_to?(:simple_schema_loader_config_search_paths)
@@ -3,9 +3,9 @@
3
3
  <div class="search-results-title-row">
4
4
  <h3 class="search-result-title">
5
5
  <% if params['q'].present? && document.any_highlighting? %>
6
- <%= link_to document.title_or_label, [document, { parent_query: params['q'] }] %></h3>
6
+ <%= link_to document.title_or_label, [document, { parent_query: params['q'], highlight: 'true' }] %></h3>
7
7
  <% elsif params['q'].present? %>
8
- <%= link_to document.title_or_label, [document, { query: params['q'] }] %></h3>
8
+ <%= link_to document.title_or_label, [document, { query: params['q'] }] %>
9
9
  <% else %>
10
10
  <%= link_to document.title_or_label, document %></h3>
11
11
  <% end %>
data/docker-compose.yml CHANGED
@@ -6,7 +6,7 @@ x-app: &app
6
6
  target: hyku-base
7
7
  args:
8
8
  - EXTRA_APK_PACKAGES=less vim bash openjdk11-jre ffmpeg rsync exiftool
9
- # image: ghcr.io/scientist-softserv/palni-palci:${TAG:-latest}
9
+ # image: ghcr.io/notch8/palni-palci:${TAG:-latest}
10
10
  env_file:
11
11
  - .env
12
12
  # NOTE: all common env variables moved to .env
data/iiif_print.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.email = ['sean.upton@utah.edu', 'jacob.reed@utah.edu',
13
13
  'brian.mcbride@utah.edu', 'eenglish@bpl.org', 'kirk.wang@scientist.com',
14
14
  'larita@scientist.com', 'jeremy.n.friesen@gmail.com']
15
- spec.homepage = 'https://github.com/scientist-softserv/iiif_print/'
15
+ spec.homepage = 'https://github.com/notch8/iiif_print/'
16
16
  spec.description = 'Gem/Engine for IIIF Print works in Hyrax-based Samvera Application.'
17
17
  spec.summary = <<-SUMMARY
18
18
  IiifPrint is a gem (Rails "engine") for Hyrax-based digital repository applications to support displaying parent/child works in the same viewer (Universal Viewer) and the ability to search OCR from the parent work to the child work(s). IiifPring was originally based off of the samvera-labs Newspaper gem.
@@ -2,7 +2,7 @@
2
2
  module IiifPrint
3
3
  module BlacklightIiifSearch
4
4
  module AnnotationDecorator
5
- INVALID_MATCH_TEXT = "#xywh=INVALID,INVALID,INVALID,INVALID".freeze
5
+ INVALID_MATCH_TEXT = "#xywh=0,0,0,0".freeze
6
6
  ##
7
7
  # Create a URL for the annotation
8
8
  # use a Hyrax-y URL syntax:
@@ -4,6 +4,12 @@ module IiifPrint
4
4
  attr_writer :after_create_fileset_handler
5
5
 
6
6
  attr_writer :ingest_queue_name
7
+
8
+ # Example settings in the initializer:
9
+ # config.memory_limit = "512MiB" # Limit for memory usage
10
+ # config.map_limit = "1GiB" # Limit for map usage
11
+ # config.disk_limit = "20KP" # Limit for disk usage
12
+ attr_accessor :memory_limit, :map_limit, :disk_limit
7
13
  ##
8
14
  # @return [Symbol, Proc]
9
15
  def ingest_queue_name
@@ -65,6 +65,8 @@ module IiifPrint
65
65
  config.callback.set(:after_create_fileset) do |file_set, user|
66
66
  IiifPrint.config.handle_after_create_fileset(file_set, user)
67
67
  end
68
+
69
+ config.simple_schema_loader_config_search_paths += [IiifPrint::Engine.root] if config.respond_to?(:simple_schema_loader_config_search_paths)
68
70
  end
69
71
  end
70
72
  # rubocop:enable Metrics/BlockLength
@@ -41,7 +41,7 @@ module IiifPrint
41
41
  monochrome &&= destination.slice(-4, 4).index('tif')
42
42
  mono_opts = "-depth 1 -monochrome -compress Group4 -type bilevel "
43
43
  opts = monochrome ? mono_opts : ''
44
- cmd = "convert #{source} #{opts}#{destination}"
44
+ cmd = "convert #{source} #{opts}#{destination} && sync"
45
45
  `#{cmd}`
46
46
  end
47
47
 
@@ -74,8 +74,22 @@ module IiifPrint
74
74
 
75
75
  # @return [Array<String>] lines of output from imagemagick `identify`
76
76
  def im_identify
77
- cmd = "identify -format 'Geometry: %G\nDepth: %[bit-depth]\nColorspace: %[colorspace]\nAlpha: %A\nMIME type: %m\n' #{path}"
78
- `#{cmd}`.lines
77
+ memory_limit = IiifPrint.config.memory_limit
78
+ map_limit = IiifPrint.config.map_limit
79
+ disk_limit = IiifPrint.config.disk_limit
80
+
81
+ cmd = "identify"
82
+
83
+ cmd += " -limit memory #{memory_limit}" if memory_limit.present?
84
+ cmd += " -limit map #{map_limit}" if map_limit.present?
85
+ cmd += " -limit disk #{disk_limit}" if disk_limit.present?
86
+
87
+ cmd += " -format 'Geometry: %G\nDepth: %[bit-depth]\nColorspace: %[colorspace]\nAlpha: %A\nMIME type: %m\n' #{path}"
88
+
89
+ output, status = Open3.capture2(cmd)
90
+ Rails.logger.info "Identify command output: #{output}"
91
+ Rails.logger.info "Identify command status: #{status}"
92
+ output.lines
79
93
  end
80
94
 
81
95
  def im_mime(lines)
@@ -47,26 +47,17 @@ module IiifPrint
47
47
  ##
48
48
  # @param object [#ordered_works, #file_sets, #member_ids]
49
49
  # @return [Array<String>] the ids of associated file sets and child works
50
- #
51
- # @see
52
- # https://github.com/samvera/hyrax/blob/2b807fe101176d594129ef8a8fe466d3d03a372b/app/indexers/hyrax/work_indexer.rb#L15-L18
53
- # for "clarification" of the comingling of file_set_ids and member_ids
54
50
  def self.descendent_member_ids_for(object)
55
51
  return unless object.respond_to?(:member_ids)
56
-
57
52
  # enables us to return parents when searching for child OCR
58
- #
59
- # https://github.com/samvera/hydra-works/blob/c9b9dd0cf11de671920ba0a7161db68ccf9b7f6d/lib/hydra/works/models/concerns/work_behavior.rb#L90-L92
60
- #
61
- # The Hydara::Works implementation of file_set_ids is "members.select(&:file_set?).map(&:id)";
62
- # so no sense doing `object.file_set_ids + object.member_ids`
63
- file_set_ids = object.member_ids
53
+ child_ids = object.member_ids
54
+ # add in child works & their child works & filesets, recursively
64
55
  IiifPrint.object_ordered_works(object)&.each do |child|
65
- file_set_ids += Array.wrap(descendent_member_ids_for(child))
56
+ child_ids += Array.wrap(descendent_member_ids_for(child))
66
57
  end
67
58
  # We must convert these to strings as Valkyrie's identifiers will be cast to hashes when we
68
59
  # attempt to write the SolrDocument.
69
- file_set_ids.flatten.uniq.compact.map(&:to_s)
60
+ child_ids.flatten.compact.map(&:to_s).uniq
70
61
  end
71
62
  class << self
72
63
  alias descendent_file_set_ids_for descendent_member_ids_for
@@ -184,6 +184,15 @@ module IiifPrint
184
184
  def self.extract_text_for(file_set:)
185
185
  IiifPrint.config.all_text_generator_function.call(object: file_set) || ''
186
186
  end
187
+
188
+ ##
189
+ # Location of the file for resplitting
190
+ #
191
+ # @param [FileSet] an ActiveFedora fileset
192
+ # @return [String] location of the original file
193
+ def self.pdf_path_for(file_set:)
194
+ Hyrax::WorkingDirectory.find_or_retrieve(file_set.files.first.id, file_set.id)
195
+ end
187
196
  end
188
197
  end
189
198
  end
@@ -1,3 +1,5 @@
1
+ # rubocop:disable Metrics/ClassLength
2
+
1
3
  module IiifPrint
2
4
  module PersistenceLayer
3
5
  class ValkyrieAdapter < AbstractAdapter
@@ -12,9 +14,7 @@ module IiifPrint
12
14
  # @param object [Valkyrie::Resource]
13
15
  # @return [Array<Valkyrie::Resource>]
14
16
  def self.object_ordered_works(object)
15
- child_file_sets = Hyrax.custom_queries.find_child_file_sets(resource: object).to_a
16
- child_works = Hyrax.custom_queries.find_child_works(resource: object).to_a
17
- child_works + child_file_sets
17
+ Hyrax.custom_queries.find_child_works(resource: object).to_a
18
18
  end
19
19
 
20
20
  ##
@@ -78,14 +78,28 @@ module IiifPrint
78
78
  Hyrax.config.index_field_mapper.solr_name(field_name.to_s)
79
79
  end
80
80
 
81
- # rubocop:disable Lint/UnusedMethodArgument
82
- def self.destroy_children_split_from(file_set:, work:, model:, user:)
83
- # rubocop:enable Lint/UnusedMethodArgument
84
- # look for child records by the file set id they were split from
85
- Hyrax.query_service.find_inverse_references_by(resource: file_set, property: :split_from_pdf_id, model: model).each do |child|
86
- Hyrax.persister.delete(resource: child)
87
- Hyrax.indexing_service.delete(resource: child)
88
- Hyrax.publisher.publish('object.deleted', object: child, user: user)
81
+ # NOTE: this isn't the most efficient method, but it is the most reliable.
82
+ # Attribute 'split_from_pdf_id' is saved in Valkyrie as a string rather than as { id: string },
83
+ # so we can't use the 'find_inverse_references_by' query.
84
+ # Additionally, the attribute does not exist on all child works, as it was added later, so using
85
+ # a child work's title allows us to find child works when the attribute isn't present.
86
+ # Building a custom query to find these child works directly via the attribute would be more efficient.
87
+ # However, it would require more effort for a lesser-used feature, and would not allow for the fallback
88
+ # of finding child works by title.
89
+ def self.destroy_children_split_from(file_set:, work:, _model:, user:)
90
+ all_child_works = Hyrax.custom_queries.find_child_works(resource: work)
91
+ return if all_child_works.blank?
92
+ # look first for children by the file set id they were split from
93
+ children = all_child_works.select { |m| m.split_from_pdf_id == file_set.id }
94
+ if children.blank?
95
+ # find works where file name and work `to_param` are both in the title
96
+ children = all_child_works.select { |m| m.title.include?(file_set.label) && m.title.include?(work.to_param) }
97
+ end
98
+ return if children.blank?
99
+ children.each do |rcd|
100
+ Hyrax.persister.delete(resource: rcd)
101
+ Hyrax.index_adapter.delete(resource: rcd)
102
+ Hyrax.publisher.publish('object.deleted', object: rcd, user: user)
89
103
  end
90
104
  true
91
105
  end
@@ -178,6 +192,18 @@ module IiifPrint
178
192
  return if text_fm.nil?
179
193
  text_fm.content
180
194
  end
195
+
196
+ ##
197
+ # Location of the file for resplitting
198
+ #
199
+ # @param [Hyrax::FileSet] a Valkyrie fileset
200
+ # @return [String] location of the original file
201
+ def self.pdf_path_for(file_set:)
202
+ file = file_set.original_file
203
+ return '' unless file.pdf?
204
+ file.file.disk_path.to_s
205
+ end
181
206
  end
182
207
  end
183
208
  end
209
+ # rubocop:enable Metrics/ClassLength
@@ -113,6 +113,10 @@ module IiifPrint
113
113
  def self.extract_text_for(file_set:)
114
114
  raise NotImplementedError, "#{self}.{__method__}"
115
115
  end
116
+
117
+ def self.pdf_path_for(file_set:)
118
+ raise NotImplementedError, "#{self}.{__method__}"
119
+ end
116
120
  end
117
121
  end
118
122
  end
@@ -21,7 +21,7 @@ module IiifPrint
21
21
  #
22
22
  # @return [Symbol] when we don't enqueue the job
23
23
  # @return [TrueClass] when we actually enqueue the job underlying job.
24
- # rubocop:disable Metrics/MethodLength
24
+ # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
25
25
  def self.conditionally_enqueue(file_set:, file:, user:, import_url: nil, work: nil)
26
26
  work ||= IiifPrint.parent_for(file_set)
27
27
 
@@ -36,10 +36,18 @@ module IiifPrint
36
36
  end
37
37
  return :no_pdfs_to_split if file_locations.empty?
38
38
 
39
- IiifPrint.conditionally_submit_split_for(work: work, file_set: file_set, locations: file_locations, user: user)
40
- :enqueued
39
+ file_set_id = file_set.id.try(:id) || file_set.id
40
+ work_admin_set_id = work.admin_set_id.try(:id) || work.admin_set_id
41
+ job = work.try(:iiif_print_config)&.pdf_splitter_job&.perform_later(
42
+ file_set_id,
43
+ file_locations,
44
+ user,
45
+ work_admin_set_id,
46
+ 0 # A no longer used parameter; but we need to preserve the method signature (for now)
47
+ )
48
+ job ? :enqueued : :pdf_job_failed_enqueue
41
49
  end
42
- # rubocop:enable Metrics/MethodLength
50
+ # rubocop:enable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
43
51
 
44
52
  ##
45
53
  # @api private
@@ -63,8 +71,8 @@ module IiifPrint
63
71
 
64
72
  if file.class < Valkyrie::Resource
65
73
  # assuming that if one PDF is uploaded to a Valkyrie resource then all of them should be
66
- paths = [Hyrax.storage_adapter.file_path(file.file_identifier)]
67
- pdfs_only_for(paths)
74
+ return [] unless file.pdf?
75
+ [file.file.disk_path.to_s]
68
76
  else
69
77
  upload_ids = filter_file_ids(file.id.to_s)
70
78
  return [] if upload_ids.empty?
@@ -76,7 +76,7 @@ module IiifPrint
76
76
  #
77
77
  # @return [String]
78
78
  #
79
- # @see https://github.com/scientist-softserv/space_stone-serverless/blob/7f46dd5b218381739cd1c771183f95408a4e0752/awslambda/handler.rb#L58-L63
79
+ # @see https://github.com/notch8/space_stone-serverless/blob/7f46dd5b218381739cd1c771183f95408a4e0752/awslambda/handler.rb#L58-L63
80
80
  # rubocop:disable Metrics/MethodLength
81
81
  # rubocop:disable Metrics/AbcSize
82
82
  def preprocessed_location_template
@@ -1,3 +1,3 @@
1
1
  module IiifPrint
2
- VERSION = '3.0.1'.freeze
2
+ VERSION = '3.0.2'.freeze
3
3
  end
data/lib/iiif_print.rb CHANGED
@@ -66,6 +66,7 @@ module IiifPrint
66
66
  :solr_construct_query,
67
67
  :solr_name,
68
68
  :solr_query,
69
+ :pdf_path_for,
69
70
  to: :persistence_adapter
70
71
  )
71
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iiif_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Upton
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2024-07-05 00:00:00.000000000 Z
17
+ date: 2025-01-30 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: blacklight_iiif_search
@@ -491,7 +491,7 @@ files:
491
491
  - tasks/copy_authorities_to_test_app.rake
492
492
  - tasks/iiif_print_dev.rake
493
493
  - tmp/.keep
494
- homepage: https://github.com/scientist-softserv/iiif_print/
494
+ homepage: https://github.com/notch8/iiif_print/
495
495
  licenses:
496
496
  - Apache-2.0
497
497
  metadata: {}
@@ -510,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
510
510
  - !ruby/object:Gem::Version
511
511
  version: '0'
512
512
  requirements: []
513
- rubygems_version: 3.1.6
513
+ rubygems_version: 3.3.20
514
514
  signing_key:
515
515
  specification_version: 4
516
516
  summary: IiifPrint is a gem (Rails "engine") for Hyrax-based digital repository applications