diff options
| -rw-r--r-- | app/models/simple_importer.rb | 3 | ||||
| -rw-r--r-- | lib/tasks/imports.rake | 6 | 
2 files changed, 5 insertions, 4 deletions
| diff --git a/app/models/simple_importer.rb b/app/models/simple_importer.rb index e23b3e524..6f0b8d7a8 100644 --- a/app/models/simple_importer.rb +++ b/app/models/simple_importer.rb @@ -1,3 +1,4 @@ +# coding: utf-8  class SimpleImporter < SimpleInterface    def resolve col_name, value, &block      val = block.call(value) @@ -40,7 +41,7 @@ class SimpleImporter < SimpleInterface    end    def dump_csv_from_context -    dir = context[:output_dir] || "log/importers" +    dir = context[:logs_output_dir] || "log/importers"      filepath = File.join dir, "#{self.configuration_name}_#{Time.now.strftime "%y%m%d%H%M"}.csv"      # for some reason, context[:csv].to_csv does not work      CSV.open(filepath, 'w') do |csv| diff --git a/lib/tasks/imports.rake b/lib/tasks/imports.rake index cd9217e5a..7162f2ada 100644 --- a/lib/tasks/imports.rake +++ b/lib/tasks/imports.rake @@ -31,7 +31,7 @@ namespace :import do    end    desc "import the given file with the corresponding importer in the given StopAreaReferential" -  task :import_in_stop_area_referential, [:referential_id, :configuration_name, :filepath] => :environment do |t, args| +  task :import_in_stop_area_referential, [:referential_id, :configuration_name, :filepath, :logs_output_dir] => :environment do |t, args|      args.with_defaults(logs_output_dir: "./log/importers/")      FileUtils.mkdir_p args[:logs_output_dir] @@ -46,7 +46,7 @@ namespace :import do    end    desc "import the given routes files" -  task :import_routes, [:referential_id, :configuration_name, :mapping_filepath, :filepath] => :environment do |t, args| +  task :import_routes, [:referential_id, :configuration_name, :mapping_filepath, :filepath, :logs_output_dir] => :environment do |t, args|      args.with_defaults(logs_output_dir: "./log/importers/")      FileUtils.mkdir_p args[:logs_output_dir] @@ -56,7 +56,7 @@ namespace :import do      importer = SimpleImporter.create configuration_name: args[:configuration_name], filepath: args[:filepath]      importer.configure do |config|        config.add_value :stop_area_referential, referential -      config.context = {stop_area_referential: stop_area_referential, mapping_filepath: args[:mapping_filepath], logs_output_dir: args[:logs_output_dir]} +      config.context = {stop_area_referential: stop_area_referential, line_referential: line_referential, mapping_filepath: args[:mapping_filepath], logs_output_dir: args[:logs_output_dir]}      end      SimpleInterfacesHelper.run_interface_controlling_interruption importer, :import, args | 
