autotypist/releaseWindow.go

92 lines
2.2 KiB
Go

// 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())
}
}