5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 15:56:20 +00:00
panel/db/seeds.rb
2020-09-12 12:29:43 -03:00

27 lines
712 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
unless Rails.env.test?
YAML.safe_load(File.read('db/seeds/sites.yml')).each do |site|
site = Site.find_or_create_by name: site['name']
site.update licencia: Licencia.first, design: Design.first,
title: site.name, description: 'x' * 50,
deploys: site.deploys.empty? ? [DeployLocal.new] : site.deploys
end
end