Sha256: 7591580c6fb4ee12fe6bd3983a0dc9a595a26819a006e2b929bc6c4fd317c61d
Contents?: true
Size: 1.12 KB
Versions: 6
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true namespace :build do src_directory = 'lib/connect_proto/src' def compile(src_directory, path) print "Compiling #{path}" protoc_version = `protoc --version`.split(' ').last raise RuntimeError, "Please use protoc v3.19.x" unless protoc_version =~ /^3\.21\.\d+$/ `protoc --proto_path=#{src_directory} --ruby_out=lib/connect_proto/build #{path}` puts ' - done' if $?.exitstatus.zero? end task :default do Dir.glob("#{src_directory}/**/*.proto").each do |protobuf| compile(src_directory, protobuf) end end desc 'Watch protobuf src directory and compile after any changes' task :watch do require 'listen' listener = Listen.to(src_directory, only: /.proto$/, relative: true) do |modified, added, removed| (modified + added).each do |path| compile(src_directory, path) end removed.each do |path| puts "Deleting #{path}" File.delete(path) if File.exist?(path) end end listener.start puts "Watching #{src_directory}/**/*.proto" sleep end end desc 'Compile all protobufs' task default: 'build:default'
Version data entries
6 entries across 6 versions & 1 rubygems