lib/tasks/spotlight_tasks.rake in blacklight-spotlight-3.3.0 vs lib/tasks/spotlight_tasks.rake in blacklight-spotlight-3.4.0
- old
+ new
@@ -14,10 +14,22 @@
task admin: :environment do
u = prompt_to_create_user
Spotlight::Role.create(user: u, resource: Spotlight::Site.instance, role: 'admin')
end
+ task seed_admin_user: [:environment] do
+ email = 'admin@localhost'
+ password = 'testing'
+
+ u = Spotlight::Engine.user_class.find_or_create_by!(email: email) do |user|
+ user.password = password
+ end
+ Spotlight::Role.create(user: u, resource: Spotlight::Site.instance, role: 'admin')
+
+ puts "Admin user created with email: #{email} (password: '#{password}')"
+ end
+
desc 'Create a new exhibit'
task exhibit: :environment do
title = prompt_for_title
slug = prompt_for_slug
@@ -155,8 +167,16 @@
end
exhibits.find_each do |e|
puts " == Reindexing #{e.title} =="
e.reindex_later
+ end
+ end
+
+ task db_ready: :environment do
+ if I18n::Backend::ActiveRecord::Translation.table_exists?
+ exit 0
+ else
+ exit 1
end
end
end