diff options
| author | Zog | 2018-01-30 20:49:24 +0100 | 
|---|---|---|
| committer | Johan Van Ryseghem | 2018-02-20 09:50:28 +0100 | 
| commit | beadf103e66f752706e9bf16931e80dc1629c1db (patch) | |
| tree | e4e50ed8617c919ab97230cf5429835aeeda7128 /lib/tasks | |
| parent | 51e08724766bf2ca4837436178984c33d22cf16a (diff) | |
| download | chouette-core-beadf103e66f752706e9bf16931e80dc1629c1db.tar.bz2 | |
Refs #5765; Add new task to import in a given referential
Diffstat (limited to 'lib/tasks')
| -rw-r--r-- | lib/tasks/imports.rake | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/lib/tasks/imports.rake b/lib/tasks/imports.rake index 006945c07..e79787929 100644 --- a/lib/tasks/imports.rake +++ b/lib/tasks/imports.rake @@ -16,4 +16,16 @@ namespace :import do      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 + +  desc "import the given file with the corresponding importer in the given StopAreaReferential" +  task :import_stop_areas_in_referential, [:referential_id, :configuration_name, :filepath] => :environment do |t, args| +    referential = StopAreaReferential.find args[:referential_id] +    importer = SimpleImporter.create configuration_name: args[:configuration_name], filepath: args[:filepath] +    importer.configure do |config| +      config.add_value :stop_area_referential, referential +    end +    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 | 
