docbrown/lib/tasks/app_initializer.rake
Michael Kohl 6dfabd578f
Rename SiteConfig to Settings::General (#13573)
* Rename SiteConfig

* More renaming

* Update spec

* Update mandatory settings mapping

* More renaming

* e2e test fixes

* You have a rename, and you have a rename

* Spec fix

* More changes

* Temporarily disable specs

* After-merge update

* Undo rename for migration

* undo rename of DUS

* Fix DUS

* Fix merge problem

* Remove redundant DUS

* Fix specs

* Remove unused code

* Change wrong class name

* More cleanup

* Re-add missing values to constant

* Fix constant

* Fix spec

* Remove obsolete fields

* Add accidentally removed field

* Update spec

* Move methods from Settings::General to ForemInstance

* Remove unneeded model

* Change mentions of 'site config'
2021-05-21 14:45:37 +02:00

25 lines
916 B
Ruby

namespace :app_initializer do
desc "Prepare Application on Boot Up"
task setup: :environment do
puts "\n== Preparing database =="
system("bin/rails db:prepare") || exit!(1)
Rake::Task["db:migrate"].execute # it'll re-alphabetize the columns in `schema.rb`
puts "\n== Updating Data =="
Rake::Task["data_updates:enqueue_data_update_worker"].execute
puts "\n== Bust Caches =="
Rake::Task["cache:enqueue_path_bust_workers"].execute
Settings::General.health_check_token ||= SecureRandom.hex(10)
end
end
if ENV["ENABLE_HYPERSHIELD"].present?
# enhance must be passed a block here to ensure that our hypershield task
# runs AFTER db:prepare. Passing it as an argument will cause it to run BEFORE
# https://ruby-doc.org/stdlib-2.0.0/libdoc/rake/rdoc/Rake/Task.html#method-i-enhance
Rake::Task["db:prepare"].enhance do
Rake::Task["hypershield:refresh"].execute
end
end