hyrax 5.0.4 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.dassie/.env +4 -0
  3. data/.dassie/Gemfile +15 -11
  4. data/.dassie/app/controllers/application_controller.rb +4 -0
  5. data/.dassie/app/helpers/hyrax_helper.rb +4 -0
  6. data/.dassie/app/models/ability.rb +4 -0
  7. data/.dassie/app/models/user.rb +11 -0
  8. data/.dassie/app/views/shared/_footer.html.erb +17 -0
  9. data/.dassie/bin/rails +0 -5
  10. data/.dassie/bin/rake +0 -5
  11. data/.dassie/config/application.rb +2 -1
  12. data/.dassie/config/database.yml +18 -0
  13. data/.dassie/config/environments/development.rb +1 -1
  14. data/.dassie/config/environments/production.rb +5 -3
  15. data/.dassie/config/environments/test.rb +1 -1
  16. data/.dassie/config/fedora.yml +6 -6
  17. data/.dassie/config/initializers/profiler.rb +5 -0
  18. data/.dassie/config/initializers/riiif.rb +20 -18
  19. data/.dassie/config/locales/hyrax.en.yml +1 -1
  20. data/.dassie/config/puma.rb +55 -5
  21. data/.dassie/config/routes.rb +2 -0
  22. data/.dassie/db/migrate/20250328100249_user_roles.rb +20 -0
  23. data/.dassie/db/schema.rb +122 -110
  24. data/.github/workflows/lint-build-test.yml +35 -6
  25. data/.github/workflows/main.yml +4 -4
  26. data/.koppie/.env +1 -1
  27. data/.koppie/Gemfile +13 -10
  28. data/.koppie/app/controllers/application_controller.rb +4 -0
  29. data/.koppie/app/helpers/hyrax_helper.rb +4 -0
  30. data/.koppie/app/models/ability.rb +4 -0
  31. data/.koppie/app/models/user.rb +10 -0
  32. data/.koppie/app/views/shared/_footer.html.erb +17 -0
  33. data/.koppie/bin/rails +0 -5
  34. data/.koppie/bin/rake +0 -5
  35. data/.koppie/config/application.rb +2 -1
  36. data/.koppie/config/database.yml +2 -9
  37. data/.koppie/config/environments/development.rb +10 -1
  38. data/.koppie/config/environments/production.rb +5 -3
  39. data/.koppie/config/environments/test.rb +1 -1
  40. data/.koppie/config/initializers/1_valkyrie.rb +5 -5
  41. data/.koppie/config/initializers/hyrax.rb +20 -17
  42. data/.koppie/config/initializers/profiler.rb +5 -0
  43. data/.koppie/config/initializers/riiif.rb +21 -18
  44. data/.koppie/config/locales/hyrax.en.yml +2 -2
  45. data/.koppie/config/puma.rb +26 -7
  46. data/.koppie/config/routes.rb +2 -0
  47. data/.koppie/db/schema.rb +109 -110
  48. data/Dockerfile +110 -51
  49. data/app/actors/hyrax/actors/add_to_work_actor.rb +1 -1
  50. data/app/actors/hyrax/actors/apply_order_actor.rb +1 -1
  51. data/app/assets/stylesheets/hyrax/_tinymce.scss +6 -0
  52. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +1 -0
  53. data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +4 -4
  54. data/app/controllers/hyrax/api/zotero_controller.rb +1 -1
  55. data/app/controllers/hyrax/file_sets_controller.rb +11 -0
  56. data/app/jobs/batch_create_job.rb +2 -2
  57. data/app/models/admin_set.rb +2 -2
  58. data/app/models/concerns/hyrax/permissions/writable.rb +1 -2
  59. data/app/models/concerns/hyrax/valkyrie_lazy_migration.rb +1 -0
  60. data/app/models/hyrax/collection_type.rb +4 -4
  61. data/app/models/single_use_link.rb +1 -1
  62. data/app/services/hyrax/listeners.rb +1 -0
  63. data/app/services/hyrax/statistics/term_query.rb +1 -1
  64. data/app/services/hyrax/user_stat_importer.rb +1 -1
  65. data/app/services/hyrax/workflow.rb +8 -0
  66. data/app/validators/hyrax/has_one_title_validator.rb +1 -1
  67. data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +1 -1
  68. data/bin/db-migrate-seed.sh +1 -1
  69. data/bin/dev-entrypoint.sh +3 -0
  70. data/config/initializers/1_healthz.rb +2 -1
  71. data/config/initializers/ar_test_fixture_monkey_patch.rb +8 -0
  72. data/config/initializers/arel_rails_7_2_monkey_patch.rb +6 -0
  73. data/config/initializers/listeners.rb +4 -2
  74. data/config/initializers/new_framework_defaults_7_2.rb +8 -0
  75. data/docker-compose-dassie.yml +2 -2
  76. data/docker-compose-koppie.yml +2 -2
  77. data/docker-compose-sirenia.yml +3 -3
  78. data/documentation/developing-your-hyrax-based-app.md +6 -6
  79. data/hyrax.gemspec +9 -9
  80. data/lib/generators/hyrax/config_generator.rb +0 -5
  81. data/lib/generators/hyrax/install_generator.rb +1 -6
  82. data/lib/generators/hyrax/templates/.env +1 -1
  83. data/lib/generators/hyrax/templates/config/initializers/1_valkyrie.rb +21 -19
  84. data/lib/generators/hyrax/templates/config/initializers/riiif.rb +21 -19
  85. data/lib/generators/hyrax/templates/db/migrate/20170131142607_add_permission_template_to_sipity_workflow.rb.erb +1 -1
  86. data/lib/generators/hyrax/templates/db/migrate/20170810190549_update_collection_type_column_options.rb.erb +1 -1
  87. data/lib/generators/hyrax/templates/db/migrate/20230821153635_add_fields_to_counter_metric.rb.erb +1 -1
  88. data/lib/hyrax/configuration.rb +1 -0
  89. data/lib/hyrax/controlled_vocabulary/importer/language.rb +1 -1
  90. data/lib/hyrax/engine.rb +15 -10
  91. data/lib/hyrax/version.rb +1 -1
  92. data/lib/hyrax.rb +4 -0
  93. data/lib/tasks/workflow.rake +1 -2
  94. data/template.rb +6 -1
  95. metadata +49 -44
  96. data/.dassie/bin/spring +0 -17
  97. data/.dassie/config/initializers/mini_magick.rb +0 -6
  98. data/.dassie/config/spring.rb +0 -6
  99. data/.koppie/bin/spring +0 -17
  100. data/.koppie/config/initializers/mini_magick.rb +0 -6
  101. data/.koppie/config/spring.rb +0 -6
  102. data/config/initializers/reform_rails_6_1_monkey_patch.rb +0 -27
  103. data/lib/generators/hyrax/templates/config/initializers/mini_magick.rb +0 -6
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.4
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -11,10 +11,9 @@ authors:
11
11
  - Jeremy Friesen
12
12
  - Trey Pendragon
13
13
  - Esmé Cowles
14
- autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
- date: 2025-02-10 00:00:00.000000000 Z
16
+ date: 2025-04-23 00:00:00.000000000 Z
18
17
  dependencies:
19
18
  - !ruby/object:Gem::Dependency
20
19
  name: rails
@@ -22,28 +21,34 @@ dependencies:
22
21
  requirements:
23
22
  - - "~>"
24
23
  - !ruby/object:Gem::Version
25
- version: '6.1'
24
+ version: '7.2'
25
+ - - "<"
26
+ - !ruby/object:Gem::Version
27
+ version: '8.0'
26
28
  type: :runtime
27
29
  prerelease: false
28
30
  version_requirements: !ruby/object:Gem::Requirement
29
31
  requirements:
30
32
  - - "~>"
31
33
  - !ruby/object:Gem::Version
32
- version: '6.1'
34
+ version: '7.2'
35
+ - - "<"
36
+ - !ruby/object:Gem::Version
37
+ version: '8.0'
33
38
  - !ruby/object:Gem::Dependency
34
39
  name: active-fedora
35
40
  requirement: !ruby/object:Gem::Requirement
36
41
  requirements:
37
42
  - - "~>"
38
43
  - !ruby/object:Gem::Version
39
- version: '14.0'
44
+ version: '15.0'
40
45
  type: :runtime
41
46
  prerelease: false
42
47
  version_requirements: !ruby/object:Gem::Requirement
43
48
  requirements:
44
49
  - - "~>"
45
50
  - !ruby/object:Gem::Version
46
- version: '14.0'
51
+ version: '15.0'
47
52
  - !ruby/object:Gem::Dependency
48
53
  name: almond-rails
49
54
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +97,14 @@ dependencies:
92
97
  requirements:
93
98
  - - "~>"
94
99
  - !ruby/object:Gem::Version
95
- version: 4.7.0
100
+ version: 4.6.4
96
101
  type: :runtime
97
102
  prerelease: false
98
103
  version_requirements: !ruby/object:Gem::Requirement
99
104
  requirements:
100
105
  - - "~>"
101
106
  - !ruby/object:Gem::Version
102
- version: 4.7.0
107
+ version: 4.6.4
103
108
  - !ruby/object:Gem::Dependency
104
109
  name: breadcrumbs_on_rails
105
110
  requirement: !ruby/object:Gem::Requirement
@@ -342,28 +347,28 @@ dependencies:
342
347
  requirements:
343
348
  - - "~>"
344
349
  - !ruby/object:Gem::Version
345
- version: '3.3'
350
+ version: '4.0'
346
351
  type: :runtime
347
352
  prerelease: false
348
353
  version_requirements: !ruby/object:Gem::Requirement
349
354
  requirements:
350
355
  - - "~>"
351
356
  - !ruby/object:Gem::Version
352
- version: '3.3'
357
+ version: '4.0'
353
358
  - !ruby/object:Gem::Dependency
354
359
  name: hydra-editor
355
360
  requirement: !ruby/object:Gem::Requirement
356
361
  requirements:
357
362
  - - "~>"
358
363
  - !ruby/object:Gem::Version
359
- version: '6.0'
364
+ version: '7.0'
360
365
  type: :runtime
361
366
  prerelease: false
362
367
  version_requirements: !ruby/object:Gem::Requirement
363
368
  requirements:
364
369
  - - "~>"
365
370
  - !ruby/object:Gem::Version
366
- version: '6.0'
371
+ version: '7.0'
367
372
  - !ruby/object:Gem::Dependency
368
373
  name: hydra-file_characterization
369
374
  requirement: !ruby/object:Gem::Requirement
@@ -384,14 +389,14 @@ dependencies:
384
389
  requirements:
385
390
  - - "~>"
386
391
  - !ruby/object:Gem::Version
387
- version: '12.0'
392
+ version: '13.0'
388
393
  type: :runtime
389
394
  prerelease: false
390
395
  version_requirements: !ruby/object:Gem::Requirement
391
396
  requirements:
392
397
  - - "~>"
393
398
  - !ruby/object:Gem::Version
394
- version: '12.0'
399
+ version: '13.0'
395
400
  - !ruby/object:Gem::Dependency
396
401
  name: hydra-works
397
402
  requirement: !ruby/object:Gem::Requirement
@@ -468,6 +473,20 @@ dependencies:
468
473
  - - ">="
469
474
  - !ruby/object:Gem::Version
470
475
  version: '0'
476
+ - !ruby/object:Gem::Dependency
477
+ name: listen
478
+ requirement: !ruby/object:Gem::Requirement
479
+ requirements:
480
+ - - "~>"
481
+ - !ruby/object:Gem::Version
482
+ version: '3.9'
483
+ type: :runtime
484
+ prerelease: false
485
+ version_requirements: !ruby/object:Gem::Requirement
486
+ requirements:
487
+ - - "~>"
488
+ - !ruby/object:Gem::Version
489
+ version: '3.9'
471
490
  - !ruby/object:Gem::Dependency
472
491
  name: mailboxer
473
492
  requirement: !ruby/object:Gem::Requirement
@@ -552,20 +571,6 @@ dependencies:
552
571
  - - "~>"
553
572
  - !ruby/object:Gem::Version
554
573
  version: '0.9'
555
- - !ruby/object:Gem::Dependency
556
- name: posix-spawn
557
- requirement: !ruby/object:Gem::Requirement
558
- requirements:
559
- - - ">="
560
- - !ruby/object:Gem::Version
561
- version: '0'
562
- type: :runtime
563
- prerelease: false
564
- version_requirements: !ruby/object:Gem::Requirement
565
- requirements:
566
- - - ">="
567
- - !ruby/object:Gem::Version
568
- version: '0'
569
574
  - !ruby/object:Gem::Dependency
570
575
  name: qa
571
576
  requirement: !ruby/object:Gem::Requirement
@@ -854,14 +859,14 @@ dependencies:
854
859
  name: database_cleaner
855
860
  requirement: !ruby/object:Gem::Requirement
856
861
  requirements:
857
- - - "~>"
862
+ - - ">="
858
863
  - !ruby/object:Gem::Version
859
864
  version: '1.3'
860
865
  type: :development
861
866
  prerelease: false
862
867
  version_requirements: !ruby/object:Gem::Requirement
863
868
  requirements:
864
- - - "~>"
869
+ - - ">="
865
870
  - !ruby/object:Gem::Version
866
871
  version: '1.3'
867
872
  - !ruby/object:Gem::Dependency
@@ -968,14 +973,14 @@ dependencies:
968
973
  requirements:
969
974
  - - "~>"
970
975
  - !ruby/object:Gem::Version
971
- version: '6.0'
976
+ version: '7.0'
972
977
  type: :development
973
978
  prerelease: false
974
979
  version_requirements: !ruby/object:Gem::Requirement
975
980
  requirements:
976
981
  - - "~>"
977
982
  - !ruby/object:Gem::Version
978
- version: '6.0'
983
+ version: '7.0'
979
984
  - !ruby/object:Gem::Dependency
980
985
  name: rspec_junit_formatter
981
986
  requirement: !ruby/object:Gem::Requirement
@@ -1202,11 +1207,11 @@ files:
1202
1207
  - ".dassie/app/views/layouts/application.html.erb"
1203
1208
  - ".dassie/app/views/layouts/mailer.html.erb"
1204
1209
  - ".dassie/app/views/layouts/mailer.text.erb"
1210
+ - ".dassie/app/views/shared/_footer.html.erb"
1205
1211
  - ".dassie/bin/bundle"
1206
1212
  - ".dassie/bin/rails"
1207
1213
  - ".dassie/bin/rake"
1208
1214
  - ".dassie/bin/setup"
1209
- - ".dassie/bin/spring"
1210
1215
  - ".dassie/bin/update"
1211
1216
  - ".dassie/bin/yarn"
1212
1217
  - ".dassie/config.ru"
@@ -1221,6 +1226,7 @@ files:
1221
1226
  - ".dassie/config/browse_everything_providers.yml"
1222
1227
  - ".dassie/config/cable.yml"
1223
1228
  - ".dassie/config/credentials.yml.enc"
1229
+ - ".dassie/config/database.yml"
1224
1230
  - ".dassie/config/environment.rb"
1225
1231
  - ".dassie/config/environments/development.rb"
1226
1232
  - ".dassie/config/environments/production.rb"
@@ -1237,7 +1243,7 @@ files:
1237
1243
  - ".dassie/config/initializers/hyrax.rb"
1238
1244
  - ".dassie/config/initializers/mailboxer.rb"
1239
1245
  - ".dassie/config/initializers/mime_types.rb"
1240
- - ".dassie/config/initializers/mini_magick.rb"
1246
+ - ".dassie/config/initializers/profiler.rb"
1241
1247
  - ".dassie/config/initializers/publisher.rb"
1242
1248
  - ".dassie/config/initializers/redis_config.rb"
1243
1249
  - ".dassie/config/initializers/riiif.rb"
@@ -1277,7 +1283,6 @@ files:
1277
1283
  - ".dassie/config/role_map.yml"
1278
1284
  - ".dassie/config/routes.rb"
1279
1285
  - ".dassie/config/solr.yml"
1280
- - ".dassie/config/spring.rb"
1281
1286
  - ".dassie/config/storage.yml"
1282
1287
  - ".dassie/config/tinymce.yml"
1283
1288
  - ".dassie/config/uv/uv-config.json"
@@ -1365,6 +1370,7 @@ files:
1365
1370
  - ".dassie/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.hyrax.rb"
1366
1371
  - ".dassie/db/migrate/20230821153635_add_fields_to_counter_metric.rb"
1367
1372
  - ".dassie/db/migrate/20240506070809_valkyrie_id_to_string.rb"
1373
+ - ".dassie/db/migrate/20250328100249_user_roles.rb"
1368
1374
  - ".dassie/db/schema.rb"
1369
1375
  - ".dassie/db/seeds.rb"
1370
1376
  - ".dassie/lib/assets/.keep"
@@ -1478,11 +1484,11 @@ files:
1478
1484
  - ".koppie/app/views/layouts/application.html.erb"
1479
1485
  - ".koppie/app/views/layouts/mailer.html.erb"
1480
1486
  - ".koppie/app/views/layouts/mailer.text.erb"
1487
+ - ".koppie/app/views/shared/_footer.html.erb"
1481
1488
  - ".koppie/bin/bundle"
1482
1489
  - ".koppie/bin/rails"
1483
1490
  - ".koppie/bin/rake"
1484
1491
  - ".koppie/bin/setup"
1485
- - ".koppie/bin/spring"
1486
1492
  - ".koppie/bin/update"
1487
1493
  - ".koppie/bin/yarn"
1488
1494
  - ".koppie/config.ru"
@@ -1519,7 +1525,7 @@ files:
1519
1525
  - ".koppie/config/initializers/inflections.rb"
1520
1526
  - ".koppie/config/initializers/mailboxer.rb"
1521
1527
  - ".koppie/config/initializers/mime_types.rb"
1522
- - ".koppie/config/initializers/mini_magick.rb"
1528
+ - ".koppie/config/initializers/profiler.rb"
1523
1529
  - ".koppie/config/initializers/publisher.rb"
1524
1530
  - ".koppie/config/initializers/redis_config.rb"
1525
1531
  - ".koppie/config/initializers/riiif.rb"
@@ -1546,7 +1552,6 @@ files:
1546
1552
  - ".koppie/config/routes.rb"
1547
1553
  - ".koppie/config/sidekiq.yml"
1548
1554
  - ".koppie/config/solr.yml"
1549
- - ".koppie/config/spring.rb"
1550
1555
  - ".koppie/config/storage.yml"
1551
1556
  - ".koppie/config/tinymce.yml"
1552
1557
  - ".koppie/config/uv/uv-config.json"
@@ -2493,6 +2498,7 @@ files:
2493
2498
  - app/services/hyrax/work_resource_query_service.rb
2494
2499
  - app/services/hyrax/work_thumbnail_path_service.rb
2495
2500
  - app/services/hyrax/work_uploads_handler.rb
2501
+ - app/services/hyrax/workflow.rb
2496
2502
  - app/services/hyrax/workflow/abstract_notification.rb
2497
2503
  - app/services/hyrax/workflow/action_taken_service.rb
2498
2504
  - app/services/hyrax/workflow/actionable_objects.rb
@@ -2998,11 +3004,13 @@ files:
2998
3004
  - config/features.rb
2999
3005
  - config/i18n-tasks.yml
3000
3006
  - config/initializers/1_healthz.rb
3007
+ - config/initializers/ar_test_fixture_monkey_patch.rb
3008
+ - config/initializers/arel_rails_7_2_monkey_patch.rb
3001
3009
  - config/initializers/file_length_patch.rb
3002
3010
  - config/initializers/indexing_adapter_initializer.rb
3003
3011
  - config/initializers/kaminari_engine_patch.rb
3004
3012
  - config/initializers/listeners.rb
3005
- - config/initializers/reform_rails_6_1_monkey_patch.rb
3013
+ - config/initializers/new_framework_defaults_7_2.rb
3006
3014
  - config/initializers/simple_form.rb
3007
3015
  - config/initializers/storage_adapter_initializer.rb
3008
3016
  - config/initializers/valkyrie_id_equality.rb
@@ -3087,7 +3095,6 @@ files:
3087
3095
  - lib/generators/hyrax/templates/config/initializers/1_valkyrie.rb
3088
3096
  - lib/generators/hyrax/templates/config/initializers/file_services.rb
3089
3097
  - lib/generators/hyrax/templates/config/initializers/hyrax.rb
3090
- - lib/generators/hyrax/templates/config/initializers/mini_magick.rb
3091
3098
  - lib/generators/hyrax/templates/config/initializers/publisher.rb
3092
3099
  - lib/generators/hyrax/templates/config/initializers/redis_config.rb
3093
3100
  - lib/generators/hyrax/templates/config/initializers/riiif.rb
@@ -3425,7 +3432,6 @@ licenses:
3425
3432
  - Apache-2.0
3426
3433
  metadata:
3427
3434
  rubygems_mfa_required: 'true'
3428
- post_install_message:
3429
3435
  rdoc_options: []
3430
3436
  require_paths:
3431
3437
  - lib
@@ -3440,8 +3446,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
3440
3446
  - !ruby/object:Gem::Version
3441
3447
  version: '0'
3442
3448
  requirements: []
3443
- rubygems_version: 3.5.22
3444
- signing_key:
3449
+ rubygems_version: 3.6.2
3445
3450
  specification_version: 4
3446
3451
  summary: Hyrax is a front-end based on the robust Samvera framework, providing a user
3447
3452
  interface for common repository features. Hyrax offers the ability to create repository
data/.dassie/bin/spring DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This file loads Spring without using Bundler, in order to be fast.
4
- # It gets overwritten when you run the `spring binstub` command.
5
-
6
- unless defined?(Spring)
7
- require 'rubygems'
8
- require 'bundler'
9
-
10
- lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11
- spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
12
- if spring
13
- Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14
- gem 'spring', spring.version
15
- require 'spring/binstub'
16
- end
17
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'mini_magick'
3
-
4
- MiniMagick.configure do |config|
5
- config.shell_api = "posix-spawn"
6
- end
@@ -1,6 +0,0 @@
1
- %w[
2
- .ruby-version
3
- .rbenv-vars
4
- tmp/restart.txt
5
- tmp/caching-dev.txt
6
- ].each { |path| Spring.watch(path) }
data/.koppie/bin/spring DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This file loads Spring without using Bundler, in order to be fast.
4
- # It gets overwritten when you run the `spring binstub` command.
5
-
6
- unless defined?(Spring)
7
- require 'rubygems'
8
- require 'bundler'
9
-
10
- lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11
- spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
12
- if spring
13
- Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14
- gem 'spring', spring.version
15
- require 'spring/binstub'
16
- end
17
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'mini_magick'
3
-
4
- MiniMagick.configure do |config|
5
- config.shell_api = "posix-spawn"
6
- end
@@ -1,6 +0,0 @@
1
- %w[
2
- .ruby-version
3
- .rbenv-vars
4
- tmp/restart.txt
5
- tmp/caching-dev.txt
6
- ].each { |path| Spring.watch(path) }
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Taken from https://github.com/trailblazer/reform-rails/issues/86#issuecomment-763120151
4
- # rubocop:disable Metrics/CyclomaticComplexity
5
- # rubocop:disable Lint/UselessAssignment
6
- module Reform
7
- class Contract < Disposable::Twin
8
- class Result
9
- private
10
-
11
- # this doesn't do nested errors (e.g. )
12
- def filter_for(method, *args)
13
- @results.collect { |r| r.public_send(method, *args).to_h }
14
- .inject({}) { |hah, err| hah.merge(err) { |_key, old_v, new_v| (new_v.is_a?(Array) ? (old_v |= new_v) : old_v.merge(new_v)) } }
15
- .find_all do |_k, v| # filter :nested=>{:something=>["too nested!"]} #DISCUSS: do we want that here?
16
- if v.is_a?(Hash)
17
- nested_errors = v.select { |attr_key, val| attr_key.is_a?(Integer) && val.is_a?(Array) && val.any? }
18
- v = nested_errors.to_a if nested_errors.any?
19
- end
20
- v.is_a?(ActiveModel::DeprecationHandlingMessageArray)
21
- end.to_h
22
- end
23
- end
24
- end
25
- end
26
- # rubocop:enable Metrics/CyclomaticComplexity
27
- # rubocop:disable Lint/UselessAssignment
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'mini_magick'
3
-
4
- MiniMagick.configure do |config|
5
- config.shell_api = "posix-spawn"
6
- end