Dependency updates

This commit is contained in:
Stash Dev
2019-05-27 12:34:26 -07:00
parent 69917999ef
commit 4b037e1040
359 changed files with 60172 additions and 18749 deletions

View File

@@ -8,13 +8,13 @@ import (
"os"
"path"
"path/filepath"
"regexp"
"github.com/BurntSushi/toml"
"github.com/gobuffalo/envy"
"github.com/gobuffalo/flect/name"
"github.com/markbates/oncer"
"github.com/pkg/errors"
"github.com/rogpeppe/go-internal/modfile"
)
// App represents meta data for a Buffalo application on disk
@@ -48,25 +48,21 @@ func (a App) IsZero() bool {
}
func resolvePackageName(name string, pwd string) string {
result := envy.CurrentPackage()
result, _ := envy.CurrentModule()
if filepath.Base(result) != name {
result = path.Join(result, name)
}
if envy.Mods() {
//Extract package from go.mod
p := filepath.Join(pwd, "go.mod")
if f, err := os.Open(p); err == nil {
if s, err := ioutil.ReadAll(f); err == nil {
re := regexp.MustCompile("module (.*)")
res := re.FindAllStringSubmatch(string(s), 1)
if len(res) == 1 && len(res[0]) == 2 {
return res[0][1]
}
result = filepath.Base(pwd)
}
moddata, err := ioutil.ReadFile(filepath.Join(pwd, name, "go.mod"))
if err != nil {
return result
}
packagePath := modfile.ModulePath(moddata)
if packagePath == "" {
return name
}
return packagePath
}
return result