summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--globalBuildOptions.go90
-rw-r--r--globalDisplayOptions.go49
-rw-r--r--globalResetOptions.go13
-rw-r--r--globalTestingOptions.go54
4 files changed, 66 insertions, 140 deletions
diff --git a/globalBuildOptions.go b/globalBuildOptions.go
index 043892e..8708425 100644
--- a/globalBuildOptions.go
+++ b/globalBuildOptions.go
@@ -3,6 +3,7 @@ package main
import (
"os"
+ "os/user"
"path/filepath"
"go.wit.com/log"
@@ -66,8 +67,9 @@ func globalBuildOptions(box *gui.Node) {
me.develBranch = gadgets.NewBasicCombobox(grid, "default devel branch")
me.develBranch.AddText("devel")
+ usr, _ := user.Current()
me.userBranch = gadgets.NewBasicCombobox(grid, "default user branch")
- me.userBranch.AddText("jcarr")
+ me.userBranch.AddText(usr.Username)
grid.NewLabel("<nil>")
grid.NewButton("set working branches", func() {
@@ -89,12 +91,10 @@ func globalBuildOptions(box *gui.Node) {
*/
})
newBranch = grid.NewCombobox()
- newBranch.AddText("guimaster")
newBranch.AddText("master")
- newBranch.AddText("main")
- newBranch.AddText("guidevel")
- newBranch.AddText("jcarr")
- newBranch.SetText("jcarr")
+ newBranch.AddText("devel")
+ newBranch.AddText(usr.Username)
+ newBranch.SetText(usr.Username)
me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
me.userHomePwd = gadgets.NewOneLiner(grid, "user home")
@@ -116,49 +116,51 @@ func globalBuildOptions(box *gui.Node) {
me.autoDryRun = group2.NewCheckbox("autotypist --dry-run")
me.autoDryRun.SetChecked(true)
- group2.NewButton("parse .git/config ScanGitConfig()", func() {
- repostatus.ScanGitConfig()
- })
+ /*
+ group2.NewButton("parse .git/config ScanGitConfig()", func() {
+ repostatus.ScanGitConfig()
+ })
- group2.NewButton("parse go.sum ScanGoSrc()", func() {
- repostatus.ScanGoSrc()
- })
+ group2.NewButton("parse go.sum ScanGoSrc()", func() {
+ repostatus.ScanGoSrc()
+ })
- group2.NewButton("run git status", func() {
- me.autoWorkingPwd.SetValue("~/go/src")
- log.Warn("scanning allrepos")
- for path, _ := range me.allrepos {
- fullpath := "/home/jcarr/go/src/" + path
- quickCmd(fullpath, []string{"git", "status"})
- }
- })
+ group2.NewButton("run git status", func() {
+ me.autoWorkingPwd.SetValue("~/go/src")
+ log.Warn("scanning allrepos")
+ for path, _ := range me.allrepos {
+ fullpath := me.goSrcPwd.String() + path
+ quickCmd(fullpath, []string{"git", "status"})
+ }
+ })
- me.rerunGoMod = group2.NewButton("remove go.mod & go.sum", func() {
- for path, _ := range me.allrepos {
- fullpath := "/home/jcarr/go/src/" + path
- if quickCmd(fullpath, []string{"rm", "-f", "go.mod", "go.sum"}) {
- log.Info("rm go.mod FAILED in repo", fullpath, me.stopOnErrors.Bool())
- if me.stopOnErrors.Bool() {
- return
+ me.rerunGoMod = group2.NewButton("remove go.mod & go.sum", func() {
+ for path, _ := range me.allrepos {
+ fullpath := me.goSrcPwd.String() + path
+ if quickCmd(fullpath, []string{"rm", "-f", "go.mod", "go.sum"}) {
+ log.Info("rm go.mod FAILED in repo", fullpath, me.stopOnErrors.Bool())
+ if me.stopOnErrors.Bool() {
+ return
+ }
}
}
- }
- })
+ })
- me.rerunGoMod = group2.NewButton("run go mod & go tidy", func() {
- os.Unsetenv("GO111MODULE")
- for path, _ := range me.allrepos {
- fullpath := "/home/jcarr/go/src/" + path
- quickCmd(fullpath, []string{"go", "mod", "init"})
- quickCmd(fullpath, []string{"go", "mod", "tidy"})
- }
- })
+ me.rerunGoMod = group2.NewButton("run go mod & go tidy", func() {
+ os.Unsetenv("GO111MODULE")
+ for path, _ := range me.allrepos {
+ fullpath := me.goSrcPwd.String() + path
+ quickCmd(fullpath, []string{"go", "mod", "init"})
+ quickCmd(fullpath, []string{"go", "mod", "tidy"})
+ }
+ })
- me.rerunGoMod = group2.NewButton("git checkout go.mod & go.sum", func() {
- for path, _ := range me.allrepos {
- fullpath := "/home/jcarr/go/src/" + path
- quickCmd(fullpath, []string{"git", "checkout", "go.mod"})
- quickCmd(fullpath, []string{"git", "checkout", "go.sum"})
- }
- })
+ me.rerunGoMod = group2.NewButton("git checkout go.mod & go.sum", func() {
+ for path, _ := range me.allrepos {
+ fullpath := me.goSrcPwd.String() + path
+ quickCmd(fullpath, []string{"git", "checkout", "go.mod"})
+ quickCmd(fullpath, []string{"git", "checkout", "go.sum"})
+ }
+ })
+ */
}
diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go
index f61cd50..371e7c3 100644
--- a/globalDisplayOptions.go
+++ b/globalDisplayOptions.go
@@ -5,7 +5,6 @@ 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"
)
@@ -52,54 +51,6 @@ func globalDisplayOptions(box *gui.Node) {
globalDisplaySetRepoState()
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.openrepo.Disable()
- for _, repo := range me.allrepos {
- repo.newScan()
- }
- reposwin.Toggle()
- release.win.Toggle()
- })
- group1.NewButton("Create Release Window (fullscan)", func() {
- if release.win == nil {
- log.Info("Creating the Release Window")
- createReleaseWindow()
- for _, repo := range me.allrepos {
- repo.status.Update()
- repo.newScan()
- }
- globalDisplaySetRepoState()
- // open the repo window
- reposwin.Toggle()
- log.Info("Toggling the Release Window")
- release.win.Toggle()
- }
- log.Info("Toggling the Release Window")
- release.win.Toggle()
- release.openrepo.Disable()
- for _, repo := range me.allrepos {
- repo.newScan()
- }
- })
- /*
- group1.NewButton("hide all", func() {
- for _, repo := range me.allrepos {
- repo.Hide()
- }
- })
- group1.NewButton("show all", func() {
- for repo := range me.allrepos {
- repo.Show()
- }
- })
- */
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
me.autoHideReadOnly.Custom = func() {
diff --git a/globalResetOptions.go b/globalResetOptions.go
index 5007f0e..bf6f5cb 100644
--- a/globalResetOptions.go
+++ b/globalResetOptions.go
@@ -1,6 +1,8 @@
package main
import (
+ "path/filepath"
+
"go.wit.com/gui"
"go.wit.com/log"
)
@@ -24,10 +26,13 @@ func globalResetOptions(box *gui.Node) {
log.Warn("TODO: check things are pushed and check every dir in go/src/")
me.deleteGoSrcPkgB.SetLabel("ARE YOU SURE?")
if me.deleteGoSrcPkgB.String() == "ARE YOU SURE?" {
- fullpath := "/home/jcarr/go/"
- quickCmd(fullpath, []string{"rm", "-rf", "/home/jcarr/go/src/"})
- quickCmd(fullpath, []string{"chmod", "700", "-R", "/home/jcarr/go/pkg/"})
- quickCmd(fullpath, []string{"rm", "-rf", "/home/jcarr/go/pkg/"})
+ homeDir := me.userHomePwd.String()
+ fullpath := filepath.Join(homeDir, "go")
+ gosrc := filepath.Join(fullpath, "src")
+ gopkg := filepath.Join(fullpath, "pkg")
+ quickCmd(fullpath, []string{"rm", "-rf", gosrc})
+ quickCmd(fullpath, []string{"chmod", "700", "-R", gopkg})
+ quickCmd(fullpath, []string{"rm", "-rf", gopkg})
}
})
}
diff --git a/globalTestingOptions.go b/globalTestingOptions.go
index 1631db1..4804e64 100644
--- a/globalTestingOptions.go
+++ b/globalTestingOptions.go
@@ -2,6 +2,7 @@ package main
import (
"os"
+ "path/filepath"
"go.wit.com/lib/gui/repostatus"
@@ -19,42 +20,6 @@ func globalTestingOptions(box *gui.Node) {
me.autoRebuildButton.SetLabel("rebuild autotypist")
})
- /*
- me.downloadEverythingButton = test1.NewButton("go get go.wit.com", func() {
- me.downloadEverythingButton.Disable()
- me.autoWorkingPwd.SetValue("/home/jcarr/go/src")
- var perfect bool = true
- repos := myrepolist()
- for _, line := range repos {
- log.Verbose("repo =", line)
- path, _, _, _ := splitLine(line)
- path = strings.TrimSpace(path)
- if path == "#" {
- // skip comment lines
- continue
- }
- if doesExist("/home/jcarr/go/src/" + path) {
- continue
- }
- // attempt to download it
- quickCmd("/home/jcarr/go/src/go.wit.com", []string{"go", "get", "-v", path})
- perfect = false
- }
-
- if perfect {
- var notes string
- notes = "you have already downloaded\neverything on go.wit.com"
- me.autoWorkingPwd.SetValue(notes)
- me.downloadEverythingButton.Disable()
- return
- } else {
- var notes string
- notes = "download everything failed"
- me.autoWorkingPwd.SetValue(notes)
- me.downloadEverythingButton.Enable()
- }
- })
- */
var listallB *gui.Node
listallB = test1.NewButton("go.wit.com/list", func() {
listallB.Disable()
@@ -72,9 +37,12 @@ func globalTestingOptions(box *gui.Node) {
func attemptAutoRebuild() {
os.Setenv("GO111MODULE", "off")
- fullpath := "/home/jcarr/go/"
- quickCmd(fullpath, []string{"mkdir", "-p", "/home/jcarr/go/src/go.wit.com/apps/"})
- fullpath = "/home/jcarr/go/src/go.wit.com/apps/"
+ homeDir := me.userHomePwd.String()
+ fullpath := filepath.Join(homeDir, "go")
+ // fullpath := "/home/jcarr/go/"
+ quickCmd(fullpath, []string{"mkdir", "-p", "src/go.wit.com/apps/"})
+
+ fullpath = filepath.Join(homeDir, "go/src/go.wit.com/apps/")
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/apps/autotypist"})
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/debian"})
@@ -83,19 +51,19 @@ func attemptAutoRebuild() {
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/gocui"})
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/andlabs"})
- fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/nocui/"
+ fullpath = filepath.Join(homeDir, "go/src/go.wit.com/toolkits/nocui/")
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../nocui.so"})
- fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/gocui/"
+ fullpath = filepath.Join(homeDir, "go/src/go.wit.com/toolkits/gocui/")
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../gocui.so"})
- fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/andlabs/"
+ fullpath = filepath.Join(homeDir, "go/src/go.wit.com/toolkits/andlabs/")
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../andlabs.so"})
- fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist"
+ fullpath = filepath.Join(homeDir, "go/src/go.wit.com/apps/autotypist")
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
quickCmd(fullpath, []string{"go", "build", "-v", "-x"})
}