mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
Rename import task to import_papers
This commit is contained in:
parent
ae8ff0e95e
commit
5bda50a753
2 changed files with 7 additions and 9 deletions
|
@ -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`.
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue