iiif_print 3.0.0 → 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 +153 -106
  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 +6 -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: aa3dd970a2698e24cea1ee94cbc62540f86a817b9cfcc9befa4d2c5b918adc29
4
- data.tar.gz: 860a39b300ec241df49da8cfd562b78e4b8e9d85556c732ffdb48b3bf63ff253
3
+ metadata.gz: 157690b7a7cc4421d63f7097e28136c642c5ca5b97a598124fca1304cedcda5f
4
+ data.tar.gz: 31bc61900538c311562a7274d2e419d9fa7370ef0d49bfb65d43a7861679306e
5
5
  SHA512:
6
- metadata.gz: '0940916e73b7d643c7db3d2f407c65efdda23d89b7710984fe2845d687b2899ea995faf945d5c8dc083755f53efca10bde06938927ae2c35e4652a981a963c0c'
7
- data.tar.gz: ef6ff81415505569c2e546428492c686e31fb5a6ac0b1b85a21f7a82d355f6e772d92a57d7fc057f6ddb54c85f97f429981a1320410cdc1cd193ff6892ba295d
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.0)
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,10 @@ 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)
119
+ bindex (0.8.1)
118
120
  bixby (5.0.2)
119
121
  rubocop (= 1.28.2)
120
122
  rubocop-ast
@@ -148,17 +150,18 @@ GEM
148
150
  autoprefixer-rails (>= 5.2.1)
149
151
  sassc (>= 2.0.0)
150
152
  breadcrumbs_on_rails (3.0.1)
151
- browse-everything (1.3.0)
153
+ browse-everything (1.5.0)
152
154
  addressable (~> 2.5)
153
155
  aws-sdk-s3
154
156
  dropbox_api (>= 0.1.20)
155
157
  google-apis-drive_v3
156
158
  googleauth (>= 0.6.6, < 2.0)
157
- rails (>= 4.2, < 7.2)
159
+ rails (>= 4.2, < 8.1)
158
160
  ruby-box
159
161
  signet (~> 0.8)
160
162
  typhoeus
161
- builder (3.3.0)
163
+ builder (3.2.4)
164
+ byebug (11.1.3)
162
165
  cancancan (1.17.0)
163
166
  carrierwave (1.3.4)
164
167
  activemodel (>= 4.0.0)
@@ -166,8 +169,15 @@ GEM
166
169
  mime-types (>= 1.16)
167
170
  ssrf_filter (~> 1.0, < 1.1.0)
168
171
  clipboard-rails (1.7.1)
169
- concurrent-ruby (1.3.3)
170
- connection_pool (2.4.1)
172
+ coffee-rails (4.2.2)
173
+ coffee-script (>= 2.2.0)
174
+ railties (>= 4.0.0)
175
+ coffee-script (2.4.1)
176
+ coffee-script-source
177
+ execjs
178
+ coffee-script-source (1.12.2)
179
+ concurrent-ruby (1.2.2)
180
+ connection_pool (2.5.0)
171
181
  coveralls (0.8.23)
172
182
  json (>= 1.8, < 3)
173
183
  simplecov (~> 0.16.1)
@@ -175,7 +185,7 @@ GEM
175
185
  thor (>= 0.19.4, < 2.0)
176
186
  tins (~> 1.6)
177
187
  crass (1.0.6)
178
- csv (3.3.0)
188
+ csv (3.3.2)
179
189
  database_cleaner (1.99.0)
180
190
  date (3.3.4)
181
191
  declarative (0.0.20)
@@ -193,7 +203,15 @@ GEM
193
203
  mime-types
194
204
  mini_magick
195
205
  nokogiri
196
- diff-lcs (1.5.1)
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
214
+ diff-lcs (1.5.0)
197
215
  disposable (0.4.7)
198
216
  declarative (>= 0.0.9, < 1.0.0)
199
217
  declarative-builder (< 0.2.0)
@@ -201,7 +219,7 @@ GEM
201
219
  representable (>= 2.4.0, <= 3.1.0)
202
220
  uber (< 0.2.0)
203
221
  docile (1.4.0)
204
- draper (4.0.2)
222
+ draper (4.0.4)
205
223
  actionpack (>= 5.0)
206
224
  activemodel (>= 5.0)
207
225
  activemodel-serializers-xml (>= 1.0)
@@ -274,11 +292,11 @@ GEM
274
292
  scanf (~> 1.0)
275
293
  sxp (~> 1.2)
276
294
  unicode-types (~> 1.8)
277
- engine_cart (2.6.0)
295
+ engine_cart (2.5.0)
278
296
  rails (>= 5.0)
279
297
  equivalent-xml (0.6.0)
280
298
  nokogiri (>= 1.4.3)
281
- erubi (1.13.0)
299
+ erubi (1.12.0)
282
300
  ethon (0.16.0)
283
301
  ffi (>= 1.15.0)
284
302
  execjs (2.9.1)
@@ -286,19 +304,19 @@ GEM
286
304
  activesupport (>= 3.0.0)
287
305
  faraday (0.17.6)
288
306
  multipart-post (>= 1.2, < 3)
289
- faraday-encoding (0.0.5)
307
+ faraday-encoding (0.0.6)
290
308
  faraday
291
309
  fcrepo_wrapper (0.9.0)
292
310
  ruby-progressbar
293
311
  ffi (1.17.0)
294
- flipflop (2.7.1)
312
+ flipflop (2.8.0)
295
313
  activesupport (>= 4.0)
296
314
  terminal-table (>= 1.8)
297
315
  flot-rails (0.0.7)
298
316
  jquery-rails
299
- font-awesome-rails (4.7.0.8)
300
- railties (>= 3.2, < 8.0)
301
- geocoder (1.8.3)
317
+ font-awesome-rails (4.7.0.9)
318
+ railties (>= 3.2, < 9.0)
319
+ geocoder (1.8.5)
302
320
  base64 (>= 0.1.0)
303
321
  csv (>= 3.0.0)
304
322
  globalid (1.1.0)
@@ -365,13 +383,13 @@ GEM
365
383
  hydra-access-controls (= 11.0.7)
366
384
  hydra-core (= 11.0.7)
367
385
  rails (>= 5.2, < 6.1)
368
- hydra-pcdm (1.3.0)
369
- active-fedora (>= 10, < 15)
386
+ hydra-pcdm (1.4.0)
387
+ active-fedora (>= 10)
370
388
  mime-types (>= 1)
371
389
  rdf-vocab
372
- hydra-works (2.1.0)
373
- activesupport (>= 5.2, < 7.1)
374
- hydra-derivatives (~> 3.6)
390
+ hydra-works (2.2.0)
391
+ activesupport (>= 5.2, < 8.0)
392
+ hydra-derivatives (>= 3.6)
375
393
  hydra-file_characterization (~> 1.0)
376
394
  hydra-pcdm (>= 0.9)
377
395
  hyrax (3.6.0)
@@ -432,16 +450,16 @@ GEM
432
450
  signet
433
451
  tinymce-rails (~> 5.10)
434
452
  valkyrie (~> 2, >= 2.1.1)
435
- i18n (1.14.5)
453
+ i18n (1.14.1)
436
454
  concurrent-ruby (~> 1.0)
437
455
  ice_nine (0.11.2)
438
456
  iiif-presentation (1.1.0)
439
457
  activesupport (>= 3.2.18)
440
458
  faraday (>= 0.9)
441
459
  json
442
- iiif_manifest (1.5.0)
460
+ iiif_manifest (1.6.0)
443
461
  activesupport (>= 4)
444
- jaro_winkler (1.6.0)
462
+ jaro_winkler (1.5.6)
445
463
  jbuilder (2.12.0)
446
464
  actionview (>= 5.0.0)
447
465
  activesupport (>= 5.0.0)
@@ -457,7 +475,7 @@ GEM
457
475
  thor (>= 0.14, < 2.0)
458
476
  jquery-ui-rails (6.0.1)
459
477
  railties (>= 3.2.16)
460
- json (2.7.2)
478
+ json (2.6.3)
461
479
  json-canonicalization (0.3.1)
462
480
  json-ld (3.1.10)
463
481
  htmlentities (~> 4.3)
@@ -469,9 +487,10 @@ GEM
469
487
  json-ld-preloaded (3.1.6)
470
488
  json-ld (~> 3.1)
471
489
  rdf (~> 3.1)
472
- json-schema (4.3.0)
473
- addressable (>= 2.8)
474
- jwt (2.8.2)
490
+ json-schema (5.1.1)
491
+ addressable (~> 2.8)
492
+ bigdecimal (~> 3.1)
493
+ jwt (2.10.1)
475
494
  base64
476
495
  kaminari (1.2.2)
477
496
  activesupport (>= 4.1.0)
@@ -542,7 +561,7 @@ GEM
542
561
  shex (~> 0.6, >= 0.6.4)
543
562
  sparql (~> 3.1, >= 3.1.8)
544
563
  sparql-client (~> 3.1, >= 3.1.2)
545
- logger (1.6.0)
564
+ logger (1.6.5)
546
565
  loofah (2.22.0)
547
566
  crass (~> 1.0.2)
548
567
  nokogiri (>= 1.12.0)
@@ -554,42 +573,41 @@ GEM
554
573
  mailboxer (0.15.1)
555
574
  carrierwave (>= 0.5.8)
556
575
  rails (>= 5.0.0)
557
- marcel (1.0.4)
576
+ marcel (1.0.2)
558
577
  matrix (0.4.2)
559
- method_source (1.1.0)
560
- mime-types (3.5.2)
578
+ method_source (1.0.0)
579
+ mime-types (3.6.0)
580
+ logger
561
581
  mime-types-data (~> 3.2015)
562
- mime-types-data (3.2024.0702)
563
- mini_magick (4.13.1)
582
+ mime-types-data (3.2025.0107)
583
+ mini_magick (4.13.2)
564
584
  mini_mime (1.1.5)
565
- mini_portile2 (2.8.7)
566
- minitest (5.24.1)
567
- mize (0.4.1)
568
- protocol (~> 2.0)
585
+ mini_portile2 (2.8.5)
586
+ minitest (5.20.0)
569
587
  multi_json (1.15.0)
570
588
  multi_xml (0.6.0)
571
- multipart-post (2.4.1)
589
+ multipart-post (2.3.0)
572
590
  nest (3.2.0)
573
591
  redic
574
- net-http-persistent (4.0.2)
592
+ net-http-persistent (4.0.5)
575
593
  connection_pool (~> 2.2)
576
- net-imap (0.4.14)
594
+ net-imap (0.4.6)
577
595
  date
578
596
  net-protocol
579
597
  net-pop (0.1.2)
580
598
  net-protocol
581
599
  net-protocol (0.2.2)
582
600
  timeout
583
- net-smtp (0.5.0)
601
+ net-smtp (0.4.0)
584
602
  net-protocol
585
603
  newspaper_works_fixtures (0.3.1)
586
604
  rails (~> 5.0)
587
- nio4r (2.7.3)
605
+ nio4r (2.6.1)
588
606
  noid (0.9.0)
589
607
  noid-rails (3.0.3)
590
608
  actionpack (>= 5.0.0, < 7)
591
609
  noid (~> 0.9)
592
- nokogiri (1.15.6)
610
+ nokogiri (1.15.5)
593
611
  mini_portile2 (~> 2.8.2)
594
612
  racc (~> 1.4)
595
613
  oauth (1.1.0)
@@ -606,29 +624,29 @@ GEM
606
624
  rack (>= 1.2, < 4)
607
625
  openseadragon (0.6.0)
608
626
  rails (> 3.2.0)
627
+ orm_adapter (0.5.0)
609
628
  os (1.1.4)
610
- parallel (1.25.1)
611
- parser (3.3.3.0)
629
+ parallel (1.23.0)
630
+ parser (3.2.2.4)
612
631
  ast (~> 2.4.1)
613
632
  racc
614
633
  parslet (2.0.0)
615
634
  posix-spawn (0.3.15)
616
635
  power_converter (0.1.2)
617
- protocol (2.0.0)
618
- ruby_parser (~> 3.0)
619
636
  psych (3.3.4)
620
637
  public_suffix (5.1.1)
621
- qa (5.11.0)
638
+ puma (3.12.6)
639
+ qa (5.14.0)
622
640
  activerecord-import
623
641
  deprecation
624
642
  faraday (< 3.0, != 2.0.0)
625
643
  geocoder
626
644
  ldpath
627
645
  nokogiri (~> 1.6)
628
- rails (>= 5.0, < 7.2)
646
+ rails (>= 5.0, < 8.1)
629
647
  rdf
630
- racc (1.8.0)
631
- rack (2.2.9)
648
+ racc (1.7.3)
649
+ rack (2.2.8)
632
650
  rack-test (2.1.0)
633
651
  rack (>= 1.3)
634
652
  rails (5.2.8.1)
@@ -666,11 +684,11 @@ GEM
666
684
  rake (>= 0.8.7)
667
685
  thor (>= 0.19.0, < 2.0)
668
686
  rainbow (3.1.1)
669
- rake (13.2.1)
687
+ rake (13.1.0)
670
688
  rb-fsevent (0.11.2)
671
689
  rb-inotify (0.11.1)
672
690
  ffi (~> 1.0)
673
- rdf (3.2.11)
691
+ rdf (3.2.12)
674
692
  link_header (~> 0.0, >= 0.0.8)
675
693
  rdf-aggregate-repo (3.2.1)
676
694
  rdf (~> 3.2)
@@ -744,33 +762,35 @@ GEM
744
762
  reform-rails (0.2.6)
745
763
  activemodel (>= 5.0)
746
764
  reform (>= 2.3.1, < 3.0.0)
747
- regexp_parser (2.9.2)
765
+ regexp_parser (2.8.2)
748
766
  representable (3.0.4)
749
767
  declarative (< 0.1.0)
750
768
  declarative-option (< 0.2.0)
751
769
  uber (< 0.2.0)
752
770
  request_store (1.7.0)
753
771
  rack (>= 1.4)
772
+ responders (3.1.1)
773
+ actionpack (>= 5.2)
774
+ railties (>= 5.2)
754
775
  retriable (3.1.2)
755
776
  reverse_markdown (2.1.1)
756
777
  nokogiri
757
- rexml (3.3.1)
758
- strscan
778
+ rexml (3.2.6)
759
779
  rsolr (2.6.0)
760
780
  builder (>= 2.1.2)
761
781
  faraday (>= 0.9, < 3, != 2.0.0)
762
- rspec-activemodel-mocks (1.2.0)
782
+ rspec-activemodel-mocks (1.1.0)
763
783
  activemodel (>= 3.0)
764
784
  activesupport (>= 3.0)
765
785
  rspec-mocks (>= 2.99, < 4.0)
766
- rspec-core (3.13.0)
767
- rspec-support (~> 3.13.0)
768
- rspec-expectations (3.13.1)
786
+ rspec-core (3.12.2)
787
+ rspec-support (~> 3.12.0)
788
+ rspec-expectations (3.12.3)
769
789
  diff-lcs (>= 1.2.0, < 2.0)
770
- rspec-support (~> 3.13.0)
771
- rspec-mocks (3.13.1)
790
+ rspec-support (~> 3.12.0)
791
+ rspec-mocks (3.12.6)
772
792
  diff-lcs (>= 1.2.0, < 2.0)
773
- rspec-support (~> 3.13.0)
793
+ rspec-support (~> 3.12.0)
774
794
  rspec-rails (5.1.2)
775
795
  actionpack (>= 5.2)
776
796
  activesupport (>= 5.2)
@@ -779,7 +799,7 @@ GEM
779
799
  rspec-expectations (~> 3.10)
780
800
  rspec-mocks (~> 3.10)
781
801
  rspec-support (~> 3.10)
782
- rspec-support (3.13.1)
802
+ rspec-support (3.12.1)
783
803
  rubocop (1.28.2)
784
804
  parallel (~> 1.10)
785
805
  parser (>= 3.1.0.0)
@@ -789,8 +809,8 @@ GEM
789
809
  rubocop-ast (>= 1.17.0, < 2.0)
790
810
  ruby-progressbar (~> 1.7)
791
811
  unicode-display_width (>= 1.4.0, < 3.0)
792
- rubocop-ast (1.31.3)
793
- parser (>= 3.3.1.0)
812
+ rubocop-ast (1.30.0)
813
+ parser (>= 3.2.1.0)
794
814
  rubocop-performance (1.19.1)
795
815
  rubocop (>= 1.7.0, < 2.0)
796
816
  rubocop-ast (>= 0.4.0)
@@ -807,9 +827,6 @@ GEM
807
827
  oauth2
808
828
  ruby-progressbar (1.13.0)
809
829
  ruby2_keywords (0.0.5)
810
- ruby_parser (3.21.0)
811
- racc (~> 1.5)
812
- sexp_processor (~> 4.16)
813
830
  rubyzip (2.3.2)
814
831
  samvera-nesting_indexer (2.0.0)
815
832
  dry-equalizer
@@ -828,7 +845,6 @@ GEM
828
845
  ffi (~> 1.9)
829
846
  scanf (1.0.0)
830
847
  select2-rails (3.5.11)
831
- sexp_processor (4.17.1)
832
848
  shacl (0.1.1)
833
849
  json-ld (~> 3.1, >= 3.1.7)
834
850
  rdf (~> 3.1, >= 3.1.8)
@@ -894,8 +910,7 @@ GEM
894
910
  sparql-client (3.2.2)
895
911
  net-http-persistent (~> 4.0, >= 4.0.2)
896
912
  rdf (~> 3.2, >= 3.2.11)
897
- sprockets (3.7.3)
898
- base64
913
+ sprockets (3.7.2)
899
914
  concurrent-ruby (~> 1.0)
900
915
  rack (> 1, < 3)
901
916
  sprockets-es6 (0.9.2)
@@ -906,27 +921,29 @@ GEM
906
921
  actionpack (>= 5.2)
907
922
  activesupport (>= 5.2)
908
923
  sprockets (>= 3.0.0)
924
+ sqlite3 (1.7.3)
925
+ mini_portile2 (~> 2.8.0)
909
926
  ssrf_filter (1.0.8)
910
- strscan (3.1.0)
911
927
  sxp (1.2.4)
912
928
  matrix (~> 0.4)
913
929
  rdf (~> 3.2)
914
930
  sync (0.5.0)
915
931
  temple (0.10.3)
916
- term-ansicolor (1.10.2)
917
- mize
932
+ term-ansicolor (1.7.1)
918
933
  tins (~> 1.0)
919
- terminal-table (3.0.2)
920
- unicode-display_width (>= 1.1.1, < 3)
921
- thor (1.3.1)
934
+ terminal-table (4.0.0)
935
+ unicode-display_width (>= 1.1.1, < 4)
936
+ thor (1.3.0)
922
937
  thread_safe (0.3.6)
923
- tilt (2.4.0)
938
+ tilt (2.3.0)
924
939
  timeout (0.4.1)
925
- tins (1.33.0)
926
- bigdecimal
940
+ tins (1.32.1)
927
941
  sync
928
942
  tinymce-rails (5.10.9)
929
943
  railties (>= 3.1.1)
944
+ turbolinks (5.2.1)
945
+ turbolinks-source (~> 5.2)
946
+ turbolinks-source (5.2.0)
930
947
  twitter-typeahead-rails (0.11.1.pre.corejavascript)
931
948
  actionpack (>= 3.1)
932
949
  jquery-rails
@@ -936,8 +953,10 @@ GEM
936
953
  tzinfo (1.2.11)
937
954
  thread_safe (~> 0.1)
938
955
  uber (0.1.0)
956
+ uglifier (4.2.0)
957
+ execjs (>= 0.3.0, < 3)
939
958
  unicode-display_width (2.5.0)
940
- unicode-types (1.9.0)
959
+ unicode-types (1.10.0)
941
960
  valkyrie (2.2.0)
942
961
  activemodel
943
962
  activesupport
@@ -954,32 +973,60 @@ GEM
954
973
  reform (~> 2.2)
955
974
  reform-rails
956
975
  version_gem (1.1.4)
976
+ warden (1.2.9)
977
+ rack (>= 2.0.9)
978
+ web-console (3.7.0)
979
+ actionview (>= 5.0)
980
+ activemodel (>= 5.0)
981
+ bindex (>= 0.4.0)
982
+ railties (>= 5.0)
957
983
  websocket-driver (0.7.6)
958
984
  websocket-extensions (>= 0.1.0)
959
985
  websocket-extensions (0.1.5)
960
- yard (0.9.36)
961
- zeitwerk (2.6.16)
986
+ yard (0.9.34)
987
+ zeitwerk (2.6.18)
962
988
 
963
989
  PLATFORMS
964
990
  ruby
965
991
 
966
992
  DEPENDENCIES
967
993
  bixby
994
+ bootstrap-sass (~> 3.0)
995
+ byebug
996
+ coffee-rails (~> 4.2)
968
997
  coveralls
969
998
  database_cleaner (~> 1.3)
999
+ devise
1000
+ devise-guests (~> 0.6)
970
1001
  engine_cart (~> 2.2)
971
1002
  factory_bot (~> 4.4)
972
- fcrepo_wrapper (~> 0.5, >= 0.5.1)
1003
+ fcrepo_wrapper
973
1004
  iiif_print!
1005
+ jbuilder (~> 2.5)
1006
+ jquery-rails
974
1007
  json-canonicalization (= 0.3.1)
975
1008
  newspaper_works_fixtures (~> 0.3, >= 0.3.1)
1009
+ puma (~> 3.11)
1010
+ rails (~> 5.2.8, >= 5.2.8.1)
976
1011
  rails-controller-testing (~> 1)
1012
+ redis (= 4.8.1)
1013
+ rsolr (>= 1.0, < 3)
977
1014
  rspec-activemodel-mocks
978
1015
  rspec-rails
1016
+ sass-rails (~> 5.0)
979
1017
  shoulda-matchers (~> 3.1)
980
1018
  solargraph
981
- solr_wrapper (>= 1.1, < 3.0)
1019
+ solr_wrapper (>= 0.3)
1020
+ sqlite3
1021
+ turbolinks (~> 5)
1022
+ twitter-typeahead-rails (= 0.11.1.pre.corejavascript)
1023
+ tzinfo-data
1024
+ uglifier (>= 1.3.0)
1025
+ web-console (>= 3.3.0)
982
1026
  yard
983
1027
 
1028
+ RUBY VERSION
1029
+ ruby 2.7.6p219
1030
+
984
1031
  BUNDLED WITH
985
1032
  2.3.20
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
@@ -48,6 +48,10 @@ module IiifPrint
48
48
 
49
49
  Hyrax.publisher.subscribe(IiifPrint::Listener.new) if Hyrax.respond_to?(:publisher)
50
50
 
51
+ # Load locales early so decorators can use them during initialization
52
+ I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.yml'),
53
+ IiifPrint::Engine.root.join('config', 'locales', '**', '*.yml')]
54
+
51
55
  # Allows us to use decorator files
52
56
  Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")).sort.each do |c|
53
57
  Rails.configuration.cache_classes ? require(c) : load(c)
@@ -61,6 +65,8 @@ module IiifPrint
61
65
  config.callback.set(:after_create_fileset) do |file_set, user|
62
66
  IiifPrint.config.handle_after_create_fileset(file_set, user)
63
67
  end
68
+
69
+ config.simple_schema_loader_config_search_paths += [IiifPrint::Engine.root] if config.respond_to?(:simple_schema_loader_config_search_paths)
64
70
  end
65
71
  end
66
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.0'.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.0
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-04 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