Sha256: f1a057919ca6599e66e19714dfa3540c6cd051662db35e461cbe7ecd6bf59872

Contents?: true

Size: 680 Bytes

Versions: 7

Compression:

Stored size: 680 Bytes

Contents

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "avro/builder"

RSpec::Core::RakeTask.new(:spec)

namespace :avro do
  desc 'Generate Avro schema files used by specs'
  task :generate_spec do
    root = 'spec/avro/dsl'
    Avro::Builder.add_load_path(root)
    Dir["#{root}/**/*.rb"].each do |dsl_file|
      puts "Generating Avro schema from #{dsl_file}"
      output_file = dsl_file.sub('/dsl/', '/schema/').sub(/\.rb$/, '.avsc')
      schema = Avro::Builder.build(File.read(dsl_file))
      FileUtils.mkdir_p(File.dirname(output_file))
      File.write(output_file, schema.end_with?("\n") ? schema : schema << "\n")
    end
  end
end

task :default => :spec

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
avromatic-0.4.0 Rakefile
avromatic-0.3.0 Rakefile
avromatic-0.2.0 Rakefile
avromatic-0.1.2 Rakefile
avromatic-0.1.2.pre.rc0 Rakefile
avromatic-0.1.1 Rakefile
avromatic-0.1.0 Rakefile