From 5bda50a7530b5c50925d233e2c4cea04a8b36529 Mon Sep 17 00:00:00 2001 From: Andreas Haller Date: Mon, 27 Jul 2015 22:57:32 +0200 Subject: [PATCH] Rename import task to import_papers --- README.md | 2 +- lib/tasks/import_papers.rake | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9be643f..29bc41a 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,4 @@ Adding a scraper manually: 2. `Import.create(url: "https://api.morph.io/[scraper]/data.json?key=[api_key]&query=[sql]")` 3. `exit` -Now import everything via `bundle exec rake import_papers:from_morph`. +Now import everything via `bundle exec rake import_papers`. diff --git a/lib/tasks/import_papers.rake b/lib/tasks/import_papers.rake index 31abc45..28f77b0 100644 --- a/lib/tasks/import_papers.rake +++ b/lib/tasks/import_papers.rake @@ -1,10 +1,8 @@ -namespace :import_papers do - desc 'Import Paper records from CSV' - task :from_morph => :environment do - require 'open-uri' - Importer.all.each do |importer| - uri = URI.parse(importer.url) - Paper.import_from_json(uri.read) - end +desc 'Import Paper records from setup importers' +task import_papers: :environment do + require 'open-uri' + Importer.all.each do |importer| + uri = URI.parse(importer.url) + Paper.import_from_json(uri.read) end end