lib/rimless/avro_utils.rb
# Render (compile) a single Avro schema template. The given source file
# path will serve to calculate the destination path. So even deep path'ed
# templates will keep their hierarchy.
#
# @param src [String] the Avro schema template file path
Render (compile) a single Avro schema template. The given source file
path will serve to calculate the destination path. So even deep path'ed
templates will keep their hierarchy.
Render ( compile ) a single Avro schema template . The given source file path will serve to calculate the destination path . So even deep path ' ed templates will keep their hierarchy .
def render_file(src)
      dest = schema_path(src)
      FileUtils.mkdir_p(File.dirname(dest))
      File.write(dest, ERB.new(File.read(src)).result(binding))
      validate_file(dest)
    end
def render_file ( src ) dest = schema_path ( src ) FileUtils . mkdir_p ( File . dirname ( dest ) ) File . write ( dest , ERB . new ( File . read ( src ) ) . result ( binding ) ) validate_file ( dest ) end
Render (compile) a single Avro schema template.
Render ( compile ) a single Avro schema template .
# Convert the template path to the destination path # Create the deep path when not yet existing # Write the rendered file contents to the destination # Check the written file for correct JSON
src
the Avro schema template file path
the Avro schema template file path