demarches-normaliennes/lib/tasks/deployment/20211116140232_populate_zones.rake
Christophe Robillard 5b8d872b6e populate zones
2021-12-02 19:16:11 +01:00

17 lines
724 B
Ruby

namespace :after_party do
desc 'Deployment task: populate_zones'
task populate_zones: :environment do
puts "Running deploy task 'populate_zones'"
Zone.create!(acronym: 'COLLECTIVITE', label: 'Collectivité territoriale')
config = Psych.safe_load(File.read(Rails.root.join("config", "zones.yml")))
config["ministeres"].each do |ministere|
acronym = ministere.keys.first
Zone.create!(acronym: acronym, label: ministere["label"])
end
# Update task as completed. If you remove the line below, the task will
# run with every deploy (or every time you call after_party:run).
AfterParty::TaskRecord
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
end
end