From 8732cb4306d8bb1277df49693fede3675bf58e0b Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Fri, 9 Oct 2020 14:51:14 +0200 Subject: [PATCH] Add import_one task This is an old task to directly import specific DOI This is useful when dealing with older metadata that is only available in the DB and not the ES index. --- lib/tasks/doi.rake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/tasks/doi.rake b/lib/tasks/doi.rake index 4c24e5bb2..c3864c45a 100644 --- a/lib/tasks/doi.rake +++ b/lib/tasks/doi.rake @@ -171,6 +171,16 @@ namespace :doi do puts Doi.loop_through_dois(options) end + desc 'Import one DOI' + task :import_one => :environment do + if ENV['DOI'].nil? + puts "ENV['DOI'] is required" + exit + end + + Doi.import_one(doi_id: ENV['DOI']) + end + desc "Trigger DOI import based on query" task import_dois_by_query: :environment do # Ensure we have specified a query of some kind.