diff options
| author | Zog | 2018-01-30 16:49:22 +0100 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-02-20 09:50:28 +0100 |
| commit | 51e08724766bf2ca4837436178984c33d22cf16a (patch) | |
| tree | 247dc64ac91662e22c6f953ba8e14632fc3a983c /lib | |
| parent | a01519fc871e22a220157cfa8c8d6d5b5c80f5cb (diff) | |
| download | chouette-core-51e08724766bf2ca4837436178984c33d22cf16a.tar.bz2 | |
Refs #5765 @6h; Add a customizable importer mechanism
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tasks/imports.rake | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/tasks/imports.rake b/lib/tasks/imports.rake index 02e32fd3d..006945c07 100644 --- a/lib/tasks/imports.rake +++ b/lib/tasks/imports.rake @@ -8,4 +8,12 @@ namespace :import do task netex_abort_old: :environment do NetexImport.abort_old end + + desc "import the given file with the corresponding importer" + task :import, [:configuration_name, :filepath] => :environment do |t, args| + importer = SimpleImporter.create configuration_name: args[:configuration_name], filepath: args[:filepath] + puts "\e[33m***\e[0m Start importing" + importer.import(verbose: true) + puts "\n\e[33m***\e[0m Import done, status: " + (importer.status == "success" ? "\e[32m" : "\e[31m" ) + importer.status + "\e[0m" + end end |
