moving code into repostatus
This commit is contained in:
parent
3887ab99d8
commit
e323b15eb7
4
main.go
4
main.go
|
@ -62,8 +62,8 @@ func main() {
|
|||
if i < 60 {
|
||||
i = 60
|
||||
}
|
||||
// print every 13 seconds
|
||||
if i%13 == 0 {
|
||||
// print every 27 seconds
|
||||
if i%27 == 0 {
|
||||
log.Info("Not auto scanning", i)
|
||||
}
|
||||
return
|
||||
|
|
35
repolist.go
35
repolist.go
|
@ -17,9 +17,11 @@ func (r *repo) String() string {
|
|||
return r.status.String()
|
||||
}
|
||||
|
||||
/*
|
||||
func (r *repo) getPath() string {
|
||||
return r.path
|
||||
}
|
||||
*/
|
||||
|
||||
func RemoveFirstElement(slice []string) (string, []string) {
|
||||
if len(slice) == 0 {
|
||||
|
@ -92,24 +94,27 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
|||
log.Info("addRepo() already had path", path)
|
||||
return
|
||||
}
|
||||
log.Info("addRepo() attempting to add path", path)
|
||||
// log.Info("addRepo() attempting to add path", path)
|
||||
|
||||
newRepo := new(repo)
|
||||
|
||||
path = strings.Trim(path, "/") // trim any extranous '/' chars put in the config file by the user
|
||||
path = strings.TrimSuffix(path, "/") // trim any extranous '/' chars put in the config file by the user
|
||||
if path == "" {
|
||||
log.Warn("addRepo() got empty path", path, master, devel, user)
|
||||
// just an empty line in the config file
|
||||
return
|
||||
}
|
||||
|
||||
if repostatus.VerifyLocalGoRepo(path) {
|
||||
log.Verbose("newRepo actually exists", newRepo.getPath())
|
||||
if strings.HasPrefix(path, "/") {
|
||||
// this is a direct path. don't check if it is a golang repo
|
||||
} else {
|
||||
log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path, master, devel, user)
|
||||
return
|
||||
if repostatus.VerifyLocalGoRepo(path) {
|
||||
// log.Verbose("newRepo actually exists", )
|
||||
} else {
|
||||
// log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path, master, devel, user)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
newRepo.path = path
|
||||
newRepo.pLabel = grid.NewLabel(path).SetProgName("path")
|
||||
|
||||
newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag")
|
||||
|
@ -157,7 +162,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
|||
me.reposwin.Enable()
|
||||
})
|
||||
|
||||
newRepo.status = repostatus.NewRepoStatusWindow(newRepo.path)
|
||||
newRepo.status = repostatus.NewRepoStatusWindow(path)
|
||||
newRepo.hidden = false
|
||||
newRepo.status.SetMainWorkingName(master)
|
||||
newRepo.status.SetDevelWorkingName(devel)
|
||||
|
@ -166,12 +171,12 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
|||
var showBuildB bool = false
|
||||
switch newRepo.status.RepoType() {
|
||||
case "binary":
|
||||
log.Info("compile here. Show()")
|
||||
// log.Info("compile here. Show()")
|
||||
showBuildB = true
|
||||
case "library":
|
||||
log.Info("library here. Hide()")
|
||||
// log.Info("library here. Hide()")
|
||||
default:
|
||||
log.Info("unknown. Show()")
|
||||
log.Info("unknown RepoType", newRepo.status.RepoType())
|
||||
}
|
||||
if showBuildB {
|
||||
newRepo.endBox.NewButton("build", func() {
|
||||
|
@ -250,13 +255,13 @@ func showApps() {
|
|||
for _, repo := range me.allrepos {
|
||||
switch repo.status.RepoType() {
|
||||
case "binary":
|
||||
log.Info("compile here. Show()")
|
||||
//log.Info("compile here. Show()")
|
||||
repo.Show()
|
||||
case "library":
|
||||
log.Info("library here. Hide()")
|
||||
//log.Info("library here. Hide()")
|
||||
repo.Hide()
|
||||
default:
|
||||
log.Info("unknown. Show()")
|
||||
log.Info("showApps() unknown. Show()")
|
||||
repo.Hide()
|
||||
}
|
||||
|
||||
|
|
16
scan.go
16
scan.go
|
@ -6,8 +6,6 @@ import (
|
|||
"time"
|
||||
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
)
|
||||
|
||||
func (r *repo) newScan() bool {
|
||||
|
@ -16,12 +14,14 @@ func (r *repo) newScan() bool {
|
|||
return false
|
||||
}
|
||||
// r.scan()
|
||||
if repostatus.VerifyLocalGoRepo(r.getPath()) {
|
||||
log.Verbose("repo actually exists", r.getPath())
|
||||
} else {
|
||||
log.Warn("repo does not exist", r.getPath())
|
||||
return false
|
||||
}
|
||||
/*
|
||||
if repostatus.VerifyLocalGoRepo(r.getPath()) {
|
||||
log.Verbose("repo actually exists", r.getPath())
|
||||
} else {
|
||||
log.Warn("repo does not exist", r.getPath())
|
||||
return false
|
||||
}
|
||||
*/
|
||||
mname := r.status.GetMasterBranchName()
|
||||
mver := r.status.GetMasterVersion()
|
||||
mver = mver + " (" + mname + ")"
|
||||
|
|
|
@ -85,8 +85,8 @@ type autoType struct {
|
|||
}
|
||||
|
||||
type repo struct {
|
||||
hidden bool
|
||||
path string
|
||||
hidden bool
|
||||
// path string
|
||||
lasttagrev string
|
||||
lasttag string
|
||||
giturl string
|
||||
|
|
Loading…
Reference in New Issue