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