diff options
| author | Jeff Carr <[email protected]> | 2025-10-07 06:28:39 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-07 06:28:39 -0500 |
| commit | 0b584dc4555de86ff9caea837fe59ac6f3cfee1b (patch) | |
| tree | edffffcbc9a08bf108b4c42f81f9de36cc4e0f31 /config.common.go | |
| parent | b3026b411408e55683932339b91a7970dcf88e4f (diff) | |
s/gopath/namespace/
Diffstat (limited to 'config.common.go')
| -rw-r--r-- | config.common.go | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/config.common.go b/config.common.go index 43cd763..8bc009d 100644 --- a/config.common.go +++ b/config.common.go @@ -1,7 +1,7 @@ package forgepb /* - lookup settings for a particular *gitpb.Repo or gopath string + lookup settings for a particular *gitpb.Repo or namespace string user settings are configured in ~/.config/forge/forge.text @@ -30,22 +30,22 @@ func (f *Forge) IsWritable(repo *gitpb.Repo) bool { // if f.Config.IsWritable(repo.FullPath) { // return true // } - // if !f.Config.IsWritable(repo.GetGoPath()) { + // if !f.Config.IsWritable(repo.GetNamespace()) { // return true // } return false } -// returns true if gopath is readonly() +// returns true if namespace is readonly() // will attempt to match IsWritable("foo") against anything ending in "foo" -func (fc *ForgeConfigs) IsReadOnly(gopath string) bool { +func (fc *ForgeConfigs) IsReadOnly(namespace string) bool { var match *ForgeConfig all := fc.All() // get the list of repos for all.Scan() { r := all.Next() - if r.GoPath == gopath { - // exact gopath match + if r.Namespace == namespace { + // exact namespace match if r.Writable { return false } @@ -57,9 +57,9 @@ func (fc *ForgeConfigs) IsReadOnly(gopath string) bool { return false } } - // if gopath == "foo" will return false if "go.wit.com/apps/foo" is Writable - base := filepath.Base(r.GoPath) - if base == gopath { + // if namespace == "foo" will return false if "go.wit.com/apps/foo" is Writable + base := filepath.Base(r.Namespace) + if base == namespace { if r.Writable { return false } @@ -67,14 +67,14 @@ func (fc *ForgeConfigs) IsReadOnly(gopath string) bool { // search for potential dir matches if r.Directory { // test the dir - if strings.HasPrefix(gopath, r.GoPath) { + if strings.HasPrefix(namespace, r.Namespace) { match = r } } } if match == nil { - // log.Info("did not match in IsReadOnly()", gopath) + // log.Info("did not match in IsReadOnly()", namespace) return true } @@ -96,16 +96,16 @@ func (fc *ForgeConfigs) IsReadOnly(gopath string) bool { // returns the deb package name // this let's you check a git tag version against a package .deb version -// allows gopath's to not need to match the .deb name +// allows namespace's to not need to match the .deb name // this is important in lots of cases! It is normal and happens often enough. -func (fc *ForgeConfigs) DebName(gopath string) string { +func (fc *ForgeConfigs) DebName(namespace string) string { // get "zookeeper" from "go.wit.com/apps/zookeeper" - normalBase := filepath.Base(gopath) + normalBase := filepath.Base(namespace) all := fc.All() for all.Scan() { r := all.Next() - if r.GoPath == gopath { + if r.Namespace == namespace { // returns "zookeeper-go" for "go.wit.com/apps/zookeeper" if r.DebName != "" { // log.Info("FOUND DebName", r.DebName) @@ -145,14 +145,14 @@ func (fc *ForgeConfigs) IsPrivate(thing string) bool { all := fc.All() // get the list of repos for all.Scan() { r := all.Next() - if r.GoPath == thing { + if r.Namespace == thing { // if private is set here, then ok, otherwise // still check if a Directory match exists if r.Private { return true } } - base := filepath.Base(r.GoPath) + base := filepath.Base(r.Namespace) if base == thing { if r.Private { return true @@ -162,7 +162,7 @@ func (fc *ForgeConfigs) IsPrivate(thing string) bool { // search for potential dir matches if r.Directory { // test the dir - if strings.HasPrefix(thing, r.GoPath) { + if strings.HasPrefix(thing, r.Namespace) { match = r } } @@ -186,19 +186,19 @@ func (fc *ForgeConfigs) IsFavorite(thing string) bool { all := fc.All() // get the list of repos for all.Scan() { r := all.Next() - if r.GoPath == thing { + if r.Namespace == thing { if r.Favorite { return true } } - base := filepath.Base(r.GoPath) + base := filepath.Base(r.Namespace) if base == thing { if r.Favorite { return true } } if r.Directory { - if strings.HasPrefix(thing, r.GoPath) { + if strings.HasPrefix(thing, r.Namespace) { match = r } } @@ -219,19 +219,19 @@ func (fc *ForgeConfigs) IsWritable(thing string) bool { all := fc.All() // get the list of repos for all.Scan() { r := all.Next() - if r.GoPath == thing { + if r.Namespace == thing { if r.Writable { return true } } - base := filepath.Base(r.GoPath) + base := filepath.Base(r.Namespace) if base == thing { if r.Writable { return true } } if r.Directory { - if strings.HasPrefix(thing, r.GoPath) { + if strings.HasPrefix(thing, r.Namespace) { match = r } } @@ -250,19 +250,19 @@ func (fc *ForgeConfigs) FindUserBranch(thing string) string { all := fc.All() // get the list of repos for all.Scan() { r := all.Next() - if r.GoPath == thing { + if r.Namespace == thing { if r.UserBranchName != "" { return r.UserBranchName } } - base := filepath.Base(r.GoPath) + base := filepath.Base(r.Namespace) if base == thing { if r.UserBranchName != "" { return r.UserBranchName } } if r.Directory { - if strings.HasPrefix(thing, r.GoPath) { + if strings.HasPrefix(thing, r.Namespace) { match = r } } @@ -281,19 +281,19 @@ func (fc *ForgeConfigs) FindDevelBranch(thing string) string { all := fc.All() // get the list of repos for all.Scan() { r := all.Next() - if r.GoPath == thing { + if r.Namespace == thing { if r.DevelBranchName != "" { return r.DevelBranchName } } - base := filepath.Base(r.GoPath) + base := filepath.Base(r.Namespace) if base == thing { if r.DevelBranchName != "" { return r.DevelBranchName } } if r.Directory { - if strings.HasPrefix(thing, r.GoPath) { + if strings.HasPrefix(thing, r.Namespace) { match = r } } @@ -312,19 +312,19 @@ func (fc *ForgeConfigs) FindMasterBranch(thing string) string { all := fc.All() // get the list of repos for all.Scan() { r := all.Next() - if r.GoPath == thing { + if r.Namespace == thing { if r.MasterBranchName != "" { return r.MasterBranchName } } - base := filepath.Base(r.GoPath) + base := filepath.Base(r.Namespace) if base == thing { if r.MasterBranchName != "" { return r.MasterBranchName } } if r.Directory { - if strings.HasPrefix(thing, r.GoPath) { + if strings.HasPrefix(thing, r.Namespace) { match = r } } |
