Rename import task to import_papers

This commit is contained in:
Andreas Haller 2015-07-27 22:57:32 +02:00
parent ae8ff0e95e
commit 5bda50a753
2 changed files with 7 additions and 9 deletions

View file

@ -21,4 +21,4 @@ Adding a scraper manually:
2. `Import.create(url: "https://api.morph.io/[scraper]/data.json?key=[api_key]&query=[sql]")` 2. `Import.create(url: "https://api.morph.io/[scraper]/data.json?key=[api_key]&query=[sql]")`
3. `exit` 3. `exit`
Now import everything via `bundle exec rake import_papers:from_morph`. Now import everything via `bundle exec rake import_papers`.

View file

@ -1,10 +1,8 @@
namespace :import_papers do desc 'Import Paper records from setup importers'
desc 'Import Paper records from CSV' task import_papers: :environment do
task :from_morph => :environment do require 'open-uri'
require 'open-uri' Importer.all.each do |importer|
Importer.all.each do |importer| uri = URI.parse(importer.url)
uri = URI.parse(importer.url) Paper.import_from_json(uri.read)
Paper.import_from_json(uri.read)
end
end end
end end