Sha256: 795c59256bf7dde74076b2475096849976a742d68db7c92ee6965bb28b417f01

Contents?: true

Size: 987 Bytes

Versions: 9

Compression:

Stored size: 987 Bytes

Contents

namespace :avro do
  desc 'build definitions'
  task :build do
    jar_file = File.expand_path("../../../src/avro-tools-1.7.7.jar", __FILE__)
    spec_dir = File.expand_path(".")
    Dir.glob(File.join(spec_dir, "/**/*.avdl")) do |file|
      puts file
      folder = File.expand_path(File.join(File.dirname(file), "../compiled"))
      FileUtils.mkdir_p(folder)
      new_file = File.join(folder, File.basename(file, ".avdl"))
      command = "java -jar #{jar_file} idl #{file} #{new_file}.avpr"
      puts command
      `#{command}`
    end
  end

  desc 'extract schemas'
  task :schema do
    jar_file = File.expand_path("../../../src/avro-tools-1.7.7.jar", __FILE__)
    spec_dir = File.expand_path(".")
    Dir.glob(File.join(spec_dir, "/**/*.avdl")) do |file|
      puts file
      folder = File.expand_path(File.join(File.dirname(file), "../schemas"))
      command = "java -jar #{jar_file} idl2schemata #{file} #{folder}"
      puts command
      `#{command}`
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
service_contract-0.6.0 lib/service_contract/tasks.rb
service_contract-0.5.1 lib/service_contract/tasks.rb
service_contract-0.5.0 lib/service_contract/tasks.rb
service_contract-0.4.1 lib/service_contract/tasks.rb
service_contract-0.4.0 lib/service_contract/tasks.rb
service_contract-0.3.0 lib/service_contract/tasks.rb
service_contract-0.2.1 lib/service_contract/tasks.rb
service_contract-0.2.0 lib/service_contract/tasks.rb
service_contract-0.1.1 lib/service_contract/tasks.rb