Skip to content

Commit

Permalink
import all dois by client
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Dec 26, 2018
1 parent 6e99341 commit 3ecb0e4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/tasks/client.rake
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,27 @@ namespace :client do
end
end

desc 'Import DOIs by client'
task :import_all_dois => :environment do
if ENV['CLIENT_ID'].nil?
puts "ENV['CLIENT_ID'] is required."
exit
end

client = Client.where(deleted_at: nil).where(symbol: ENV['CLIENT_ID']).first
if client.nil?
puts "Client not found for client ID #{ENV['CLIENT_ID']}."
exit
end

# import DOIs for client
puts "#{client.dois.length} DOIs will be imported."
client.dois.find_each do |doi|
Doi.import_one(doi: doi.doi)
puts "DOI #{doi.doi} imported."
end
end

desc 'Index DOIs by client'
task :index_all_dois => :environment do
if ENV['CLIENT_ID'].nil?
Expand Down

0 comments on commit 3ecb0e4

Please sign in to comment.