detect go.sum is clean

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-23 22:48:07 -06:00
parent 2b8d19099f
commit 9ddf46cf75
4 changed files with 111 additions and 6 deletions

View File

@ -98,7 +98,7 @@ func globalBuildOptions(box *gui.Node) {
me.autoDryRun = group2.NewCheckbox("autotypist --dry-run")
me.autoDryRun.SetChecked(true)
group2.NewButton("parse go.sum ScanGitConfig()", func() {
group2.NewButton("parse .git/config ScanGitConfig()", func() {
repostatus.ScanGitConfig()
})

View File

@ -5,6 +5,7 @@ import (
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gui/logsettings"
"go.wit.com/log"
// "go.wit.com/gui/gadgets"
)
@ -16,6 +17,17 @@ func globalDisplayOptions(box *gui.Node) {
group1.NewButton("Show Repository Window", func() {
reposwin.Toggle()
})
group1.NewButton("Create Release Window", func() {
if release.win == nil {
log.Info("Creating the Release Window")
createReleaseWindow()
log.Info("Toggling the Release Window")
release.win.Toggle()
}
log.Info("Toggling the Release Window")
release.win.Toggle()
release.openrepo.Disable()
})
/*
group1.NewButton("hide all", func() {
for repo, _ := range me.allrepos {

12
main.go
View File

@ -4,6 +4,7 @@ package main
import (
"embed"
"os/user"
"strings"
"go.wit.com/log"
@ -35,6 +36,7 @@ func main() {
func addRepo(grid *gui.Node, path string, master string, devel string, user string) {
newRepo := new(repo)
path = strings.Trim(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)
return
@ -67,7 +69,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
}
log.Warn("status window exists. trying TestDraw() here")
newRepo.status.Toggle()
newRepo.status.Update()
/// newRepo.status.Update()
})
// newRepo.status = repostatus.New(me.myGui, newRepo.path)
@ -77,10 +79,10 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
newRepo.status.SetDevelWorkingName(me.develBranch.String())
newRepo.status.SetUserWorkingName(me.userBranch.String())
/*
newRepo.status.SetDevelBranchName(devel)
newRepo.status.SetUserBranchName(user)
newRepo.status.Update()
newRepo.newScan()
newRepo.status.SetDevelBranchName(devel)
newRepo.status.SetUserBranchName(user)
newRepo.status.Update()
newRepo.newScan()
*/
me.allrepos[newRepo] = path
}

91
releaseWindow.go Normal file
View File

@ -0,0 +1,91 @@
// This is a simple example
package main
import (
"go.wit.com/gui"
"go.wit.com/log"
"go.wit.com/lib/gadgets"
)
var release releaseStruct
type releaseStruct struct {
current *repo
win *gadgets.BasicWindow
box *gui.Node
group *gui.Node
grid *gui.Node
repo *gadgets.OneLiner
status *gadgets.OneLiner
notes *gadgets.OneLiner
openrepo *gui.Node
}
func createReleaseWindow() {
if release.win != nil {
release.win.Toggle()
return
}
release.win = gadgets.NewBasicWindow(me.myGui, "Make a new release")
release.win.Custom = func() {
log.Info("Release Window close")
}
release.win.Make()
release.win.StandardClose()
release.win.Draw()
release.box = release.win.Box()
release.group = release.box.NewGroup("things")
release.grid = release.group.NewGrid("buildOptions", 2, 1)
release.grid.NewButton("next repo", func() {
log.Info("find the next repo to release here")
findNextRepo()
})
release.openrepo = release.grid.NewButton("open repo", func() {
if release.current == nil {
log.Info("find the next repo first")
return
}
if release.current.status.CheckGoSum() {
log.Info("repo has go.sum requirements that are clean")
release.status.SetValue("CLEAN")
} else {
log.Info("repo has go.sum requirements that are screwed up")
release.status.SetValue("BAD")
}
// log.Info("find the next repo to release here")
// release.current.status.Toggle()
})
release.openrepo.Disable()
release.repo = gadgets.NewOneLiner(release.grid, "repo")
release.status = gadgets.NewOneLiner(release.grid, "status")
release.notes = gadgets.NewOneLiner(release.grid, "notes")
}
func findNextRepo() {
for repo, _ := range me.allrepos {
latestversion := repo.status.GetLastTagVersion()
status := repo.dirtyLabel.String()
if status == "PERFECT" {
continue
}
if repo.status.CheckDirty() {
log.Info("dirty repo:", latestversion, status, repo.status.String())
release.repo.SetValue(repo.status.String())
release.status.SetValue("dirty")
release.notes.SetValue("You must commit your changes\nbefore you can continue")
release.current = repo
release.openrepo.Enable()
return
}
log.Info("repo:", latestversion, status, repo.status.String())
}
}