5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-25 03:16:22 +00:00
panel/db/seeds.rb
2024-05-02 16:05:35 -03:00

35 lines
854 B
Ruby

# frozen_string_literal: true
designs = YAML.safe_load(File.read('db/seeds/designs.yml'))
designs.each do |d|
design = Design.find_or_create_by(gem: d['gem'])
design.update d
end
licencias = YAML.safe_load(File.read('db/seeds/licencias.yml'))
licencias.each do |l|
licencia = Licencia.find_or_create_by(icons: l['icons'])
licencia.update l
end
if CodeOfConduct.count.zero?
YAML.safe_load(File.read('db/seeds/codes_of_conduct.yml')).each do |coc|
CodeOfConduct.new(**coc).save!
end
end
if PrivacyPolicy.count.zero?
YAML.safe_load(File.read('db/seeds/privacy_policies.yml')).each do |pp|
PrivacyPolicy.new(**pp).save!
end
end
YAML.safe_load(File.read('db/seeds/activity_pub/fediblocks.yml')).each do |fediblock|
ActivityPub::Fediblock.find_or_create_by(id: fediblock['id']).tap do |f|
f.update(**fediblock)
end
end