hyrax 3.3.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +26 -17
- data/.dassie/.env +2 -1
- data/.dassie/Gemfile +1 -1
- data/.dassie/app/forms/collection_resource_form.rb +8 -0
- data/.dassie/app/indexers/collection_resource_indexer.rb +8 -0
- data/.dassie/app/models/collection_resource.rb +35 -0
- data/.dassie/config/initializers/file_services.rb +4 -0
- data/.dassie/config/initializers/hyrax.rb +12 -1
- data/.dassie/config/metadata/collection_resource.yaml +23 -0
- data/.dassie/db/seeds.rb +74 -17
- data/.dassie/spec/forms/collection_resource_form_spec.rb +13 -0
- data/.dassie/spec/indexers/collection_resource_indexer_spec.rb +14 -0
- data/.dassie/spec/models/collection_resource_spec.rb +13 -0
- data/.github/release.yml +26 -0
- data/.gitignore +3 -0
- data/.regen +1 -1
- data/.rubocop.yml +1 -1
- data/.rubocop_fixme.yml +22 -3
- data/CONTAINERS.md +18 -13
- data/Dockerfile +4 -3
- data/app/actors/hyrax/actors/file_actor.rb +6 -4
- data/app/actors/hyrax/actors/transfer_request_actor.rb +3 -7
- data/app/assets/javascripts/hyrax/analytics_events.js +8 -2
- data/app/assets/javascripts/hyrax/autocomplete/linked_data.es6 +1 -3
- data/app/assets/javascripts/hyrax/collections_v2.es6 +13 -0
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +1 -3
- data/app/controllers/concerns/hyrax/controller.rb +21 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +83 -59
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +105 -19
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +12 -19
- data/app/controllers/hyrax/batch_edits_controller.rb +12 -3
- data/app/controllers/hyrax/batch_uploads_controller.rb +4 -0
- data/app/controllers/hyrax/citations_controller.rb +1 -1
- data/app/controllers/hyrax/dashboard/collections_controller.rb +176 -83
- data/app/controllers/hyrax/single_use_links_viewer_controller.rb +1 -1
- data/app/forms/hyrax/forms/administrative_set_form.rb +19 -1
- data/app/forms/hyrax/forms/batch_edit_form.rb +1 -1
- data/app/forms/hyrax/forms/collection_form.rb +1 -1
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +21 -6
- data/app/forms/hyrax/forms/pcdm_collection_form.rb +30 -2
- data/app/forms/hyrax/forms/permission_template_form.rb +17 -9
- data/app/forms/hyrax/forms/resource_form.rb +23 -5
- data/app/forms/hyrax/forms/widgets/admin_set_visibility.rb +1 -1
- data/app/helpers/hyrax/collections_helper.rb +14 -0
- data/app/helpers/hyrax/membership_helper.rb +1 -1
- data/app/helpers/hyrax/trophy_helper.rb +1 -1
- data/app/helpers/hyrax/url_helper.rb +1 -1
- data/app/indexers/hyrax/administrative_set_indexer.rb +8 -2
- data/app/indexers/hyrax/deep_indexing_service.rb +1 -1
- data/app/indexers/hyrax/file_set_indexer.rb +1 -0
- data/app/indexers/hyrax/pcdm_collection_indexer.rb +3 -2
- data/app/indexers/hyrax/thumbnail_indexer.rb +31 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +6 -6
- data/app/indexers/hyrax/valkyrie_indexer.rb +4 -2
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +13 -0
- data/app/inputs/controlled_vocabulary_input.rb +2 -0
- data/app/jobs/change_depositor_event_job.rb +47 -0
- data/app/jobs/characterize_job.rb +43 -3
- data/app/jobs/concerns/hyrax/members_permission_job_behavior.rb +1 -1
- data/app/jobs/content_depositor_change_event_job.rb +2 -1
- data/app/jobs/hyrax/propagate_change_depositor_job.rb +32 -0
- data/app/jobs/import_url_job.rb +4 -6
- data/app/jobs/inherit_permissions_job.rb +1 -1
- data/app/jobs/valkyrie_create_derivatives_job.rb +25 -0
- data/app/jobs/valkyrie_ingest_job.rb +41 -35
- data/app/models/admin_set.rb +10 -2
- data/app/models/collection_branding_info.rb +8 -6
- data/app/models/concerns/hyrax/collection_behavior.rb +3 -3
- data/app/models/concerns/hyrax/file_set/characterization.rb +7 -1
- data/app/models/concerns/hyrax/solr_document/metadata.rb +1 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +9 -3
- data/app/models/concerns/hyrax/user.rb +11 -0
- data/app/models/concerns/hyrax/work_behavior.rb +1 -1
- data/app/models/featured_work_list.rb +0 -1
- data/app/models/hyrax/administrative_set.rb +36 -1
- data/app/models/hyrax/collection_type.rb +2 -2
- data/app/models/hyrax/file_metadata.rb +37 -3
- data/app/models/hyrax/file_set.rb +43 -4
- data/app/models/hyrax/group.rb +19 -0
- data/app/models/hyrax/pcdm_collection.rb +56 -1
- data/app/models/hyrax/permission_template.rb +11 -5
- data/app/models/hyrax/work.rb +91 -0
- data/app/models/job_io_wrapper.rb +1 -1
- data/app/models/proxy_deposit_request.rb +1 -1
- data/app/presenters/hyrax/admin_set_presenter.rb +2 -2
- data/app/presenters/hyrax/member_presenter_factory.rb +2 -4
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +2 -2
- data/app/presenters/hyrax/work_show_presenter.rb +10 -6
- data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/dashboard/managed_search_filters.rb +44 -4
- data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/my/collections_search_builder.rb +11 -4
- data/app/services/hyrax/access_control_list.rb +20 -6
- data/app/services/hyrax/adapters/nesting_index_adapter.rb +3 -3
- data/app/services/hyrax/admin_set_create_service.rb +21 -37
- data/app/services/hyrax/change_content_depositor_service.rb +2 -2
- data/app/services/hyrax/change_depositor_service.rb +70 -0
- data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +4 -6
- data/app/services/hyrax/collections/collection_member_service.rb +3 -5
- data/app/services/hyrax/collections/nested_collection_query_service.rb +24 -12
- data/app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb +45 -0
- data/app/services/hyrax/custom_queries/navigators/child_filesets_navigator.rb +7 -2
- data/app/services/hyrax/custom_queries/navigators/parent_work_navigator.rb +54 -0
- data/app/services/hyrax/default_middleware_stack.rb +3 -0
- data/app/services/hyrax/file_set_derivatives_service.rb +21 -2
- data/app/services/hyrax/file_set_type_service.rb +2 -5
- data/app/services/hyrax/listeners/file_metadata_listener.rb +31 -1
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +27 -11
- data/app/services/hyrax/listeners/metadata_index_listener.rb +39 -0
- data/app/services/hyrax/listeners/proxy_deposit_listener.rb +14 -8
- data/app/services/hyrax/location_service.rb +33 -0
- data/app/services/hyrax/multiple_membership_checker.rb +46 -1
- data/app/services/hyrax/resource_visibility_propagator.rb +1 -1
- data/app/services/hyrax/simple_schema_loader.rb +5 -1
- data/app/services/hyrax/solr_query_service.rb +12 -7
- data/app/services/hyrax/thumbnail_path_service.rb +1 -1
- data/app/services/hyrax/valkyrie_persist_derivatives.rb +50 -0
- data/app/services/hyrax/valkyrie_upload.rb +94 -0
- data/app/services/hyrax/work_uploads_handler.rb +0 -10
- data/app/services/hyrax/workflow/workflow_importer.rb +7 -9
- data/app/services/hyrax/workflow/workflow_schema.rb +3 -5
- data/app/strategies/hyrax/strategies/yaml_strategy.rb +4 -6
- data/app/uploaders/hyrax/uploaded_file_uploader.rb +4 -4
- data/app/utils/hyrax/data_destroyers/collection_branding_destroyer.rb +29 -0
- data/app/utils/hyrax/data_destroyers/collection_types_destroyer.rb +26 -0
- data/app/utils/hyrax/data_destroyers/default_admin_set_id_cache_destroyer.rb +26 -0
- data/app/utils/hyrax/data_destroyers/featured_works_destroyer.rb +27 -0
- data/app/utils/hyrax/data_destroyers/permission_templates_destroyer.rb +30 -0
- data/app/utils/hyrax/data_destroyers/repository_metadata_destroyer.rb +42 -0
- data/app/utils/hyrax/data_destroyers/stats_destroyer.rb +33 -0
- data/app/utils/hyrax/data_maintenance.rb +51 -0
- data/app/utils/hyrax/required_data_seeder.rb +21 -0
- data/app/utils/hyrax/required_data_seeders/collection_seeder.rb +26 -0
- data/app/utils/hyrax/required_data_seeders/collection_type_seeder.rb +36 -0
- data/app/utils/hyrax/test_data_seeder.rb +24 -0
- data/app/utils/hyrax/test_data_seeders/collection_seeder.rb +91 -0
- data/app/utils/hyrax/test_data_seeders/collection_type_seeder.rb +72 -0
- data/app/utils/hyrax/test_data_seeders/user_seeder.rb +52 -0
- data/app/validators/hyrax/collection_membership_validator.rb +39 -0
- data/app/views/catalog/_index_header_list_default.html.erb +8 -1
- data/app/views/catalog/_thumbnail_list_default.html.erb +8 -3
- data/app/views/collections/edit_fields/_based_near.html.erb +7 -7
- data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/_form_workflow.erb +1 -1
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/base/_form.html.erb +1 -1
- data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_default_group.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form.html.erb +24 -17
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +1 -0
- data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +6 -3
- data/app/views/hyrax/dashboard/collections/_form_share.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +3 -3
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +2 -2
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +1 -1
- data/app/views/hyrax/dashboard/works/_default_group.html.erb +1 -1
- data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
- data/app/views/hyrax/file_sets/_actions.html.erb +2 -2
- data/app/views/hyrax/my/_facet_pagination.html.erb +12 -9
- data/app/views/hyrax/my/_work_action_menu.html.erb +8 -9
- data/app/views/hyrax/my/collections/_default_group.html.erb +2 -2
- data/app/views/hyrax/my/collections/_list_collections.html.erb +2 -2
- data/app/views/hyrax/my/collections/index.html.erb +3 -2
- data/app/views/hyrax/my/works/_default_group.html.erb +1 -1
- data/app/views/hyrax/my/works/_list_works.html.erb +1 -2
- data/app/views/hyrax/my/works/_tabs.html.erb +6 -1
- data/app/views/hyrax/my/works/index.html.erb +4 -2
- data/chart/hyrax/Chart.yaml +11 -7
- data/chart/hyrax/README.md +22 -1
- data/chart/hyrax/templates/_helpers.tpl +4 -0
- data/chart/hyrax/templates/cron-embargo.yaml +5 -0
- data/chart/hyrax/templates/cron-lease.yaml +5 -0
- data/chart/hyrax/templates/deployment-worker.yaml +11 -0
- data/chart/hyrax/templates/ingress.yaml +7 -6
- data/chart/hyrax/values.yaml +152 -0
- data/config/features.rb +48 -50
- data/config/initializers/listeners.rb +0 -1
- data/config/initializers/{valkryrie_storage.rb → storage_adapter_initializer.rb} +5 -0
- data/config/locales/hyrax.de.yml +18 -17
- data/config/locales/hyrax.en.yml +30 -28
- data/config/locales/hyrax.es.yml +10 -9
- data/config/locales/hyrax.fr.yml +2 -1
- data/config/locales/hyrax.it.yml +3 -2
- data/config/locales/hyrax.pt-BR.yml +2 -1
- data/config/locales/hyrax.zh.yml +2 -1
- data/config/metadata/basic_metadata.yaml +2 -0
- data/config/metadata/core_metadata.yaml +1 -1
- data/docker-compose.yml +47 -42
- data/documentation/developing-your-hyrax-based-app.md +1 -1
- data/documentation/legacyREADME.md +1 -1
- data/hyrax.gemspec +5 -3
- data/lib/generators/hyrax/collection_resource/USAGE +20 -0
- data/lib/generators/hyrax/collection_resource/collection_resource_generator.rb +133 -0
- data/lib/generators/hyrax/collection_resource/templates/collection.rb.erb +34 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_form.rb.erb +7 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_form_spec.rb.erb +13 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_indexer.rb.erb +7 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_indexer_spec.rb.erb +13 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_metadata.yaml +22 -0
- data/lib/generators/hyrax/collection_resource/templates/collection_spec.rb.erb +12 -0
- data/lib/generators/hyrax/install_generator.rb +9 -0
- data/lib/hyrax/administrative_set_name.rb +18 -0
- data/lib/hyrax/collection_name.rb +2 -0
- data/lib/hyrax/configuration.rb +22 -0
- data/lib/hyrax/controlled_vocabularies/location.rb +9 -2
- data/lib/hyrax/controlled_vocabularies/resource_label_caching.rb +42 -0
- data/lib/hyrax/controlled_vocabularies.rb +1 -0
- data/lib/hyrax/publisher.rb +49 -0
- data/lib/hyrax/schema.rb +16 -13
- data/lib/hyrax/specs/capybara.rb +1 -1
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +11 -5
- data/lib/hyrax/specs/shared_specs/indexers.rb +117 -3
- data/lib/hyrax/transactions/admin_set_create.rb +2 -1
- data/lib/hyrax/transactions/admin_set_destroy.rb +22 -0
- data/lib/hyrax/transactions/admin_set_update.rb +21 -0
- data/lib/hyrax/transactions/collection_destroy.rb +22 -0
- data/lib/hyrax/transactions/collection_update.rb +5 -2
- data/lib/hyrax/transactions/container.rb +97 -23
- data/lib/hyrax/transactions/create_work.rb +3 -0
- data/lib/hyrax/transactions/destroy_work.rb +3 -0
- data/lib/hyrax/transactions/steps/apply_collection_permission_template.rb +2 -0
- data/lib/hyrax/transactions/steps/apply_permission_template.rb +2 -0
- data/lib/hyrax/transactions/steps/apply_visibility.rb +2 -0
- data/lib/hyrax/transactions/steps/change_depositor.rb +46 -0
- data/lib/hyrax/transactions/steps/check_for_empty_admin_set.rb +36 -0
- data/lib/hyrax/transactions/steps/delete_access_control.rb +32 -0
- data/lib/hyrax/transactions/steps/delete_resource.rb +19 -3
- data/lib/hyrax/transactions/steps/destroy_work.rb +3 -1
- data/lib/hyrax/transactions/steps/ensure_permission_template.rb +2 -0
- data/lib/hyrax/transactions/steps/save.rb +24 -6
- data/lib/hyrax/transactions/steps/save_access_control.rb +2 -2
- data/lib/hyrax/transactions/steps/save_collection_banner.rb +59 -0
- data/lib/hyrax/transactions/steps/save_collection_logo.rb +109 -0
- data/lib/hyrax/transactions/steps/save_work.rb +3 -0
- data/lib/hyrax/transactions/steps/set_user_as_creator.rb +41 -0
- data/lib/hyrax/transactions/steps/update_work_members.rb +51 -0
- data/lib/hyrax/transactions/update_work.rb +4 -3
- data/lib/hyrax/transactions/work_create.rb +1 -1
- data/lib/hyrax/transactions/work_destroy.rb +2 -1
- data/lib/hyrax/transactions/work_update.rb +19 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/wings/active_fedora_converter/file_metadata_node.rb +48 -0
- data/lib/wings/active_fedora_converter/instance_builder.rb +68 -0
- data/lib/wings/active_fedora_converter.rb +3 -3
- data/lib/wings/attribute_transformer.rb +5 -1
- data/lib/wings/services/custom_queries/find_file_metadata.rb +19 -8
- data/lib/wings/setup.rb +3 -1
- data/lib/wings/valkyrie/persister.rb +2 -0
- data/lib/wings/valkyrie/query_service.rb +6 -7
- data/lib/wings/valkyrie/storage.rb +7 -1
- data/template.rb +1 -1
- metadata +99 -12
data/hyrax.gemspec
CHANGED
|
@@ -26,7 +26,7 @@ SUMMARY
|
|
|
26
26
|
|
|
27
27
|
spec.required_ruby_version = '>= 2.5'
|
|
28
28
|
|
|
29
|
-
#
|
|
29
|
+
# NOTE: rails does not follow sem-ver conventions, it's
|
|
30
30
|
# minor version releases can include breaking changes; see
|
|
31
31
|
# http://guides.rubyonrails.org/maintenance_policy.html
|
|
32
32
|
spec.add_dependency 'rails', '~> 5.0'
|
|
@@ -58,6 +58,7 @@ SUMMARY
|
|
|
58
58
|
spec.add_dependency 'iiif_manifest', '>= 0.3', '< 2.0'
|
|
59
59
|
spec.add_dependency 'jquery-datatables-rails', '~> 3.4'
|
|
60
60
|
spec.add_dependency 'jquery-ui-rails', '~> 6.0'
|
|
61
|
+
spec.add_dependency 'json-ld', '< 3.2'
|
|
61
62
|
spec.add_dependency 'json-schema' # for Arkivo
|
|
62
63
|
# Pin more tightly because 0.x gems are potentially unstable
|
|
63
64
|
spec.add_dependency 'kaminari_route_prefix', '~> 0.1.1'
|
|
@@ -70,6 +71,7 @@ SUMMARY
|
|
|
70
71
|
spec.add_dependency 'oauth2', '~> 1.2'
|
|
71
72
|
spec.add_dependency 'posix-spawn'
|
|
72
73
|
spec.add_dependency 'power_converter', '~> 0.1', '>= 0.1.2'
|
|
74
|
+
spec.add_dependency 'psych', '~> 3.3'
|
|
73
75
|
spec.add_dependency 'qa', '~> 5.5', '>= 5.5.1' # questioning_authority
|
|
74
76
|
spec.add_dependency 'rails_autolink', '~> 1.1'
|
|
75
77
|
spec.add_dependency 'rdf-rdfxml' # controlled vocabulary importer
|
|
@@ -82,7 +84,7 @@ SUMMARY
|
|
|
82
84
|
spec.add_dependency 'samvera-nesting_indexer', '~> 2.0'
|
|
83
85
|
spec.add_dependency 'select2-rails', '~> 3.5'
|
|
84
86
|
spec.add_dependency 'signet'
|
|
85
|
-
spec.add_dependency 'tinymce-rails'
|
|
87
|
+
spec.add_dependency 'tinymce-rails', '~> 5.10'
|
|
86
88
|
spec.add_dependency 'valkyrie', '~> 2', '>= 2.1.1'
|
|
87
89
|
|
|
88
90
|
spec.add_development_dependency "capybara", '~> 3.29'
|
|
@@ -106,7 +108,7 @@ SUMMARY
|
|
|
106
108
|
spec.add_development_dependency 'i18n_yaml_sorter'
|
|
107
109
|
spec.add_development_dependency 'rails-controller-testing', '~> 1'
|
|
108
110
|
# the hyrax style guide is based on `bixby`. see `.rubocop.yml`
|
|
109
|
-
spec.add_development_dependency 'bixby', '~>
|
|
111
|
+
spec.add_development_dependency 'bixby', '~> 5.0', '>= 5.0.2' # bixby 5 briefly dropped Ruby 2.5
|
|
110
112
|
spec.add_development_dependency 'shoulda-callback-matchers', '~> 1.1.1'
|
|
111
113
|
spec.add_development_dependency 'shoulda-matchers', '~> 3.1'
|
|
112
114
|
spec.add_development_dependency 'webdrivers', '~> 4.4'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
This generator creates the necessary files for a Hyrax::PcdmCollection.
|
|
3
|
+
|
|
4
|
+
Example:
|
|
5
|
+
Usage: rails generate hyrax:collection_resource MyCollection [with_basic_metadata]
|
|
6
|
+
|
|
7
|
+
Argument:
|
|
8
|
+
with_basic_metadata (optional) - if present, the collection resource will include basic metadata
|
|
9
|
+
|
|
10
|
+
This will create:
|
|
11
|
+
app/models/my_collection.rb
|
|
12
|
+
app/forms/my_collection_form.rb
|
|
13
|
+
app/indexers/my_collection_indexer.rb
|
|
14
|
+
config/metadata/my_collection.yaml
|
|
15
|
+
spec/models/my_collection_spec.rb
|
|
16
|
+
spec/forms/my_collection_form_spec.rb
|
|
17
|
+
spec/indexers/my_collection_indexer_spec.rb
|
|
18
|
+
|
|
19
|
+
This will also:
|
|
20
|
+
set Hyrax.config.collection_model = "MyCollection"
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'rails/generators'
|
|
3
|
+
require 'rails/generators/model_helpers'
|
|
4
|
+
|
|
5
|
+
class Hyrax::CollectionResourceGenerator < Rails::Generators::NamedBase # rubocop:disable Metrics/ClassLength
|
|
6
|
+
# ActiveSupport can interpret models as plural which causes
|
|
7
|
+
# counter-intuitive route paths. Pull in ModelHelpers from
|
|
8
|
+
# Rails which warns users about pluralization when generating
|
|
9
|
+
# new models or scaffolds.
|
|
10
|
+
include Rails::Generators::ModelHelpers
|
|
11
|
+
|
|
12
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
13
|
+
|
|
14
|
+
argument :with_basic_metadata, type: :string, default: "", banner: 'with_basic_metadata'
|
|
15
|
+
|
|
16
|
+
desc 'This generator makes the following changes to your application:
|
|
17
|
+
1. Creates a collection model and model spec, optionally including basic metadata.
|
|
18
|
+
2. Creates a collection form and spec.
|
|
19
|
+
3. Creates a collection indexer and spec.
|
|
20
|
+
4. Creates a collection metadata config.
|
|
21
|
+
5. Sets this to be the collection class.
|
|
22
|
+
'
|
|
23
|
+
|
|
24
|
+
def self.exit_on_failure?
|
|
25
|
+
true
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def validate_name
|
|
29
|
+
return unless name.strip.casecmp("collection").zero?
|
|
30
|
+
raise Thor::MalformattedArgumentError,
|
|
31
|
+
set_color("Error: A collection resource with the name '#{name}' would cause name-space clashes. "\
|
|
32
|
+
"Please use a different name.", :red)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def banner
|
|
36
|
+
if revoking?
|
|
37
|
+
say_status("info", "DESTROYING VALKYRIE COLLECTION MODEL: #{class_name}", :blue)
|
|
38
|
+
else
|
|
39
|
+
say_status("info", "GENERATING VALKYRIE COLLECTION MODEL: #{class_name}", :blue)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def create_metadata_config
|
|
44
|
+
template('collection_metadata.yaml', File.join('config/metadata/', "#{file_name}.yaml"))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def create_model
|
|
48
|
+
filepath = File.join('app/models', "#{file_name}.rb")
|
|
49
|
+
template('collection.rb.erb', filepath)
|
|
50
|
+
return unless include_basic_metadata?
|
|
51
|
+
inject_into_file filepath, before: /include Hyrax::Schema/ do
|
|
52
|
+
"include Hyrax::Schema(:basic_metadata)\n "
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def create_model_spec
|
|
57
|
+
return unless rspec_installed?
|
|
58
|
+
filepath = File.join('spec/models/', "#{file_name}_spec.rb")
|
|
59
|
+
template('collection_spec.rb.erb', filepath)
|
|
60
|
+
|
|
61
|
+
return unless include_basic_metadata?
|
|
62
|
+
inject_into_file filepath, after: /it_behaves_like 'a Hyrax::PcdmCollection'/ do
|
|
63
|
+
"\n it_behaves_like 'a model with basic metadata'"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def create_form
|
|
68
|
+
filepath = File.join('app/forms/', "#{file_name}_form.rb")
|
|
69
|
+
template('collection_form.rb.erb', filepath)
|
|
70
|
+
return unless include_basic_metadata?
|
|
71
|
+
inject_into_file filepath, before: /include Hyrax::FormFields/ do
|
|
72
|
+
"include Hyrax::FormFields(:basic_metadata)\n "
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# @todo If shared specs are expanded to test for basic metadata, inject calling that test here.
|
|
77
|
+
def create_form_spec
|
|
78
|
+
return unless rspec_installed?
|
|
79
|
+
template('collection_form_spec.rb.erb', File.join('spec/forms/', "#{file_name}_form_spec.rb"))
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def create_indexer
|
|
83
|
+
filepath = File.join('app/indexers/', "#{file_name}_indexer.rb")
|
|
84
|
+
template('collection_indexer.rb.erb', filepath)
|
|
85
|
+
return unless include_basic_metadata?
|
|
86
|
+
inject_into_file filepath, before: /include Hyrax::Indexer/ do
|
|
87
|
+
"include Hyrax::Indexer(:basic_metadata)\n "
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def create_indexer_spec
|
|
92
|
+
return unless rspec_installed?
|
|
93
|
+
filepath = File.join('spec/indexers/', "#{file_name}_indexer_spec.rb")
|
|
94
|
+
template('collection_indexer_spec.rb.erb', filepath)
|
|
95
|
+
|
|
96
|
+
return unless include_basic_metadata?
|
|
97
|
+
inject_into_file filepath, after: /it_behaves_like 'a Hyrax::Resource indexer'/ do
|
|
98
|
+
"\n it_behaves_like 'a Basic metadata indexer'"
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Inserts after the last registered work, or at the top of the config block
|
|
103
|
+
def set_as_the_collection_class
|
|
104
|
+
config = 'config/initializers/hyrax.rb'
|
|
105
|
+
lastmatch = nil
|
|
106
|
+
in_root do
|
|
107
|
+
File.open(config).each_line do |line|
|
|
108
|
+
lastmatch = line if line.match?(/config.collection_model = /)
|
|
109
|
+
end
|
|
110
|
+
content = " # Injected via `rails g hyrax:collection_resource #{class_name}`\n" \
|
|
111
|
+
" config.collection_model = '#{class_name}'\n"
|
|
112
|
+
|
|
113
|
+
anchor = lastmatch || "Hyrax.config do |config|\n"
|
|
114
|
+
inject_into_file config, after: anchor do
|
|
115
|
+
content
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
private
|
|
121
|
+
|
|
122
|
+
def include_basic_metadata?
|
|
123
|
+
with_basic_metadata.present? && with_basic_metadata == "with_basic_metadata"
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def rspec_installed?
|
|
127
|
+
defined?(RSpec) && defined?(RSpec::Rails)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def revoking?
|
|
131
|
+
behavior == :revoke
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Generated via
|
|
4
|
+
# `rails generate hyrax:collection_resource <%= class_name %>`
|
|
5
|
+
class <%= class_name %> < Hyrax::PcdmCollection
|
|
6
|
+
# @note Do not directly update `basic_metadata.yaml`. It is also used by works.
|
|
7
|
+
#
|
|
8
|
+
# To change metadata for collections
|
|
9
|
+
# * extend by adding fields to `/config/metadata/<%= file_name %>.yaml`
|
|
10
|
+
# * remove all basic metadata
|
|
11
|
+
# * if you generated `with_basic_metadata` and now don't want any basic metadata,
|
|
12
|
+
# comment out or delete the schema include statement for `:basic_metadata`
|
|
13
|
+
# * update form and indexer classes to also remove the `:basic_metadata` schema include
|
|
14
|
+
# * remove some basic metadata
|
|
15
|
+
# * comment out or delete the schema include statement for `:basic_metadata`
|
|
16
|
+
# * update form and indexer classes to also remove the `:basic_metadata` schema include
|
|
17
|
+
# * copy fields you want to keep from `/config/metadata/basic_metadata.yaml`
|
|
18
|
+
# to `/config/metadata/<%= file_name %>.yaml`
|
|
19
|
+
# * override some basic metadata
|
|
20
|
+
# * fields are not allowed to repeat, so to override any basic metadata, you
|
|
21
|
+
# must first comment out or delete the schema include statement for `:basic_metadata`
|
|
22
|
+
# * update form and indexer classes to also remove the `:basic_metadata` schema include
|
|
23
|
+
# * copy all fields you want to keep unchanged or to override from `/config/metadata/basic_metadata.yaml`
|
|
24
|
+
# to `/config/metadata/<%= file_name %>.yaml`
|
|
25
|
+
# * update them in `config/metadata/<%= file_name %>.yaml to have the desired
|
|
26
|
+
# characteristics
|
|
27
|
+
#
|
|
28
|
+
# Alternative:
|
|
29
|
+
# * comment out or delete schema include statements
|
|
30
|
+
# * add Valkyrie attributes to this class
|
|
31
|
+
# * update form and indexer to process the attributes
|
|
32
|
+
#
|
|
33
|
+
include Hyrax::Schema(:<%= file_name %>)
|
|
34
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Generated via
|
|
4
|
+
# `rails generate hyrax:collection_resource <%= class_name %>`
|
|
5
|
+
require 'rails_helper'
|
|
6
|
+
require 'valkyrie/specs/shared_specs'
|
|
7
|
+
|
|
8
|
+
RSpec.describe <%= class_name %>Form do
|
|
9
|
+
let(:change_set) { described_class.new(resource) }
|
|
10
|
+
let(:resource) { <%= class_name %>.new }
|
|
11
|
+
|
|
12
|
+
it_behaves_like 'a Valkyrie::ChangeSet'
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Generated via
|
|
4
|
+
# `rails generate hyrax:collection_resource <%= class_name %>`
|
|
5
|
+
require 'rails_helper'
|
|
6
|
+
require 'hyrax/specs/shared_specs/indexers'
|
|
7
|
+
|
|
8
|
+
RSpec.describe <%= class_name %>Indexer do
|
|
9
|
+
let(:indexer_class) { described_class }
|
|
10
|
+
let(:resource) { <%= class_name %>.new }
|
|
11
|
+
|
|
12
|
+
it_behaves_like 'a Hyrax::Resource indexer'
|
|
13
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Simple yaml config-driven schema which is used to define model attributes,
|
|
2
|
+
# index key names, and form properties.
|
|
3
|
+
#
|
|
4
|
+
# Attributes must have a type but all other configuration options are optional.
|
|
5
|
+
#
|
|
6
|
+
# attributes:
|
|
7
|
+
# attribute_name:
|
|
8
|
+
# type: string
|
|
9
|
+
# multiple: false
|
|
10
|
+
# index_keys:
|
|
11
|
+
# - "attribute_name_sim"
|
|
12
|
+
# form:
|
|
13
|
+
# required: true
|
|
14
|
+
# primary: true
|
|
15
|
+
# multiple: false
|
|
16
|
+
#
|
|
17
|
+
# @see config/metadata/basic_metadata.yaml for an example configuration
|
|
18
|
+
#
|
|
19
|
+
# Generated via
|
|
20
|
+
# `rails generate hyrax:collection_resource <%= class_name %>`
|
|
21
|
+
|
|
22
|
+
attributes: {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Generated via
|
|
4
|
+
# `rails generate hyrax:collection_resource <%= class_name %>`
|
|
5
|
+
require 'rails_helper'
|
|
6
|
+
require 'hyrax/specs/shared_specs/hydra_works'
|
|
7
|
+
|
|
8
|
+
RSpec.describe <%= class_name %> do
|
|
9
|
+
subject(:collection) { described_class.new }
|
|
10
|
+
|
|
11
|
+
it_behaves_like 'a Hyrax::PcdmCollection'
|
|
12
|
+
end
|
|
@@ -35,6 +35,15 @@ module Hyrax
|
|
|
35
35
|
18. Generates RIIIF image server implementation
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
|
+
# browse-everything 1.2.0 is not compatible with Ruby 2.5
|
|
39
|
+
def pin_browse_everything
|
|
40
|
+
return unless Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.6')
|
|
41
|
+
gem 'browse-everything', '~> 1.1.2'
|
|
42
|
+
Bundler.with_clean_env do
|
|
43
|
+
run "bundle update browse-everything"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
38
47
|
def run_required_generators
|
|
39
48
|
say_status('info', '[Hyrax] GENERATING BLACKLIGHT', :blue)
|
|
40
49
|
generate 'blacklight:install --devise'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyrax
|
|
4
|
+
##
|
|
5
|
+
# A custom name for Valkyrie AdministrativeSet objects. Route keys are mapped to `admin_set`
|
|
6
|
+
# not be the same as the model name.
|
|
7
|
+
class AdministrativeSetName < Name
|
|
8
|
+
def initialize(klass, namespace = nil, name = nil)
|
|
9
|
+
super
|
|
10
|
+
@human = 'AdminSet'
|
|
11
|
+
@i18n_key = :admin_set
|
|
12
|
+
@param_key = 'admin_set'
|
|
13
|
+
@plural = 'admin_sets'
|
|
14
|
+
@route_key = 'admin_sets'
|
|
15
|
+
@singular_route_key = 'admin_set'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/hyrax/configuration.rb
CHANGED
|
@@ -427,6 +427,18 @@ module Hyrax
|
|
|
427
427
|
@branding_storage_adapter = Valkyrie::StorageAdapter.find(adapter.to_sym)
|
|
428
428
|
end
|
|
429
429
|
|
|
430
|
+
##
|
|
431
|
+
# @return [Valkyrie::StorageAdapter]
|
|
432
|
+
def derivatives_storage_adapter
|
|
433
|
+
@derivatives_storage_adapter ||= Valkyrie::StorageAdapter.find(:derivatives_disk)
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
##
|
|
437
|
+
# @param [#to_sym] adapter
|
|
438
|
+
def derivatives_storage_adapter=(adapter)
|
|
439
|
+
@derivatives_storage_adapter = Valkyrie::StorageAdapter.find(adapter.to_sym)
|
|
440
|
+
end
|
|
441
|
+
|
|
430
442
|
##
|
|
431
443
|
# @return [#save, #save_all, #delete, #wipe!] an indexing adapter
|
|
432
444
|
def index_adapter
|
|
@@ -449,6 +461,7 @@ module Hyrax
|
|
|
449
461
|
##
|
|
450
462
|
# @return [Boolean] whether to use experimental valkyrie storage features
|
|
451
463
|
def use_valkyrie?
|
|
464
|
+
return true if disable_wings # always return true if wings is disabled
|
|
452
465
|
ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_VALKYRIE', false))
|
|
453
466
|
end
|
|
454
467
|
# @!endgroup
|
|
@@ -495,6 +508,15 @@ module Hyrax
|
|
|
495
508
|
Hyrax::Characterization::ValkyrieCharacterizationService
|
|
496
509
|
end
|
|
497
510
|
|
|
511
|
+
##
|
|
512
|
+
# @!attribute [w] characterization_proxy
|
|
513
|
+
# Which FileSet file to use for mime type resolution
|
|
514
|
+
# @ see Hyrax::FileSetTypeService
|
|
515
|
+
attr_writer :characterization_proxy
|
|
516
|
+
def characterization_proxy
|
|
517
|
+
@characterization_proxy ||= :original_file
|
|
518
|
+
end
|
|
519
|
+
|
|
498
520
|
# Attributes for the lock manager which ensures a single process/thread is mutating a ore:Aggregation at once.
|
|
499
521
|
# @!attribute [w] lock_retry_count
|
|
500
522
|
# How many times to retry to acquire the lock before raising UnableToAcquireLockError
|
|
@@ -4,10 +4,17 @@ module Hyrax
|
|
|
4
4
|
class Location < ActiveTriples::Resource
|
|
5
5
|
configure rdf_label: ::RDF::Vocab::GEONAMES.name
|
|
6
6
|
|
|
7
|
+
include ResourceLabelCaching
|
|
8
|
+
|
|
7
9
|
# Return a tuple of url & label
|
|
8
10
|
def solrize
|
|
9
|
-
|
|
10
|
-
[rdf_subject.to_s
|
|
11
|
+
label = full_label || rdf_label.first.to_s
|
|
12
|
+
return [rdf_subject.to_s] if label.blank? || label == rdf_subject.to_s
|
|
13
|
+
[rdf_subject.to_s, { label: "#{label}$#{rdf_subject}" }]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def full_label
|
|
17
|
+
Hyrax::LocationService.new.full_label(rdf_subject.to_s)
|
|
11
18
|
end
|
|
12
19
|
end
|
|
13
20
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Hyrax
|
|
3
|
+
module ControlledVocabularies
|
|
4
|
+
##
|
|
5
|
+
# adds caching to the {#rdf_label} method.
|
|
6
|
+
#
|
|
7
|
+
# for systems that check the {#rdf_label}and use {#fetch} to get upstream
|
|
8
|
+
# data if it is not present, this can be used to avoid making round trips
|
|
9
|
+
# to an authoritative web source.
|
|
10
|
+
#
|
|
11
|
+
# @see Hyrax::DeepIndexingService
|
|
12
|
+
module ResourceLabelCaching
|
|
13
|
+
CACHE_KEY_PREFIX = "hy_label-v1-"
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
# @note uses the Rails cache to avoid repeated lookups.
|
|
17
|
+
# @see ActiveTriples::Resource#rdf_label
|
|
18
|
+
def rdf_label
|
|
19
|
+
# only cache if this rdf source is represented by a URI;
|
|
20
|
+
# i.e. don't cache for blank nodes
|
|
21
|
+
return super unless uri?
|
|
22
|
+
|
|
23
|
+
Rails.cache.fetch(cache_key) { super }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
##
|
|
27
|
+
# @note adds behavior to clear the cache whenever a manual fetch of data
|
|
28
|
+
# is performed.
|
|
29
|
+
# @see ActiveTriples::Resource#fetch
|
|
30
|
+
def fetch(*)
|
|
31
|
+
Rails.cache.delete(cache_key)
|
|
32
|
+
super
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def cache_key
|
|
38
|
+
"#{CACHE_KEY_PREFIX}#{to_uri.canonicalize.pname}"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
data/lib/hyrax/publisher.rb
CHANGED
|
@@ -94,18 +94,49 @@ module Hyrax
|
|
|
94
94
|
# @macro a_registered_event
|
|
95
95
|
register_event('batch.created')
|
|
96
96
|
|
|
97
|
+
# @since 3.4.0
|
|
98
|
+
# @macro a_registered_event
|
|
99
|
+
register_event('collection.deleted')
|
|
100
|
+
|
|
97
101
|
# @since 3.0.0
|
|
98
102
|
# @macro a_registered_event
|
|
103
|
+
# @note this event SHOULD be published whevener the metadata is saved
|
|
104
|
+
# for a PCDM Collection. the payload for each published event MUST
|
|
105
|
+
# include an `:collection` (the updated Collection) AND a `:user` (the
|
|
106
|
+
# {::User} responsible for the update). the event SHOULD NOT be
|
|
107
|
+
# published for changes that only impact membership properties
|
|
108
|
+
# (`#member_of_ids`, `#member_of_collection_ids`, and `#member_ids`)
|
|
99
109
|
register_event('collection.metadata.updated')
|
|
100
110
|
|
|
101
111
|
# @since 3.0.0
|
|
102
112
|
# @macro a_registered_event
|
|
113
|
+
# @note this event SHOULD be published whevener the membership is changed
|
|
114
|
+
# for a PCDM Collection. this includes changes to the Collection's
|
|
115
|
+
# `#member_ids` attribute, as well as inverse membership changes via
|
|
116
|
+
# another Collection/Object's `#member_of_ids` or
|
|
117
|
+
# `#member_of_collection_ids` attribute. the event payload MUST include
|
|
118
|
+
# either a `:collection` OR a `:collection_id` (the Collection OR its
|
|
119
|
+
# unique id), AND a `:user` (the ::User responsible for the update).
|
|
103
120
|
register_event('collection.membership.updated')
|
|
104
121
|
|
|
122
|
+
# @since 3.5.0
|
|
123
|
+
# @macro a_registered_event
|
|
124
|
+
register_event('file.characterized')
|
|
125
|
+
|
|
105
126
|
# @since 3.3.0
|
|
106
127
|
# @macro a_registered_event
|
|
107
128
|
register_event('file.downloaded')
|
|
108
129
|
|
|
130
|
+
# @since 3.4.0
|
|
131
|
+
# @macro a_registered_event
|
|
132
|
+
# @note this event SHOULD be published whenever a {Hyrax::FileMetadata}
|
|
133
|
+
# object is updated; i.e. whenever the metadata directly associated with
|
|
134
|
+
# a file changes. the event payload MUST include a `:metadata` (the
|
|
135
|
+
# {Hyrax::FileMetadata} that has been updated) AND a `:user`. note that
|
|
136
|
+
# the `:user` responsible for {FileMetadata} changes may frequently be
|
|
137
|
+
# a system user.
|
|
138
|
+
register_event('file.metadata.updated')
|
|
139
|
+
|
|
109
140
|
# @since 3.0.0
|
|
110
141
|
# @macro a_registered_event
|
|
111
142
|
register_event('file.set.audited')
|
|
@@ -138,8 +169,26 @@ module Hyrax
|
|
|
138
169
|
# @macro a_registered_event
|
|
139
170
|
register_event('object.acl.updated')
|
|
140
171
|
|
|
172
|
+
# @since 3.4.0
|
|
173
|
+
# @macro a_registered_event
|
|
174
|
+
# @note this event SHOULD be published whevener the membership is changed
|
|
175
|
+
# for a PCDM Object (including a Hydra Works FileSet). this includes
|
|
176
|
+
# changes to the Object's `#member_ids` attribute, as well as inverse
|
|
177
|
+
# membership changes via another Object's `#member_of_ids` attribute.
|
|
178
|
+
# the event payload MUST include either an `:object` OR an `:object_id`
|
|
179
|
+
# (the Object OR its unique id), AND a `:user` (the ::User responsible
|
|
180
|
+
# for the update).
|
|
181
|
+
register_event('object.membership.updated')
|
|
182
|
+
|
|
141
183
|
# @since 3.0.0
|
|
142
184
|
# @macro a_registered_event
|
|
185
|
+
# @note this event SHOULD be published whevener the metadata is saved
|
|
186
|
+
# for a PCDM Object (including a Hydra Works FileSet). the payload for
|
|
187
|
+
# each published event MUST include an `:object` (the updated Object),
|
|
188
|
+
# AND a `:user` (the ::User responsible for the update). the event
|
|
189
|
+
# SHOULD NOT be published for changes that only impact membership
|
|
190
|
+
# properties (`#member_of_ids`, `#member_of_collection_ids`, and
|
|
191
|
+
# `#member_ids`)
|
|
143
192
|
register_event('object.metadata.updated')
|
|
144
193
|
|
|
145
194
|
# @since 3.2.0
|
data/lib/hyrax/schema.rb
CHANGED
|
@@ -4,24 +4,27 @@ module Hyrax
|
|
|
4
4
|
##
|
|
5
5
|
# @api public
|
|
6
6
|
#
|
|
7
|
-
# Builds a schema module for a Valkyrie
|
|
8
|
-
# resolved by schema loader, which must
|
|
9
|
-
#
|
|
10
|
-
#
|
|
7
|
+
# Builds a schema module for a +Valkyrie::Resource+. The schema itself is
|
|
8
|
+
# resolved by a schema loader instance, which must implement
|
|
9
|
+
# {SimpleSchemaLoader#attributes_for}, with a hash from attribute names to
|
|
10
|
+
# +Dry::Type+ types.
|
|
11
11
|
#
|
|
12
12
|
# For the default schema loader, configuration is loaded from
|
|
13
|
-
#
|
|
14
|
-
#
|
|
13
|
+
# +config/metadata/{name}.yaml+. A custom schema loader can be provided as
|
|
14
|
+
# +:schema_loader+ to
|
|
15
|
+
# resolve the schema in other ways.
|
|
15
16
|
#
|
|
16
|
-
# @note
|
|
17
|
-
# interface, and may define custom attributes using the base
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
# storage, an external schema service,
|
|
17
|
+
# @note +Valkyrie::Resource+ and {Hyrax::Resource} classes are not required to
|
|
18
|
+
# use this interface, and may define custom attributes using the base
|
|
19
|
+
# +Valkyrie::Resource.attribute+ interface. This mechanism is provided to
|
|
20
|
+
# allow schemas to be defined in a unified way that don't require programmer
|
|
21
|
+
# intervention ("configurable schemas"). While the default schema loader derives
|
|
22
|
+
# schemas from configuration files, alternate implementations could provide
|
|
23
|
+
# schema definitions pulled from repository storage, an external schema service,
|
|
24
|
+
# etc...
|
|
23
25
|
#
|
|
24
26
|
# @param [Symbol] schema_name
|
|
27
|
+
# @param [#attributes_for] schema_loader
|
|
25
28
|
#
|
|
26
29
|
# @return [Module] a module that, when included, applies a schema to a
|
|
27
30
|
# `Valkyire::Resource`
|
data/lib/hyrax/specs/capybara.rb
CHANGED
|
@@ -21,7 +21,7 @@ if ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present?
|
|
|
21
21
|
args = %w[disable-gpu no-sandbox whitelisted-ips window-size=1400,1400]
|
|
22
22
|
args.push('headless') if ActiveModel::Type::Boolean.new.cast(ENV['CHROME_HEADLESS_MODE'])
|
|
23
23
|
|
|
24
|
-
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions
|
|
24
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome("goog:chromeOptions" => { args: args })
|
|
25
25
|
|
|
26
26
|
Capybara.register_driver :selenium_chrome_headless_sandboxless do |app|
|
|
27
27
|
driver = Capybara::Selenium::Driver.new(app,
|
|
@@ -135,7 +135,6 @@ RSpec.shared_examples 'a Hyrax::PcdmCollection' do
|
|
|
135
135
|
|
|
136
136
|
it_behaves_like 'a Hyrax::Resource'
|
|
137
137
|
it_behaves_like 'a model with core metadata'
|
|
138
|
-
it_behaves_like 'a model with basic metadata'
|
|
139
138
|
it_behaves_like 'has members'
|
|
140
139
|
|
|
141
140
|
describe '#collection_type_gid' do
|
|
@@ -172,10 +171,12 @@ RSpec.shared_examples 'a Hyrax::AdministrativeSet' do
|
|
|
172
171
|
.to contain_exactly('lorem ipsum')
|
|
173
172
|
end
|
|
174
173
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
describe '#collection_type_gid' do
|
|
175
|
+
let(:gid) { Hyrax::CollectionType.find_or_create_admin_set_type.to_global_id }
|
|
176
|
+
|
|
177
|
+
it 'has a GlobalID for a collection type' do
|
|
178
|
+
expect(admin_set.collection_type_gid).to eq gid
|
|
179
|
+
end
|
|
179
180
|
end
|
|
180
181
|
end
|
|
181
182
|
|
|
@@ -256,6 +257,7 @@ RSpec.shared_examples 'a Hyrax::FileSet' do
|
|
|
256
257
|
|
|
257
258
|
it_behaves_like 'a Hyrax::Resource'
|
|
258
259
|
it_behaves_like 'a model with core metadata'
|
|
260
|
+
it_behaves_like 'a model with basic metadata'
|
|
259
261
|
|
|
260
262
|
it { is_expected.not_to be_collection }
|
|
261
263
|
it { is_expected.not_to be_file }
|
|
@@ -287,6 +289,10 @@ RSpec.shared_examples 'a Hyrax::FileSet' do
|
|
|
287
289
|
expect(fileset.file_ids).to eq file_ids
|
|
288
290
|
end
|
|
289
291
|
|
|
292
|
+
it 'has a representative_id' do
|
|
293
|
+
expect(fileset.representative_id).to eq fileset.id
|
|
294
|
+
end
|
|
295
|
+
|
|
290
296
|
it 'can query files' do
|
|
291
297
|
expect(query_service.custom_queries.find_files(file_set: fileset)).to eq files
|
|
292
298
|
end
|