diff --git a/.env.template b/.env.template index 98f7763d46d5d826138110f3b2b474c84f23bf6a..8a693c3f0acae73836585fcdef3d9bd918bee599 100644 --- a/.env.template +++ b/.env.template @@ -87,6 +87,7 @@ IIIF_SEARCH_ENDPOINT= CONFIG_IIIF_IMAGE_ENDPOINT= # If the rails server is configured to serve requests in https, set this to true IIIF_TO_SERVE_SSL_URLS=false +CRC_FOLDER_IMPORT_PATH=/mnt/rdms_data/RUB/testData # Browse Everything credentials GOOGLE_DRIVE_CLIENT_ID= diff --git a/.env.template.development b/.env.template.development index 91d6af0b0a32fccc719392818b2728daa8e4d670..3539525431d7a9d92d208d1bb7d874b405ff9ff8 100644 --- a/.env.template.development +++ b/.env.template.development @@ -90,6 +90,7 @@ IIIF_SEARCH_ENDPOINT= CONFIG_IIIF_IMAGE_ENDPOINT= # If the rails server is configured to serve requests in https, set this to true IIIF_TO_SERVE_SSL_URLS=false +CRC_FOLDER_IMPORT_PATH=/mnt/rdms_data/RUB/testData # Browse Everything credentials GOOGLE_DRIVE_CLIENT_ID= diff --git a/docker-compose.yml b/docker-compose.yml index 5b0bdf656cbed299fd744f6bb82be6218b9ae41f..be4875b7b10893e29bcf0aa45bb4a027517be06e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -103,6 +103,7 @@ services: web: <<: *app command: bash -c "/bin/docker-entrypoint.sh" + restart: unless-stopped environment: - VIRTUAL_HOST=rdms.docker - VIRTUAL_PORT=3000 diff --git a/hyrax/app/services/prepare_csv_from_crc_folder.rb b/hyrax/app/services/prepare_csv_from_crc_folder.rb index fd47b921a049434437aaf082d39307ae41366397..6c206a72dc6603b8b181b3812b25eb4bb58727d7 100644 --- a/hyrax/app/services/prepare_csv_from_crc_folder.rb +++ b/hyrax/app/services/prepare_csv_from_crc_folder.rb @@ -84,13 +84,24 @@ class PrepareCsvFromCrcFolder ] end + def crc_1280_collection_source_indentifier + collection_type = Hyrax::CollectionType.find_or_create_by(title: 'CRC 1280') + collection_type_gid = "gid://hyrax3-app/Hyrax::CollectionType/#{collection_type.id}" + + crc_1280_collections = collection_type.collections.select{ |t| t.title == ["CRC 1280"] } + + return "" unless crc_1280_collections.any? + + crc_1280_collections.first.source.join + end + def prepare_group_data(group_folder_path, csv) experiment_folders_path = Dir.glob("#{group_folder_path}/*").select { |item| Pathname(item).directory? } title = group_folder_path.split('/').last source_identifier = SecureRandom.uuid - csv << ['Collection', 'CRC 1280', '', source_identifier, '', title] + csv << ['Collection', 'CRC 1280', '', source_identifier, crc_1280_collection_source_indentifier, title] return unless experiment_folders_path.present? diff --git a/hyrax/lib/tasks/create_crc_1280_collection.rake b/hyrax/lib/tasks/create_crc_1280_collection.rake new file mode 100644 index 0000000000000000000000000000000000000000..39597f84ab5c9f5c16b13605da54963634db3807 --- /dev/null +++ b/hyrax/lib/tasks/create_crc_1280_collection.rake @@ -0,0 +1,20 @@ +# frozen_string_literal: true +namespace :rdms do + namespace :crc_1280_collection do + desc "Create CRC 1280 Collection Types and CRC 1280 Collection" + task create: :environment do + collection_type = Hyrax::CollectionType.find_or_create_by(title: 'CRC 1280') + collection_type_gid = "gid://hyrax3-app/Hyrax::CollectionType/#{collection_type.id}" + + crc_1280_collections = collection_type.collections.select{ |t| t.title == ["CRC 1280"] } + + unless crc_1280_collections.any? + collection = Hyrax.config.collection_class.create(title: ['CRC 1280'], source:[SecureRandom.uuid], collection_type_gid: collection_type_gid) + + admin_user = User.find_by(email: 'admin@hyrax') + collection.apply_depositor_metadata(admin_user.user_key) + collection.save + end + end + end +end \ No newline at end of file diff --git a/hyrax/lib/tasks/setup_hyrax.rake b/hyrax/lib/tasks/setup_hyrax.rake index 0f9a38d4efa87bbeb1459a077848971526b389a8..b7eb35c40b6dca392e2ae2a81216970550a1041b 100644 --- a/hyrax/lib/tasks/setup_hyrax.rake +++ b/hyrax/lib/tasks/setup_hyrax.rake @@ -39,6 +39,7 @@ namespace :rdms do Rake::Task['hyrax:default_admin_set:create'].invoke Rake::Task['hyrax:workflow:load'].invoke Rake::Task['hyrax:default_collection_types:create'].invoke + Rake::Task['rdms:crc_1280_collection:create'].invoke ############################################## # Create languages controlled vocabulary