Sha256: bc02b57bc73641bd7bfbd4d9a88a9257e6fee1aaf771eb1e9091f15888e61be2

Contents?: true

Size: 1.02 KB

Versions: 23

Compression:

Stored size: 1.02 KB

Contents

class Chouette::FileValidator

  attr_reader :schema, :database, :user, :password, :host

  def initialize(schema)
    @schema = schema

    Chouette::ActiveRecord.connection_pool.spec.config.tap do |config|
      @database = config[:database]
      @user = config[:username]
      @password = config[:password]
      @host = (config[:host] or "localhost")
    end
  end

  def self.chouette_command=(command)
    Chouette::Command.command = command
  end

  class << self
    deprecate :chouette_command= => "Use Chouette::Command.command ="
  end

  def chouette_command
    @chouette_command ||= Chouette::Command.new(:schema => schema)
  end

  def validate(file, options = {})
    options = {
      :format => :neptune
    }.merge(options)

    command_options = {
      :c => "validate", 
      :o => "line", 
      :input_file => File.expand_path(file), 
      :optimize_memory => true
    }.merge(options)

    logger.info "Validate #{file}"
    chouette_command.run! command_options
  end


  include Chouette::CommandLineSupport

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ninoxe-1.2.3 app/models/chouette/file_validator.rb
ninoxe-1.2.2 app/models/chouette/file_validator.rb
ninoxe-1.2.1 app/models/chouette/file_validator.rb
ninoxe-1.2.0 app/models/chouette/file_validator.rb
ninoxe-1.1.5 app/models/chouette/file_validator.rb
ninoxe-1.1.4 app/models/chouette/file_validator.rb
ninoxe-1.1.3 app/models/chouette/file_validator.rb
ninoxe-1.1.2 app/models/chouette/file_validator.rb
ninoxe-1.1.1 app/models/chouette/file_validator.rb
ninoxe-1.1.0 app/models/chouette/file_validator.rb
ninoxe-1.0.3 app/models/chouette/file_validator.rb
ninoxe-1.0.2 app/models/chouette/file_validator.rb
ninoxe-1.0.1 app/models/chouette/file_validator.rb
ninoxe-1.0.0 app/models/chouette/file_validator.rb
ninoxe-0.1.6 app/models/chouette/file_validator.rb
ninoxe-0.1.5 app/models/chouette/file_validator.rb
ninoxe-0.1.4 app/models/chouette/file_validator.rb
ninoxe-0.1.3 app/models/chouette/file_validator.rb
ninoxe-0.1.2 app/models/chouette/file_validator.rb
ninoxe-0.1.1 app/models/chouette/file_validator.rb