grim/convey

a13a27a3ff4a
Parents 82d28cf8e74d
Children 466f881e1593
Attempt to load convey.yaml if convey.yml cound not be found
--- a/config/loader.go Mon Oct 11 07:21:26 2021 -0500
+++ b/config/loader.go Mon Oct 11 21:46:53 2021 -0500
@@ -18,6 +18,9 @@
import (
"io/ioutil"
+ "os"
+
+ log "github.com/sirupsen/logrus"
"github.com/go-yaml/yaml"
)
@@ -34,6 +37,22 @@
}
func LoadFile(filename string) (*Config, error) {
+ _, err := os.Stat(filename)
+ if err != nil {
+ // If the user selected the default and it didn't exist, attempt the
+ // default with a .yaml extension.
+ if os.IsNotExist(err) && filename == "convey.yml" {
+ log.Infof("configuration file convey.yml not found, attempting convey.yaml instead.")
+ filename = "convey.yaml"
+ _, err = os.Stat(filename)
+ if err != nil {
+ return nil, err
+ }
+ } else {
+ return nil, err
+ }
+ }
+
contents, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
--- a/runner/cmd.go Mon Oct 11 07:21:26 2021 -0500
+++ b/runner/cmd.go Mon Oct 11 21:46:53 2021 -0500
@@ -24,6 +24,8 @@
}
func (c *RunnerCmd) Run(g *globals.Globals) error {
+ logging.Setup(g.Color, g.Verbose)
+
cfg, err := config.LoadFile(c.ConfigFile)
if err != nil {
return err
@@ -49,8 +51,6 @@
configPath = cwd
}
- logging.Setup(g.Color, g.Verbose)
-
env := environment.New(c.Environment...)
rt := runtime.New(env, configPath, c.ForceSequential, c.KeepWorkspace, c.Timeout)
defer rt.Shutdown()