1require "rake/testtask" 2 3# Proto for tests. 4genproto_output = [] 5genproto_output << "tests/generated_code.rb" 6genproto_output << "tests/test_import.rb" 7file "tests/generated_code.rb" => "tests/generated_code.proto" do |file_task| 8 sh "./protoc --ruby_out=. tests/generated_code.proto" 9end 10 11file "tests/test_import.rb" => "tests/test_import.proto" do |file_task| 12 sh "./protoc --ruby_out=. tests/test_import.proto" 13end 14 15task :genproto => genproto_output 16 17task :clean do 18 sh "rm -f #{genproto_output.join(' ')}" 19end 20 21Rake::TestTask.new(:test => :genproto) do |t| 22 t.test_files = FileList["tests/*.rb"] 23end 24 25task :default => [:test] 26