Commit 37565b6

mo khan <mo@mokhan.ca>
2025-03-06 17:18:52
chore: compile each protobuf definition
1 parent e31ddc3
Changed files (1)
magefile.go
@@ -5,10 +5,12 @@ package main
 
 import (
 	"context"
+	"path/filepath"
 	"runtime"
 
 	"github.com/magefile/mage/mg"
 	"github.com/magefile/mage/sh"
+	"github.com/xlgmokha/x/pkg/x"
 )
 
 // Default target to run when none is specified
@@ -76,13 +78,20 @@ func Browser() error {
 
 // Generate gRPC from protocal buffers
 func Protos() error {
-	return sh.RunV(
-		"grpc_tools_ruby_protoc",
-		"--proto_path=./protos",
-		"--ruby_out=lib",
-		"--grpc_out=lib",
-		"protos/ability.proto",
-	)
+	files := x.Must(filepath.Glob("./protos/*.proto"))
+	for _, file := range files {
+		if err := sh.RunV(
+			"grpc_tools_ruby_protoc",
+			"--proto_path=./protos",
+			"--ruby_out=lib",
+			"--grpc_out=lib",
+			file,
+		); err != nil {
+			return err
+		}
+	}
+
+	return nil
 }
 
 // Run All the servers