2024-01-23 22:48:07 -06:00
|
|
|
// 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
|
|
|
|
|
2024-01-24 02:41:34 -06:00
|
|
|
win *gadgets.BasicWindow
|
|
|
|
box *gui.Node
|
|
|
|
group *gui.Node
|
|
|
|
grid *gui.Node
|
|
|
|
repo *gadgets.OneLiner
|
2024-01-23 22:48:07 -06:00
|
|
|
status *gadgets.OneLiner
|
2024-01-24 02:41:34 -06:00
|
|
|
notes *gadgets.OneLiner
|
|
|
|
version *gadgets.OneLiner
|
|
|
|
reason *gadgets.OneLiner
|
2024-01-23 22:48:07 -06:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2024-01-24 02:41:34 -06:00
|
|
|
// do an initial scan of all the repos
|
|
|
|
scanGoSum()
|
|
|
|
|
2024-01-23 22:48:07 -06:00
|
|
|
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")
|
2024-01-24 02:41:34 -06:00
|
|
|
release.current.goSumStatus.SetValue("CLEAN")
|
2024-01-23 22:48:07 -06:00
|
|
|
} else {
|
|
|
|
log.Info("repo has go.sum requirements that are screwed up")
|
|
|
|
release.status.SetValue("BAD")
|
2024-01-24 02:41:34 -06:00
|
|
|
release.current.goSumStatus.SetValue("BAD")
|
|
|
|
}
|
|
|
|
release.current.status.Update()
|
|
|
|
release.current.newScan()
|
|
|
|
|
|
|
|
if release.current.dirtyLabel.String() == "PERFECT" {
|
|
|
|
return
|
2024-01-23 22:48:07 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// log.Info("find the next repo to release here")
|
2024-01-24 02:41:34 -06:00
|
|
|
release.current.status.Toggle()
|
2024-01-23 22:48:07 -06:00
|
|
|
})
|
|
|
|
release.openrepo.Disable()
|
|
|
|
|
|
|
|
release.repo = gadgets.NewOneLiner(release.grid, "repo")
|
|
|
|
release.status = gadgets.NewOneLiner(release.grid, "status")
|
|
|
|
release.notes = gadgets.NewOneLiner(release.grid, "notes")
|
2024-01-24 02:41:34 -06:00
|
|
|
|
|
|
|
release.version = gadgets.NewOneLiner(release.grid, "version")
|
|
|
|
release.version.SetValue("0.13.11")
|
|
|
|
|
|
|
|
release.reason = gadgets.NewOneLiner(release.grid, "reason")
|
|
|
|
release.reason.SetValue("release automation")
|
|
|
|
|
|
|
|
release.grid.NewButton("send version", func() {
|
|
|
|
log.Info("set version()")
|
|
|
|
release.current.status.SetVersion("0", "13", "11", "release automation")
|
|
|
|
})
|
|
|
|
release.grid.NewButton("set ignore", func() {
|
|
|
|
tmp := release.current.goSumStatus.String()
|
|
|
|
log.Info("trying to set repo IGNORE is now =", tmp)
|
|
|
|
release.current.goSumStatus.SetValue("IGNORE")
|
|
|
|
release.current.goSumStatus.SetLabel("IGNORE")
|
|
|
|
release.current.goSumStatus.SetText("IGNORE")
|
|
|
|
})
|
2024-01-23 22:48:07 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func findNextRepo() {
|
|
|
|
for repo, _ := range me.allrepos {
|
2024-01-24 02:41:34 -06:00
|
|
|
goSumS := repo.goSumStatus.String()
|
|
|
|
dirtyS := repo.dirtyLabel.String()
|
|
|
|
|
|
|
|
log.Info("repo", repo.String(), goSumS, dirtyS)
|
|
|
|
if goSumS == "IGNORE" {
|
2024-01-23 22:48:07 -06:00
|
|
|
continue
|
|
|
|
}
|
2024-01-24 02:41:34 -06:00
|
|
|
// latestversion := repo.status.GetLastTagVersion()
|
|
|
|
if goSumS == "CLEAN" {
|
|
|
|
if dirtyS == "PERFECT" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
release.repo.SetValue(repo.status.String())
|
|
|
|
release.status.SetValue("clean")
|
|
|
|
release.notes.SetValue("check manually")
|
|
|
|
release.current = repo
|
|
|
|
release.openrepo.Enable()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if goSumS == "DIRTY" {
|
2024-01-23 22:48:07 -06:00
|
|
|
release.repo.SetValue(repo.status.String())
|
|
|
|
release.status.SetValue("dirty")
|
2024-01-24 02:41:34 -06:00
|
|
|
release.notes.SetValue("commit changes")
|
2024-01-23 22:48:07 -06:00
|
|
|
release.current = repo
|
|
|
|
release.openrepo.Enable()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
2024-01-24 02:41:34 -06:00
|
|
|
log.Info("tried to find() but not sure what to do next")
|
2024-01-23 22:48:07 -06:00
|
|
|
}
|