From 9fdc300b0111611cc9356bf5cdba64ab411d133b Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Wed, 18 Sep 2024 09:54:01 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Add=20rake=20task=20to=20re=20sa?= =?UTF-8?q?ve=20importers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This rake task will allow users to re save all their importers. It accounts for tenants if it is a Hyku application. ```sh bundle exec rake bulkrax:resave_importers ``` --- lib/tasks/bulkrax_tasks.rake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/tasks/bulkrax_tasks.rake b/lib/tasks/bulkrax_tasks.rake index e32d4b89..34f07e5e 100644 --- a/lib/tasks/bulkrax_tasks.rake +++ b/lib/tasks/bulkrax_tasks.rake @@ -141,4 +141,25 @@ namespace :bulkrax do rescue => e puts "(#{e.message})" end + + desc "Update importers" + task update_importers: :environment do + if defined?(::Hyku) + Account.find_each do |account| + next if account.name == "search" + switch!(account) + puts "=============== updating #{account.name} ============" + + update_importers + + puts "=============== finished updating #{account.name} ============" + end + else + update_importers + end + end + + def update_importers + Bulkrax::Importer.all(&:save) + end end