From 98892a326c5e84399e3ea4cb730429a91c1c48c7 Mon Sep 17 00:00:00 2001 From: Justin Vreeland Date: Fri, 6 Dec 2024 23:44:44 -0500 Subject: [PATCH] convert/gem/ruby: Don't overwrite existing melange files --- pkg/convert/gem/gem.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/convert/gem/gem.go b/pkg/convert/gem/gem.go index bc866087b..a7f31a795 100644 --- a/pkg/convert/gem/gem.go +++ b/pkg/convert/gem/gem.go @@ -21,6 +21,8 @@ import ( "fmt" "io" "net/http" + "os" + "path/filepath" "strings" "time" @@ -169,7 +171,13 @@ func (c *GemContext) findDependencies(ctx context.Context) error { return err } log.Infof("[%s] Add to generate list", c.ToCheck[0]) - c.ToGenerate[c.ToCheck[0]] = g + // This should be ruby3 once the files are multi-versioned + _, err = os.Stat(filepath.Join(c.OutDir, "ruby3.4-"+g.Name+".yaml")) + if err == nil { + log.Infof("[%s] Package already exists, skipping", g.Name) + } else { + c.ToGenerate[c.ToCheck[0]] = g + } c.ToCheck = c.ToCheck[1:] log.Infof("[%s] Check for dependencies", g.Name)