Class: Hyrax::TestDataSeeder
- Inherits:
-
Object
- Object
- Hyrax::TestDataSeeder
- Defined in:
- app/utils/hyrax/test_data_seeder.rb
Overview
This class was created for use in rake tasks and db/seeds.rb. It generates repository metadata needed for release testing. This data can also be helpful for local development testing.
Instance Attribute Summary collapse
-
#allow_seeding_in_production ⇒ Object
Returns the value of attribute allow_seeding_in_production.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #generate_seed_data ⇒ Object
-
#initialize(logger: Logger.new(STDOUT), allow_seeding_in_production: false) ⇒ TestDataSeeder
constructor
A new instance of TestDataSeeder.
Constructor Details
#initialize(logger: Logger.new(STDOUT), allow_seeding_in_production: false) ⇒ TestDataSeeder
Returns a new instance of TestDataSeeder.
10 11 12 13 14 |
# File 'app/utils/hyrax/test_data_seeder.rb', line 10 def initialize(logger: Logger.new(STDOUT), allow_seeding_in_production: false) raise("TestDataSeeder is not for use in production!") if Rails.env.production? && !allow_seeding_in_production @logger = logger @allow_seeding_in_production = allow_seeding_in_production end |
Instance Attribute Details
#allow_seeding_in_production ⇒ Object
Returns the value of attribute allow_seeding_in_production.
8 9 10 |
# File 'app/utils/hyrax/test_data_seeder.rb', line 8 def allow_seeding_in_production @allow_seeding_in_production end |
#logger ⇒ Object
Returns the value of attribute logger.
8 9 10 |
# File 'app/utils/hyrax/test_data_seeder.rb', line 8 def logger @logger end |
Instance Method Details
#generate_seed_data ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/utils/hyrax/test_data_seeder.rb', line 16 def generate_seed_data Hyrax::TestDataSeeders::UserSeeder.generate_seeds(logger: logger, allow_seeding_in_production: allow_seeding_in_production) Hyrax::TestDataSeeders::CollectionTypeSeeder.generate_seeds(logger: logger, allow_seeding_in_production: allow_seeding_in_production) Hyrax::TestDataSeeders::CollectionSeeder.generate_seeds(logger: logger, allow_seeding_in_production: allow_seeding_in_production) # TODO: add work seeder # Hyrax::TestDataSeeders::WorkSeeder.generate_seeds(logger: logger, allow_seeding_in_production: allow_seeding_in_production) end |