diff options
| author | Xinhui | 2016-02-22 14:17:18 +0100 | 
|---|---|---|
| committer | Xinhui | 2016-02-22 14:17:18 +0100 | 
| commit | d49f47b4ac1db2cd88b96d830772bb7773924601 (patch) | |
| tree | 191c7b9cda9edf939792e7780df4e7460d685a4a /app/models/chouette/exporter.rb | |
| parent | 633004afc5861a6e8158948ddfecd73bf4dd86a8 (diff) | |
| download | chouette-core-d49f47b4ac1db2cd88b96d830772bb7773924601.tar.bz2 | |
Merge model from ninoxe gem
Diffstat (limited to 'app/models/chouette/exporter.rb')
| -rw-r--r-- | app/models/chouette/exporter.rb | 32 | 
1 files changed, 32 insertions, 0 deletions
| diff --git a/app/models/chouette/exporter.rb b/app/models/chouette/exporter.rb new file mode 100644 index 000000000..df85a9dde --- /dev/null +++ b/app/models/chouette/exporter.rb @@ -0,0 +1,32 @@ +class Chouette::Exporter + +  attr_reader :schema + +  def initialize(schema) +    @schema = schema +  end + +  def chouette_command +    @chouette_command ||= Chouette::Command.new(:schema => schema) +  end + +  def export(file, options = {}) +    options = { +      :format => :neptune +    }.merge(options) + +    command_options = { +      :c => "export",  +      :o => "line",  +      :format => options.delete(:format).to_s.upcase,  +      :output_file => File.expand_path(file),  +      :optimize_memory => true +    }.merge(options) + +    logger.info "Export #{file} in schema #{schema}" +    chouette_command.run! command_options +  end + +  include Chouette::CommandLineSupport + +end | 
