summaryrefslogtreecommitdiff
path: root/draw.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-25 01:30:01 -0600
committerJeff Carr <[email protected]>2024-01-25 01:30:01 -0600
commit4beeb0bb137bf179064354fa6fc3be2c951bdef6 (patch)
treea4a5109a9034cef43903628747b5875f5949843e /draw.go
parent21546ce2c002e1550754578b1083f0a9c6d0a77d (diff)
cleaning code for release versionsv0.13.2
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'draw.go')
-rw-r--r--draw.go65
1 files changed, 16 insertions, 49 deletions
diff --git a/draw.go b/draw.go
index 2ac0963..5a39e51 100644
--- a/draw.go
+++ b/draw.go
@@ -30,25 +30,6 @@ func (rs *RepoStatus) drawGitBranches() {
rs.gitBranchesGroup = rs.window.Box().NewGroup("branches")
newgrid := rs.gitBranchesGroup.NewGrid("gridnuts", 2, 2)
- rs.masterDrop = gadgets.NewBasicDropdown(newgrid, "main branch")
- rs.masterDrop.Custom = func() {
- log.Log(WARN, "Switching main branch to:", rs.masterDrop.String())
- rs.masterBranchVersion.SetLabel(rs.masterDrop.String())
- rs.mainWorkingName.SetValue(rs.masterDrop.String())
- }
- rs.develDrop = gadgets.NewBasicDropdown(newgrid, "devel branch")
- rs.develDrop.Custom = func() {
- log.Log(WARN, "Switching devel branch to:", rs.develDrop.String())
- rs.develBranchVersion.SetLabel(rs.develDrop.String())
- rs.develWorkingName.SetValue(rs.develDrop.String())
- }
- rs.userDrop = gadgets.NewBasicDropdown(newgrid, "user branch")
- rs.userDrop.Custom = func() {
- log.Log(WARN, "Switching user branch to:", rs.userDrop.String())
- rs.userBranchVersion.SetLabel(rs.userDrop.String())
- rs.userWorkingName.SetValue(rs.userDrop.String())
- }
-
rs.lasttag = gadgets.NewOneLiner(newgrid, "last tag")
rs.masterBranchVersion = gadgets.NewOneLiner(newgrid, "master")
@@ -58,26 +39,6 @@ func (rs *RepoStatus) drawGitBranches() {
rs.currentBranch = gadgets.NewOneLiner(newgrid, "current branch")
rs.currentVersion = gadgets.NewOneLiner(newgrid, "current version")
- /*
- var master = ""
- all := rs.getBranches()
- for _, branch := range all {
- log.Log(INFO, "getBranches()", branch)
- rs.masterDrop.AddText(branch)
- rs.develDrop.AddText(branch)
- rs.userDrop.AddText(branch)
- if branch == "master" {
- master = "master"
- }
- if branch == "main" {
- master = "main"
- }
- }
- */
-
- // relabel the various gadgets with the right branch name
- // rs.masterBranchVersion.SetLabel(master)
-
rs.showBranchesButton = newgrid.NewButton("getBranches()", func() {
all := rs.getBranches()
i := len(all)
@@ -116,10 +77,10 @@ func (rs *RepoStatus) drawGitBranches() {
}
})
newgrid.NewButton("CheckGoSum()", func() {
- if rs.CheckGoSum() {
+ if ok, missing := rs.CheckGoSum(); ok {
log.Log(WARN, "CheckGoSum() is ok")
} else {
- log.Log(WARN, "CheckGoSum() is not ok")
+ log.Log(WARN, "CheckGoSum() is not ok. missing:", missing)
}
})
newgrid.NewButton("CheckPrimativeGoMod()", func() {
@@ -207,16 +168,18 @@ func (rs *RepoStatus) drawGitCommands() {
}
rs.versionCmdOutput = gadgets.NewOneLiner(newgrid, "tag cmd")
- label := "merge " + rs.masterDrop.String() + " to devel"
+ label := "merge " + rs.mainWorkingName.String() + " to devel"
rs.develMerge = newgrid.NewButton(label, func() {
rs.Disable()
- master := rs.masterDrop.String()
+ master := rs.mainWorkingName.String()
+ log.Warn("develMerge() checking out master branch", master)
rs.checkoutBranch("master", master)
if rs.getCurrentBranchName() != master {
log.Warn("something went wrong switching to the master branch. full stop!")
return
}
- if !rs.runGitCommands() {
+ log.Warn("develMerge() running runGitCommands()")
+ if !rs.runGitCommands(true) {
log.Warn("SOMETHING WENT WRONG")
return
}
@@ -226,16 +189,18 @@ func (rs *RepoStatus) drawGitCommands() {
})
rs.releaseVersion = newgrid.NewButton("tag and release new version", func() {
+ rs.Disable()
if !rs.generateCmd() {
log.Warn("something is wrong. fix the errors first")
return
}
rs.releaseVersion.Disable()
- log.Warn("COMMIT IT HERE")
- if !rs.runGitCommands() {
+ log.Warn("MAKING A RELEASE AND VERSION")
+ if !rs.runGitCommands(true) {
log.Warn("SOMETHING WENT WRONG")
}
rs.Update()
+ rs.Enable()
log.Warn("THINGS SEEM OK")
})
@@ -400,10 +365,12 @@ func (rs *RepoStatus) generateCmd() bool {
return true
}
-func (rs *RepoStatus) runGitCommands() bool {
+func (rs *RepoStatus) runGitCommands(verbose bool) bool {
for _, line := range rs.versionCmds {
s := strings.Join(line, " ")
- log.Log(INFO, "NEED TO RUN:", s)
+ if verbose {
+ log.Log(WARN, "RUNNING:", s)
+ }
rs.develMerge.SetText(s)
err, b, output := runCmd(rs.realPath.String(), line)
if err != nil {
@@ -476,7 +443,7 @@ func (rs *RepoStatus) setMergeUserCommands() {
var all [][]string
devel := rs.GetDevelBranchName()
- user := rs.GetUserBranchName()
+ user := rs.userWorkingName.String()
line1 = append(line1, "git", "checkout", devel)
all = append(all, line1)