Skip to content

Commit

Permalink
Merge pull request #125 from pressly/Supfile.yml
Browse files Browse the repository at this point in the history
Support Supfile.yml
  • Loading branch information
VojtechVitek authored Jan 16, 2018
2 parents 2bdad7e + 80cf49b commit d1d9e12
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd/sup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (f *flagStringSlice) Set(value string) error {
}

func init() {
flag.StringVar(&supfile, "f", "./Supfile", "Custom path to Supfile")
flag.StringVar(&supfile, "f", "", "Custom path to ./Supfile[.yml]")
flag.Var(&envVars, "e", "Set environment variables")
flag.Var(&envVars, "env", "Set environment variables")
flag.StringVar(&sshConfig, "sshconfig", "", "Read SSH Config file, ie. ~/.ssh/config file")
Expand Down Expand Up @@ -211,10 +211,18 @@ func main() {
return
}

if supfile == "" {
supfile = "./Supfile"
}
data, err := ioutil.ReadFile(resolvePath(supfile))
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
firstErr := err
data, err = ioutil.ReadFile("./Supfile.yml") // Alternative to ./Supfile.
if err != nil {
fmt.Fprintln(os.Stderr, firstErr)
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
conf, err := sup.NewSupfile(data)
if err != nil {
Expand Down

0 comments on commit d1d9e12

Please sign in to comment.