diff options
| author | Luc Donnet | 2018-03-12 15:09:55 +0100 | 
|---|---|---|
| committer | GitHub | 2018-03-12 15:09:55 +0100 | 
| commit | 10765f6378777d74b121faf9e6f2a17a9fb1594e (patch) | |
| tree | c6ddba1633e7243d5dab189fd3e199e731d21cc2 /lib/tasks/exports.rake | |
| parent | 43a5e136c1b35483675918120405cd4f5bea3397 (diff) | |
| parent | b7079226c965e7130a2bcc17b7f278a1e23ac7e8 (diff) | |
| download | chouette-core-10765f6378777d74b121faf9e6f2a17a9fb1594e.tar.bz2 | |
Merge pull request #361 from af83/6068-simple-exporter
6068 simple exporter
Diffstat (limited to 'lib/tasks/exports.rake')
| -rw-r--r-- | lib/tasks/exports.rake | 19 | 
1 files changed, 10 insertions, 9 deletions
| diff --git a/lib/tasks/exports.rake b/lib/tasks/exports.rake index 547388b35..845d581d3 100644 --- a/lib/tasks/exports.rake +++ b/lib/tasks/exports.rake @@ -51,6 +51,9 @@ namespace :export do      if journeys.count == 0        puts "No maching journeys were found".red      else +      exports_group = SimpleInterfacesGroup.new "Export Complet \"#{referential.name}\" du #{Time.now.to_date} au #{args[:timelapse].to_i.days.from_now.to_date}" +      exports_group.shared_options = {verbose: true} +        exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_companies", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_companies.json"        ids = journeys.pluck :company_id        ids += journeys.joins(route: :line).pluck :"lines.company_id" @@ -59,39 +62,37 @@ namespace :export do          config.collection = Chouette::Company.where(id: ids.uniq).order('name')        end -      SimpleInterfacesHelper.run_interface_controlling_interruption exporter, :export, args -      break if exporter.status == :error +      exports_group.add_interface exporter, "Services Types", :export        exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_schedules", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_schedules.json"        exporter.configure do |config|          config.collection = journeys        end -      SimpleInterfacesHelper.run_interface_controlling_interruption exporter, :export, args -      break if exporter.status == :error +      exports_group.add_interface exporter, "Schedules", :export        exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_routes", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_routes.json"        exporter.configure do |config|          config.collection = Chouette::JourneyPattern.where(id: journeys.pluck(:journey_pattern_id).uniq)        end -      SimpleInterfacesHelper.run_interface_controlling_interruption exporter, :export, args -      break if exporter.status == :error +      exports_group.add_interface exporter, "Routes", :export        exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_stops", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_stops.json"        exporter.configure do |config|          config.collection = Chouette::StopArea.where(id: journeys.joins(:stop_points).pluck(:"stop_points.stop_area_id").uniq).order('parent_id ASC NULLS FIRST')        end -      SimpleInterfacesHelper.run_interface_controlling_interruption exporter, :export, args -      break if exporter.status == :error +      exports_group.add_interface exporter, "Stops", :export        exporter = SimpleJsonExporter.create configuration_name: "#{args[:configuration_name]}_journeys", filepath: "#{args[:output_dir]}/#{args[:configuration_name]}_journeys.json"        exporter.configure do |config|          config.collection = journeys        end -      SimpleInterfacesHelper.run_interface_controlling_interruption exporter, :export, args +      exports_group.add_interface exporter, "Services", :export + +      exports_group.run      end    end  end | 
