Skip to content

Commit

Permalink
Merge pull request #627 from datacite/add_update_dois_rake
Browse files Browse the repository at this point in the history
Add rake task to trigger updatedois based on query
  • Loading branch information
richardhallett authored Sep 15, 2020
2 parents a9056c5 + 562fc86 commit 324daa5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/tasks/doi.rake
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,24 @@ namespace :doi do
Doi.loop_through_dois(options)
end

desc "Trigger DOI Update based on query"
task update_dois_by_query: :environment do
# Ensure we have to specify a query of some kind.
if ENV['QUERY'].nil?
puts "ENV['QUERY'] is required"
exit
end

options = {
query: ENV["QUERY"],
label: "[UpdateDoiByQuery]",
job_name: "UpdateDoiJob",
cursor: ENV["CURSOR"].present? ? Base64.urlsafe_decode64(ENV["CURSOR"]).split(",", 2) : [],
}
puts Doi.loop_through_dois(options)
end


# until all Crossref DOIs are indexed as otherDoi
desc "Refresh metadata"
task refresh: :environment do
Expand Down

0 comments on commit 324daa5

Please sign in to comment.