diff --git a/hyrax/lib/tasks/create_crc_1280_collection.rake b/hyrax/lib/tasks/create_crc_1280_collection.rake index 39597f84ab5c9f5c16b13605da54963634db3807..cb7db1990d6d890c59ce3e49d851f94cab31adc7 100644 --- a/hyrax/lib/tasks/create_crc_1280_collection.rake +++ b/hyrax/lib/tasks/create_crc_1280_collection.rake @@ -3,13 +3,14 @@ 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') + 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}" - 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? - 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') collection.apply_depositor_metadata(admin_user.user_key)