lib/tasks/protoc.rake in rails_grpc-0.1.0 vs lib/tasks/protoc.rake in rails_grpc-0.1.1
- old
+ new
@@ -53,10 +53,27 @@
service_files = grpc_out_ruby_files.select do |v|
name = File.basename(v)
name.end_with?("_pb.rb") && name.include?("_services_")
end
service_files.each do |path|
- source = open(path).read.split("\n").reject { |line| line =~ /^require / }.join("\n")
+ source = open(path)
+ .read
+ .split("\n")
+ .reject { |line| line =~ /^require / && !line.include?("grpc") }.join("\n")
+ open(path, "w") do |f|
+ f.write source
+ end
+ end
+
+ without_service_files = grpc_out_ruby_files.select do |v|
+ name = File.basename(v)
+ name.end_with?("_pb.rb") && !name.include?("_services_")
+ end
+ without_service_files.each do |path|
+ source = open(path)
+ .read
+ .split("\n")
+ .reject { |line| line =~ /^require / && !line.include?("google/protobuf") }.join("\n")
open(path, "w") do |f|
f.write source
end
end
end