This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
2018-12-01 18:42:36 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
country_states_filename = Rails.root.join 'config', 'country_states.txt'
|
|
|
|
|
|
|
|
country_state_names = File.readlines(country_states_filename).map(&:strip)
|
|
|
|
|
|
|
|
country_state_names.each do |name|
|
|
|
|
next if CountryState.where(name: name).exists?
|
|
|
|
|
|
|
|
CountryState.create! name: name
|
|
|
|
end
|
2018-12-04 01:57:16 +00:00
|
|
|
|
2018-12-09 03:56:06 +00:00
|
|
|
Rails.application.settings(:superuser).tap do |config|
|
2018-12-09 03:07:39 +00:00
|
|
|
User.where(email: config[:email]).first_or_create! do |new_user|
|
|
|
|
new_user.password = config[:password]
|
2018-12-09 02:14:33 +00:00
|
|
|
new_user.confirmed_at = Time.zone.now
|
2019-02-01 23:09:59 +00:00
|
|
|
new_user.account = Account.create!(
|
|
|
|
username: config[:username],
|
|
|
|
public_name: config[:public_name],
|
|
|
|
biography: config[:biography],
|
|
|
|
)
|
2018-12-09 02:14:33 +00:00
|
|
|
end.account.add_role :superuser
|
|
|
|
end
|