Skip to content
Snippets Groups Projects
Commit 8b21702d authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

Also modify rake task to read collection title from config file

parent cae35691
Branches
Tags
3 merge requests!115Tombstone not available for dataset,!77Bump ruby v2.7.7,!26Feature/s3 storage
Pipeline #4706 failed
...@@ -3,13 +3,14 @@ namespace :rdms do ...@@ -3,13 +3,14 @@ namespace :rdms do
namespace :crc_1280_collection do namespace :crc_1280_collection do
desc "Create CRC 1280 Collection Types and CRC 1280 Collection" desc "Create CRC 1280 Collection Types and CRC 1280 Collection"
task create: :environment do task create: :environment do
collection_type = Hyrax::CollectionType.find_or_create_by(title: 'CRC 1280') crc_collection_title = ENV.fetch('CRC_1280_COLLECTION', "CRC 1280")
collection_type = Hyrax::CollectionType.find_or_create_by(title: crc_collection_title)
collection_type_gid = "gid://hyrax3-app/Hyrax::CollectionType/#{collection_type.id}" collection_type_gid = "gid://hyrax3-app/Hyrax::CollectionType/#{collection_type.id}"
crc_1280_collections = collection_type.collections.select{ |t| t.title == ["CRC 1280"] } crc_1280_collections = collection_type.collections.select{ |t| t.title == [crc_collection_title] }
unless crc_1280_collections.any? unless crc_1280_collections.any?
collection = Hyrax.config.collection_class.create(title: ['CRC 1280'], source:[SecureRandom.uuid], collection_type_gid: collection_type_gid) collection = Hyrax.config.collection_class.create(title: [crc_collection_title], source:[SecureRandom.uuid], collection_type_gid: collection_type_gid)
admin_user = User.find_by(email: 'admin@hyrax') admin_user = User.find_by(email: 'admin@hyrax')
collection.apply_depositor_metadata(admin_user.user_key) collection.apply_depositor_metadata(admin_user.user_key)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment