1 package helper 2 3 import ( 4 "fmt" 5 "os" 6 "path/filepath" 7 8 . "github.com/onsi/gomega" 9 ) 10 11 // CreateLocalEnv creates a .odo/env/env.yaml file 12 // Useful for commands that require this file and cannot create one on their own, for e.g. url, list 13 func CreateLocalEnv(context, compName, projectName string) { 14 var config = fmt.Sprintf(` 15 ComponentSettings: 16 Name: %s 17 Project: %s 18 AppName: app 19 `, compName, projectName) 20 dir := filepath.Join(context, ".odo", "env") 21 MakeDir(dir) 22 Expect(os.WriteFile(filepath.Join(dir, "env.yaml"), []byte(config), 0600)).To(BeNil()) 23 } 24