Class: Hyrax::TestDataSeeders::CollectionSeeder
- Inherits:
-
Object
- Object
- Hyrax::TestDataSeeders::CollectionSeeder
- Defined in:
- app/utils/hyrax/test_data_seeders/collection_seeder.rb
Overview
TODO:
Do we want to assume that if a collection of the same name exists, then it is the collection we want for release testing?
This class was created for use in rake tasks and db/seeds.rb. It generates collection that can be used in release testing. This data can also be helpful for local development testing.
Adding collections is non-destructive. But it may create an additional collection of the same.
Defined Under Namespace
Classes: NullUser
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
-
.generate_seeds(logger: Logger.new(STDOUT), allow_seeding_in_production: false) ⇒ Object
rubocop:disable Metrics/AbcSize.
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
15 16 17 |
# File 'app/utils/hyrax/test_data_seeders/collection_seeder.rb', line 15 def logger @logger end |
Class Method Details
.generate_seeds(logger: Logger.new(STDOUT), allow_seeding_in_production: false) ⇒ Object
rubocop:disable Metrics/AbcSize
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/utils/hyrax/test_data_seeders/collection_seeder.rb', line 17 def generate_seeds(logger: Logger.new(STDOUT), allow_seeding_in_production: false) # rubocop:disable Metrics/AbcSize raise("TestDataSeeders are not for use in production!") if Rails.env.production? && !allow_seeding_in_production @logger = logger logger.info("Adding collections...") create_collection("Grand Parent Collection", collection_types['Nestable only']) create_collection("Parent Collection", collection_types['Nestable only']) create_collection("Child Collection", collection_types['Nestable only']) create_collection("Branded Collection", collection_types['Brandable only']) create_collection("Discoverable Collection", collection_types['Discoverable only']) create_collection("Shared", collection_types['Sharable only']) create_collection("Share Applies to Works", collection_types['Sharable only (and works)']) create_collection("(SM1) Single Membership Collection", collection_types['Single Membership 1']) create_collection("(SM1) Another Single Membership Collection", collection_types['Single Membership 1']) create_collection("(SM2) Single Membership Collection", collection_types['Single Membership 2']) create_collection("(SM2) Another Single Membership Collection", collection_types['Single Membership 2']) end |