diff --git a/checkReady.go b/checkReady.go new file mode 100644 index 0000000..11c1fca --- /dev/null +++ b/checkReady.go @@ -0,0 +1,48 @@ +// This is a simple example +package main + +import ( + "go.wit.com/log" +) + +func CheckReady() bool { + if release.current == nil { + log.Info("find the next repo first") + return false + } + goSumS := release.current.getGoSumStatus() + dirtyS := release.current.dirtyLabel.String() + lastS := release.current.status.GetLastTagVersion() + log.Info("repo:", release.current.String(), goSumS, dirtyS, lastS) + + if dirtyS == "ready to tag version" { + log.Info("\trepo is ready", release.current.String(), goSumS, dirtyS, lastS) + } else { + return false + } + + if release.current.status.ReadOnly() { + log.Info("\trepo is read only") + return false + } + + if release.versionS == lastS { + log.Info("\trepo is already done") + return false + } + + if goSumS == "BAD" { + log.Info("\trepo is ready", release.current.String(), goSumS, dirtyS, lastS) + } else { + log.Info("\trepo is ready maybe", release.current.String(), goSumS, dirtyS, lastS) + } + + if release.current.status.CheckDirty() { + log.Info("\trepo is dirty") + return false + } else { + log.Info("\trepo is ready", release.current.String(), goSumS, dirtyS, lastS) + } + + return true +} diff --git a/releaseWindow.go b/releaseWindow.go index 1c25b41..2ebc899 100644 --- a/releaseWindow.go +++ b/releaseWindow.go @@ -27,7 +27,9 @@ type releaseStruct struct { readOnly *gadgets.OneLiner notes *gadgets.OneLiner version *gadgets.OneLiner + versionS string reason *gadgets.BasicEntry + reasonS string openrepo *gui.Node @@ -48,9 +50,9 @@ func (w *autoType) Enable() { } func createReleaseBox(box *gui.Node) { - versionS := "0.17.0" - reasonS := "gocui" - partS := strings.Split(versionS, ".") + release.versionS = "0.17.0" + release.reasonS = "gocui" + partS := strings.Split(release.versionS, ".") release.box = box release.group = release.box.NewGroup("things") @@ -68,7 +70,7 @@ func createReleaseBox(box *gui.Node) { } me.Enable() }) - release.grid.NewButton("find next Bad", func() { + release.grid.NewButton("findNextDirty()", func() { me.Disable() if findNextDirty() { log.Info("findNextDirty() found a repo") @@ -77,11 +79,17 @@ func createReleaseBox(box *gui.Node) { } me.Enable() }) - /* - release.grid.NewButton("nil", func() { - log.Info("just filling the grid") + release.grid.NewButton("Check Ready", func() { + goSumS := release.current.getGoSumStatus() + dirtyS := release.current.dirtyLabel.String() + lastS := release.current.status.GetLastTagVersion() + if CheckReady() { + log.Info("repo is ready", release.current.String(), goSumS, dirtyS, lastS) + return + } else { + log.Info("\trepo is not ready", release.current.String(), goSumS, dirtyS, lastS) + } }) - */ release.grid.NewButton("next repo", func() { buttonDisable() defer buttonEnable() @@ -173,10 +181,10 @@ func createReleaseBox(box *gui.Node) { release.notes = gadgets.NewOneLiner(release.grid, "notes") release.version = gadgets.NewOneLiner(release.grid, "version") - release.version.SetText(versionS) + release.version.SetText(release.versionS) release.reason = gadgets.NewBasicEntry(release.grid, "release reason") - release.reason.SetText(reasonS) + release.reason.SetText(release.reasonS) release.sendVersionB = release.grid.NewButton("send version", func() { log.Info("set version()") diff --git a/structs.go b/structs.go index 41bdb8f..a7aba2a 100644 --- a/structs.go +++ b/structs.go @@ -20,8 +20,8 @@ type autoType struct { myGui *gui.Node // autotypistWindow *gadgets.BasicWindow - mainWindow *gui.Node - mainBox *gui.Node + mainWindow *gui.Node + mainBox *gui.Node // #### autotypist Global Display Options autoHidePerfect *gui.Node