Skip to content

Commit

Permalink
🤖 Add rake task to re save importers
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
kirkkwang committed Sep 18, 2024
1 parent 7011d72 commit 4c2ce7c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/tasks/bulkrax_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,27 @@ namespace :bulkrax do
rescue => e
puts "(#{e.message})"
end

desc "Resave importers"
task resave_importers: :environment do
if defined?(::Hyku)
Account.find_each do |account|
next if account.name == "search"
switch!(account)
puts "=============== updating #{account.name} ============"

resave_importers

puts "=============== finished updating #{account.name} ============"
end
else
resave_importers
end
end

def resave_importers
Bulkrax::Importer.find_each do |importer|
importer.save!
end
end
end

0 comments on commit 4c2ce7c

Please sign in to comment.