attempt to go get everything in the config file
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
46dbb77317
commit
6b8e51a742
105
main.go
105
main.go
|
@ -2,6 +2,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"embed"
|
"embed"
|
||||||
|
|
||||||
|
@ -91,6 +92,68 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
||||||
allrepos = append(allrepos, newRepo)
|
allrepos = append(allrepos, newRepo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// just returns if something exists at the path name (file, directory, whatever)
|
||||||
|
func doesExist(path string) bool {
|
||||||
|
if _, err := os.Stat(path); err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func globalBuildOptions(box *gui.Node) {
|
||||||
|
var setCurrentBranch *gui.Node
|
||||||
|
group1 := box.NewGroup("Global Build Options")
|
||||||
|
groupvbox := group1.NewBox("bw vbox", false)
|
||||||
|
grouphbox := groupvbox.NewBox("bw hbox", true)
|
||||||
|
guiBranch := gadgets.NewBasicCombobox(grouphbox, "Select GUI branch")
|
||||||
|
guiBranch.Add("guimaster")
|
||||||
|
guiBranch.Add("guidevel")
|
||||||
|
guiBranch.Add("jcarr")
|
||||||
|
guiBranch.Custom = func () {
|
||||||
|
tmp := "set all current branchs to " + guiBranch.Get()
|
||||||
|
setCurrentBranch.Set(tmp)
|
||||||
|
}
|
||||||
|
|
||||||
|
setCurrentBranch = groupvbox.NewButton("set current branch to", func () {
|
||||||
|
for _, repo := range allrepos {
|
||||||
|
repo.status.Update()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
groupvbox.NewButton("go get everything in configfile", func () {
|
||||||
|
var newCmds [][]string
|
||||||
|
// usr, _ := user.Current()
|
||||||
|
newCmds = append(newCmds, []string{"cd", "go/src/gui/app/myrepos"})
|
||||||
|
repos := myrepolist()
|
||||||
|
for _, line := range repos {
|
||||||
|
log.Warn("repo =", line)
|
||||||
|
path, _, _, _ := splitLine(line)
|
||||||
|
if doesExist("/home/jcarr/go/src/" + path) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
newCmds = append(newCmds, []string{"go", "get", "-v", path})
|
||||||
|
}
|
||||||
|
|
||||||
|
script = newCmds
|
||||||
|
doit.Enable()
|
||||||
|
setGitCommands()
|
||||||
|
})
|
||||||
|
|
||||||
|
groupvbox.NewButton("status.Update() all", func () {
|
||||||
|
for _, repo := range allrepos {
|
||||||
|
repo.status.Update()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
groupvbox.NewButton("rescan all", func () {
|
||||||
|
for _, repo := range allrepos {
|
||||||
|
repo.newScan()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// This creates a window
|
// This creates a window
|
||||||
func repoworld() {
|
func repoworld() {
|
||||||
reposwin = gadgets.NewBasicWindow(myGui, "autotypist for GO & git. it types faster than you can.")
|
reposwin = gadgets.NewBasicWindow(myGui, "autotypist for GO & git. it types faster than you can.")
|
||||||
|
@ -126,17 +189,30 @@ func repoworld() {
|
||||||
|
|
||||||
box2 := reposwin.Box().NewBox("bw vbox", false)
|
box2 := reposwin.Box().NewBox("bw vbox", false)
|
||||||
|
|
||||||
buildOptions := box2.NewGrid("buildOptions",2, 1)
|
globalBuildOptions(box2)
|
||||||
title := gadgets.NewOneLiner(buildOptions, "Branch and build")
|
|
||||||
title.Set("options")
|
|
||||||
guiBranch := gadgets.NewBasicCombobox(buildOptions, "Select GUI branch")
|
|
||||||
guiBranch.Add("guimaster")
|
|
||||||
guiBranch.Add("guidevel")
|
|
||||||
guiBranch.Add("jcarr")
|
|
||||||
|
|
||||||
// gofmt -w -r "go.wit.com/gui -> go.wit.com/gui/gui" .
|
// gofmt -w -r "go.wit.com/gui -> go.wit.com/gui/gui" .
|
||||||
|
group2 := box2.NewGroup("Global Reset Options")
|
||||||
|
buildOptions := group2.NewGrid("buildOptions",2, 1)
|
||||||
|
|
||||||
buildOptions.NewLabel("only PERFECT")
|
buildOptions.NewLabel("delete PERFECT")
|
||||||
|
buildOptions.NewButton("Find", func () {
|
||||||
|
log.Warn("delete every repo marked PERFECT")
|
||||||
|
var newCmds [][]string
|
||||||
|
for _, repo := range allrepos {
|
||||||
|
status := repo.getStatus()
|
||||||
|
if status == "PERFECT" {
|
||||||
|
var line []string
|
||||||
|
line = append(line, "rm", "-rf", "go/src/" + repo.path)
|
||||||
|
newCmds = append(newCmds, line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
script = newCmds
|
||||||
|
doit.Enable()
|
||||||
|
setGitCommands()
|
||||||
|
})
|
||||||
|
|
||||||
|
buildOptions.NewLabel("delete PERFECT")
|
||||||
buildOptions.NewButton("Find", func () {
|
buildOptions.NewButton("Find", func () {
|
||||||
log.Warn("delete every repo marked PERFECT")
|
log.Warn("delete every repo marked PERFECT")
|
||||||
var newCmds [][]string
|
var newCmds [][]string
|
||||||
|
@ -178,7 +254,7 @@ func repoworld() {
|
||||||
setGitCommands()
|
setGitCommands()
|
||||||
})
|
})
|
||||||
|
|
||||||
buildOptions.NewLabel("get autotypist")
|
buildOptions.NewLabel("rebuild autotypist")
|
||||||
buildOptions.NewButton("go get", func () {
|
buildOptions.NewButton("go get", func () {
|
||||||
var newCmds [][]string
|
var newCmds [][]string
|
||||||
newCmds = append(newCmds, []string{"cd", "."})
|
newCmds = append(newCmds, []string{"cd", "."})
|
||||||
|
@ -201,17 +277,6 @@ func repoworld() {
|
||||||
doit.Enable()
|
doit.Enable()
|
||||||
})
|
})
|
||||||
|
|
||||||
buildOptions.NewButton("status.Update() all", func () {
|
|
||||||
for _, repo := range allrepos {
|
|
||||||
repo.status.Update()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
buildOptions.NewButton("rescan all", func () {
|
|
||||||
for _, repo := range allrepos {
|
|
||||||
repo.newScan()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
buildOptions.NewSeparator("endStatusScans")
|
buildOptions.NewSeparator("endStatusScans")
|
||||||
buildOptions.NewSeparator("endStatusScans")
|
buildOptions.NewSeparator("endStatusScans")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue