Class: Hyrax::RequiredDataSeeders::CollectionTypeSeeder

Inherits:
Object
  • Object
show all
Defined in:
app/utils/hyrax/required_data_seeders/collection_type_seeder.rb

Overview

This class was created for use in rake tasks and db/seeds.rb. It generates collection types that are required for all Hyrax applications.

Seeders of required data are non-destructive. If the data already exists, it will not be replaced.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



11
12
13
# File 'app/utils/hyrax/required_data_seeders/collection_type_seeder.rb', line 11

def logger
  @logger
end

Class Method Details

.generate_seeds(logger: Logger.new(STDOUT)) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/utils/hyrax/required_data_seeders/collection_type_seeder.rb', line 13

def generate_seeds(logger: Logger.new(STDOUT))
  @logger = logger

  logger.info("Adding required collection types...")

  as_ct = Hyrax::CollectionType.find_or_create_admin_set_type
  set_badge_color(as_ct, '#990000')
  logger.info("   #{as_ct.title} -- FOUND OR CREATED")

  user_ct = Hyrax::CollectionType.find_or_create_default_collection_type
  set_badge_color(user_ct, '#0099cc')
  logger.info("   #{user_ct.title} -- FOUND OR CREATED")
end