Skip to content

Commit

Permalink
Merge pull request #274 from notch8/update-submodule-2024-11
Browse files Browse the repository at this point in the history
Update Hyku submodule & custom work types
  • Loading branch information
bkiahstroud authored Feb 25, 2025
2 parents 5760bb6 + 9378c51 commit be69aa7
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 35 deletions.
2 changes: 1 addition & 1 deletion app/forms/mobius_work_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# @see https://github.com/samvera/hyrax/wiki/Hyrax-Valkyrie-Usage-Guide#forms
# @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking
class MobiusWorkForm < Hyrax::Forms::PcdmObjectForm(MobiusWork)
class MobiusWorkForm < Hyrax::Forms::ResourceForm(MobiusWork)
include Hyrax::FormFields(:basic_metadata)
include Hyrax::FormFields(:mobius_work)
include Hyrax::FormFields(:with_pdf_viewer)
Expand Down
10 changes: 9 additions & 1 deletion app/forms/unca_work_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
#
# @see https://github.com/samvera/hyrax/wiki/Hyrax-Valkyrie-Usage-Guide#forms
# @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking
class UncaWorkForm < Hyrax::Forms::PcdmObjectForm(UncaWork)
class UncaWorkForm < Hyrax::Forms::ResourceForm(UncaWork)
# include Hyrax::FormFields(:basic_metadata)
include Hyrax::FormFields(:unca_work)
include Hyrax::FormFields(:with_pdf_viewer)
include Hyrax::FormFields(:with_video_embed)
include VideoEmbedBehavior::Validation
# Hyrax expects :based_near to be included via the :basic_metadata. Since we've included
# it via the :unca_work schema (in order to customize it's default metadata), we need to
# include the based_near behavior manually.
include BasedNearFormFieldsBehavior
# Define custom form fields using the Valkyrie::ChangeSet interface
#
# property :my_custom_form_field
Expand Down
2 changes: 1 addition & 1 deletion app/indexers/mobius_work_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Generated via
# `rails generate hyrax:work_resource MobiusWork`
class MobiusWorkIndexer < Hyrax::Indexers::PcdmObjectIndexer(MobiusWork)
class MobiusWorkIndexer < Hyrax::ValkyrieWorkIndexer
include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:mobius_work)
include Hyrax::Indexer(:with_pdf_viewer)
Expand Down
6 changes: 5 additions & 1 deletion app/indexers/unca_work_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

# Generated via
# `rails generate hyrax:work_resource UncaWork`
class UncaWorkIndexer < Hyrax::Indexers::PcdmObjectIndexer(UncaWork)
class UncaWorkIndexer < Hyrax::ValkyrieWorkIndexer
# Basic metadata has been included via :unca_work so we can customize it
# include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:unca_work)
include Hyrax::Indexer(:with_pdf_viewer)
include Hyrax::Indexer(:with_video_embed)

include HykuIndexing
# Uncomment this block if you want to add custom indexing behavior:
Expand Down
5 changes: 5 additions & 0 deletions app/models/mobius_work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ class MobiusWork < Hyrax::Work
include Hyrax::ArResource
include Hyrax::NestedWorks

include IiifPrint.model_configuration(
pdf_split_child_model: GenericWorkResource,
pdf_splitter_service: IiifPrint::TenantConfig::PdfSplitter
)

prepend OrderAlready.for(:creator)
end
13 changes: 13 additions & 0 deletions app/models/unca_work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,18 @@
# Generated via
# `rails generate hyrax:work_resource UncaWork`
class UncaWork < Hyrax::Work
# Basic metadata has been included via :unca_work so we can customize it
# include Hyrax::Schema(:basic_metadata)
include Hyrax::Schema(:unca_work)
include Hyrax::Schema(:with_pdf_viewer)
include Hyrax::Schema(:with_video_embed)
include Hyrax::ArResource
include Hyrax::NestedWorks

include IiifPrint.model_configuration(
pdf_split_child_model: GenericWorkResource,
pdf_splitter_service: IiifPrint::TenantConfig::PdfSplitter
)

prepend OrderAlready.for(:creator)
end
28 changes: 1 addition & 27 deletions config/initializers/bulkrax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,7 @@

# Ensure Knapsack version gets loaded after Hyku's bulkrax.rb
Rails.application.config.after_initialize do
# OVERRIDE Bulkrax v5.4.1
# Override default split regex to only split on unescaped comma and pipe chars
Bulkrax.instance_variable_set(:@multi_value_element_split_on, /\s*(?<!\\)[,|]\s*/)

Bulkrax.setup do |config|
hyku_csv_field_mappings = config.field_mappings['Bulkrax::CsvParser']

config.field_mappings['Bulkrax::CsvParser'] = hyku_csv_field_mappings.merge(
{
'contributor' => { from: %w[sm_contributor contributor], split: true },
'creator' => { from: %w[sm_creator creator], split: true },
'date_created' => { from: %w[sm_date date_created], split: true },
'description' => { from: %w[tm_description description], split: true },
'identifier' => { from: %w[identifier], split: true, source_identifier: true },
'language' => { from: %w[sm_language language], split: true },
'parents' => { from: %w[sm_collection parents], split: true, related_parents_field_mapping: true },
'publisher' => { from: %w[sm_publisher publisher], split: true },
'resource_type' => { from: %w[sm_type resource_type], split: true },
'source' => { from: %w[sm_source source], split: true },
'subject' => { from: %w[sm_subject subject], split: true },
'title' => { from: %w[sm_title title], split: true },
# Custom property mappings
'coverage' => { from: %w[sm_coverage coverage], split: true },
'file_format' => { from: %w[sm_format file_format], split: true },
'relation' => { from: %w[sm_relation relation], split: true },
'rights' => { from: %w[sm_rights rights], split: true }
}
)
config.fill_in_blank_source_identifiers = ->(parser, index) { "#{Site.account.name}-#{parser.importerexporter.id}-#{index}" }
end
end
2 changes: 1 addition & 1 deletion hyrax-webapp
Submodule hyrax-webapp updated 229 files
4 changes: 3 additions & 1 deletion ops/production-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ extraEnvVars: &envVars
# - name: GOOGLE_OAUTH_CLIENT_EMAIL
# value: [email protected]
- name: HYRAX_ACTIVE_JOB_QUEUE
value: sidekiq
value: good_job
- name: HYRAX_FITS_PATH
value: /app/fits/fits.sh
- name: HYRAX_VALKYRIE
Expand Down Expand Up @@ -216,6 +216,8 @@ extraEnvVars: &envVars
value: testing123
- name: VALKYRIE_ID_TYPE
value: string
- name: VALKYRIE_TRANSITION
value: "true"

podSecurityContext: &podSecValues
runAsUser: 1001
Expand Down
4 changes: 3 additions & 1 deletion ops/staging-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ extraEnvVars: &envVars
- name: REDIS_URL
value: redis://:$REDIS_PASSWORD@hykuup-knapsack-staging-redis-master:6379/staging
- name: HYRAX_ACTIVE_JOB_QUEUE
value: sidekiq
value: good_job
- name: HYRAX_ANALYTICS
value: "false"
- name: HYRAX_FITS_PATH
Expand Down Expand Up @@ -201,6 +201,8 @@ extraEnvVars: &envVars
value: testing123
- name: VALKYRIE_ID_TYPE
value: string
- name: VALKYRIE_TRANSITION
value: "true"

worker:
replicaCount: 1
Expand Down
2 changes: 1 addition & 1 deletion spec/indexers/mobius_work_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

RSpec.describe MobiusWorkIndexer do
let(:indexer_class) { described_class }
let(:resource) { MobiusWork.new }
let!(:resource) { Hyrax.persister.save(resource: MobiusWork.new) }

it_behaves_like 'a Hyrax::Resource indexer'
end
13 changes: 13 additions & 0 deletions spec/indexers/unca_work_indexer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

# Generated via
# `rails generate hyrax:work_resource UncaWork`
require 'rails_helper'
require 'hyrax/specs/shared_specs/indexers'

RSpec.describe UncaWorkIndexer do
let(:indexer_class) { described_class }
let!(:resource) { Hyrax.persister.save(resource: UncaWork.new) }

it_behaves_like 'a Hyrax::Resource indexer'
end

0 comments on commit be69aa7

Please sign in to comment.