mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* Cleanup create code * Add missing integration tests from odo create to odo init * Add CreateLocalEnv to create .odo/env/env.yaml file for commands that require it but cannot create it * Remove 'odo create' usages from integration tests * Remove create reference from the Makefile * REmove create doc from v3 Signed-off-by: Parthvi Vala <pvala@redhat.com> * Remove test files * Fix CI failure Signed-off-by: Parthvi Vala <pvala@redhat.com>
37 lines
914 B
Go
37 lines
914 B
Go
package helper
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"path/filepath"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
"github.com/redhat-developer/odo/pkg/envinfo"
|
|
)
|
|
|
|
const configFileDirectory = ".odo"
|
|
const envInfoFile = "env.yaml"
|
|
|
|
func LocalEnvInfo(context string) *envinfo.EnvSpecificInfo {
|
|
info, err := envinfo.NewEnvSpecificInfo(filepath.Join(context, configFileDirectory, envInfoFile))
|
|
if err != nil {
|
|
Expect(err).To(Equal(nil))
|
|
}
|
|
return info
|
|
}
|
|
|
|
// CreateLocalEnv creates a .odo/env/env.yaml file
|
|
// Useful for commands that require this file and cannot create one on their own, for e.g. url, list
|
|
func CreateLocalEnv(context, compName, projectName string) {
|
|
var config = fmt.Sprintf(`
|
|
ComponentSettings:
|
|
Name: %s
|
|
Project: %s
|
|
AppName: app
|
|
`, compName, projectName)
|
|
dir := filepath.Join(context, ".odo", "env")
|
|
MakeDir(dir)
|
|
Expect(ioutil.WriteFile(filepath.Join(dir, "env.yaml"), []byte(config), 0600)).To(BeNil())
|
|
}
|