5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-14 23:21:42 +00:00
panel/db/seeds.rb

28 lines
712 B
Ruby
Raw Permalink Normal View History

2019-03-26 15:32:20 +00:00
# frozen_string_literal: true
2019-07-17 22:18:48 +00:00
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
2019-07-17 22:18:48 +00:00
end
2019-07-19 22:37:53 +00:00
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
2019-07-19 22:37:53 +00:00
end
2019-09-07 00:58:52 +00:00
2020-02-18 16:45:08 +00:00
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,
2020-09-12 15:29:43 +00:00
deploys: site.deploys.empty? ? [DeployLocal.new] : site.deploys
2020-02-18 16:45:08 +00:00
end
2019-09-07 00:58:52 +00:00
end