From 62f7bd384b6e2ce579ef519ddf5308c9ea08603f Mon Sep 17 00:00:00 2001 From: Charles Francoise Date: Mon, 10 Jul 2023 14:29:13 +0200 Subject: [PATCH] fix: don't create license file when initializing private orb (#962) --- cmd/orb.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/orb.go b/cmd/orb.go index 622387126..a7037c7d8 100644 --- a/cmd/orb.go +++ b/cmd/orb.go @@ -1218,7 +1218,8 @@ func initOrb(opts orbOptions) error { defer resp.Body.Close() // Create the file - out, err := os.Create(filepath.Join(os.TempDir(), "orb-template.zip")) + zipPath := filepath.Join(os.TempDir(), "orb-template.zip") + out, err := os.Create(zipPath) if err != nil { return err } @@ -1230,11 +1231,19 @@ func initOrb(opts orbOptions) error { return err } - err = unzipToOrbPath(filepath.Join(os.TempDir(), "orb-template.zip"), orbPath) + err = unzipToOrbPath(zipPath, orbPath) if err != nil { return err } + // Remove MIT License file if orb is private + if opts.private { + err = os.Remove(filepath.Join(orbPath, "LICENSE")) + if err != nil && !errors.Is(err, os.ErrNotExist) { + return err + } + } + if fullyAutomated == 1 { fmt.Println("Opted for manual setup, exiting") fmt.Printf("The Orb Project Template has been extracted to %s\n", orbPath)