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 authored and ShanaLMoore committed Sep 18, 2024
1 parent 7011d72 commit 9fdc300
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/tasks/bulkrax_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9fdc300

Please sign in to comment.