Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix broken staging seed script #771

Merged
merged 9 commits into from
Mar 4, 2025
22 changes: 12 additions & 10 deletions lib/seed/dev_starter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ module Seed
class DevStarter
include Seed::Constants

def self.call
new.call
end

def call
puts "Seeding database..."

ActiveRecord::Base.transaction do
self.class.send(:create_admin_user)
self.class.send(:create_owner_user)
self.class.send(:create_developer_user)
create_admin_user
create_owner_user
create_developer_user
end

puts "Completed seeding database"
end

def self.create_admin_user
private

def create_admin_user
email_authentication = Accounts::EmailAuthentication.find_or_initialize_by(email: ADMIN_EMAIL)
admin = true

Expand All @@ -28,7 +34,7 @@ def self.create_admin_user
puts "Added/updated admin user."
end

def self.create_owner_user
def create_owner_user
email_authentication = Accounts::EmailAuthentication.find_or_initialize_by(email: OWNER_EMAIL)

if email_authentication.persisted?
Expand All @@ -54,7 +60,7 @@ def self.create_owner_user
puts "Added/updated owner user."
end

def self.create_developer_user
def create_developer_user
email_authentication = Accounts::EmailAuthentication.find_or_initialize_by(email: DEVELOPER_EMAIL)

if email_authentication.persisted?
Expand All @@ -79,10 +85,6 @@ def self.create_developer_user

puts "Added/updated developer user."
end

private_class_method :create_admin_user
private_class_method :create_owner_user
private_class_method :create_developer_user
end
end

Expand Down