developing on this now
This commit is contained in:
parent
0463030e80
commit
816760d137
22
Makefile
22
Makefile
|
@ -2,7 +2,7 @@ VERSION = $(shell git describe --tags)
|
||||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||||
|
|
||||||
all: goimports vet install
|
all: goimports vet install
|
||||||
forge -h
|
forge
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@GO111MODULE=off go vet
|
@GO111MODULE=off go vet
|
||||||
|
@ -33,34 +33,34 @@ redomod:
|
||||||
GO111MODULE= go mod tidy
|
GO111MODULE= go mod tidy
|
||||||
|
|
||||||
redomod-all:
|
redomod-all:
|
||||||
forge --RedoGoMod
|
forge --do-RedoGoMod
|
||||||
|
|
||||||
redomod-erase:
|
redomod-erase:
|
||||||
forge --RedoGoMod --erase
|
forge --do-RedoGoMod --do-erase
|
||||||
|
|
||||||
list: install
|
list: install
|
||||||
reset
|
reset
|
||||||
forge --list
|
forge --do-list
|
||||||
|
|
||||||
list-private: install
|
private: install
|
||||||
reset
|
reset
|
||||||
forge --list --private
|
forge --find-private
|
||||||
|
|
||||||
list-fix: install
|
list-fix: install
|
||||||
reset
|
reset
|
||||||
forge --list --fix
|
forge --do-list --do-fix
|
||||||
|
|
||||||
list-readonly: install
|
list-readonly: install
|
||||||
reset
|
reset
|
||||||
forge --list --readonly
|
forge --do-list --find-readonly
|
||||||
|
|
||||||
list-config: install
|
list-config: install
|
||||||
forge --list-conf
|
forge --config
|
||||||
|
|
||||||
scan: install
|
scan: install
|
||||||
reset
|
reset
|
||||||
forge --scan
|
forge --do-scan
|
||||||
|
|
||||||
|
|
||||||
mine: install
|
mine: install
|
||||||
forge --mine
|
forge --find-mine
|
||||||
|
|
47
argv.go
47
argv.go
|
@ -7,22 +7,24 @@ package main
|
||||||
var argv args
|
var argv args
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
List bool `arg:"--list" help:"list found repos"`
|
Config bool `arg:"--config" help:"work from your .config/forge/ configuration"`
|
||||||
ListConf bool `arg:"--list-conf" help:"list your .config/forge/ configuration"`
|
FindAll bool `arg:"--find-all" help:"select every repo"`
|
||||||
Scan bool `arg:"--scan" help:"rescan your repos"`
|
FindReadOnly bool `arg:"--find-readonly" help:"include read-only repos"`
|
||||||
ReadOnly bool `arg:"--readonly" help:"include read-only repos"`
|
FindMine bool `arg:"--find-mine" help:"download private and writeable repos"`
|
||||||
Mine bool `arg:"--mine" help:"download private and writeable repos"`
|
FindFavorites bool `arg:"--find-favorites" help:"download repos marked as favorites"`
|
||||||
Favorites bool `arg:"--favorites" help:"download repos marked as favorites"`
|
FindPrivate bool `arg:"--find-private" help:"list private repos in .config/forge/"`
|
||||||
GitPull bool `arg:"--git-pull" help:"run 'git pull' on all your repos"`
|
DoList bool `arg:"--do-list" help:"list found repos"`
|
||||||
Build bool `arg:"--build" default:"true" help:"also try to build it"`
|
DoScan bool `arg:"--do-scan" help:"rescan your repos"`
|
||||||
Install bool `arg:"--install" help:"try to install every binary package"`
|
DoClone bool `arg:"--do-clone" help:"go-clone things you are missing"`
|
||||||
RedoGoMod bool `arg:"--RedoGoMod" help:"remake all the go.sum and go.mod files"`
|
DoForce bool `arg:"--do-force" help:"force redo go-clone"`
|
||||||
DryRun bool `arg:"--dry-run" help:"show what would be run"`
|
DoGitPull bool `arg:"--do-git-pull" help:"run 'git pull' on all your repos"`
|
||||||
Fix bool `arg:"--fix" help:"fix config, save config & exit"`
|
DoBuild bool `arg:"--do-build" default:"true" help:"also try to build it"`
|
||||||
Clone bool `arg:"--clone" help:"go-clone things you are missing"`
|
DoInstall bool `arg:"--do-install" help:"try to install every binary package"`
|
||||||
Force bool `arg:"--force" help:"force redo go-clone"`
|
DoRedoGoMod bool `arg:"--do-RedoGoMod" help:"remake all the go.sum and go.mod files"`
|
||||||
Erase bool `arg:"--erase" help:"erase"`
|
DoErase bool `arg:"--do-EraseGoMod" help:"erase the go.mod and go.sum files"`
|
||||||
Private bool `arg:"--private" help:"list private repos in .config/forge/"`
|
DoGui bool `arg:"--do-gui" help:"test the gui"`
|
||||||
|
DryRun bool `arg:"--dry-run" help:"show what would be run"`
|
||||||
|
Fix bool `arg:"--fix" help:"fix config, save config & exit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (args) Version() string {
|
func (args) Version() string {
|
||||||
|
@ -33,14 +35,13 @@ func (a args) Description() string {
|
||||||
return `
|
return `
|
||||||
forge -- in the spirit of things like sourceforge
|
forge -- in the spirit of things like sourceforge
|
||||||
|
|
||||||
Repository configuration is stored in .config/forge/forge.text
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
forge --list # list found repos
|
forge --config # shows your forge config (~/.config/forge/)
|
||||||
forge --mine # download your private and writable repos
|
forge --mine # find your private and writable repos
|
||||||
forge --favorites # clone repos you marked as favorites
|
forge --favorites # find configured as favorites
|
||||||
|
|
||||||
forge --git-pull # run 'git pull' in every repo
|
forge --git-pull # run 'git pull' in every repo
|
||||||
forge --build # build every binary package
|
forge --build --dry-run # build every binary package (but just show what would run)
|
||||||
forge --install # install every binary package
|
forge --mine --clone # clone every package you have in your config file
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,52 +8,67 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func list() {
|
// ah yes, COBOL. what a throwback. for those that know
|
||||||
|
// then you know exactly what is in this file. For those that don't, here it is:
|
||||||
|
|
||||||
|
// All this does is output human readable text formatted to be viewable on
|
||||||
|
// a console with a fixed with font. AKA: a typerwriter. Which is exactly
|
||||||
|
// what COBOL did in the 1970's (60s? notsure) And the 80s.
|
||||||
|
|
||||||
|
// So, you want to dump out stuff on the console. Let's see. Something like
|
||||||
|
|
||||||
|
/*
|
||||||
|
forge --favorites
|
||||||
|
|
||||||
|
go.wit.com/apps/myapp v0.2.0 (installed)
|
||||||
|
go.wit.com/lib/somethingfun v0.0.7 (not downloaded)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// anyway, you get the idea. This is also called COBOL because it does on
|
||||||
|
// thing and truncates every line output to the columns you see with stty -a
|
||||||
|
// my monitor is huge, so it's not going to work at 80x24. 160x48 is better
|
||||||
|
// actually, I'd predict some of these will probably end up 240 wide
|
||||||
|
// long live good eyesight and 4K monitors!
|
||||||
|
|
||||||
|
func doCobol() {
|
||||||
log.DaemonMode(true)
|
log.DaemonMode(true)
|
||||||
if argv.Private {
|
|
||||||
// GetPrivate()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if argv.Mine {
|
log.Info(standardStart5("gopath", "cur name", "master", "user", "repo type"))
|
||||||
log.Printf("get mine %s\n", me.forge.GetGoSrc())
|
repos := me.found.SortByGoPath()
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
for repos.Scan() {
|
||||||
for repos.Scan() {
|
repo := repos.Next()
|
||||||
repo := repos.Next()
|
verifyPrint(repo)
|
||||||
if me.forge.Config.IsWritable(repo.GoPath) {
|
|
||||||
verifyPrint(repo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if argv.Favorites {
|
func standardStart5(arg1, arg2, arg3, arg4, arg5 string) string {
|
||||||
log.Printf("get favorites\n")
|
len1 := 40
|
||||||
os.Exit(0)
|
len2 := 12
|
||||||
|
len3 := 12
|
||||||
|
len4 := 16
|
||||||
|
len5 := 8
|
||||||
|
var s string
|
||||||
|
if len(arg1) > len1 {
|
||||||
|
arg1 = arg1[:len1]
|
||||||
}
|
}
|
||||||
|
s = "%-" + fmt.Sprintf("%d", len1) + "s "
|
||||||
if argv.List {
|
if len(arg2) > len2 {
|
||||||
var configsave bool
|
arg2 = arg2[:len2]
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
|
||||||
for repos.Scan() {
|
|
||||||
repo := repos.Next()
|
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) && !argv.ReadOnly {
|
|
||||||
if repo.ReadOnly {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.Info("todo: ConfigSave() readonly flag on repo is wrong", repo.GoPath)
|
|
||||||
repo.ReadOnly = true
|
|
||||||
configsave = true
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
verifyPrint(repo)
|
|
||||||
}
|
|
||||||
if configsave {
|
|
||||||
log.Info("should ConfigSave here")
|
|
||||||
me.forge.Repos.ConfigSave()
|
|
||||||
}
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
}
|
||||||
|
s += "%-" + fmt.Sprintf("%d", len2) + "s "
|
||||||
|
if len(arg3) > len3 {
|
||||||
|
arg3 = arg3[:len3]
|
||||||
|
}
|
||||||
|
s += "%-" + fmt.Sprintf("%d", len3) + "s "
|
||||||
|
if len(arg4) > len4 {
|
||||||
|
arg4 = arg4[:len4]
|
||||||
|
}
|
||||||
|
s += "%-" + fmt.Sprintf("%d", len4) + "s "
|
||||||
|
if len(arg5) > len5 {
|
||||||
|
arg5 = arg5[:len5]
|
||||||
|
}
|
||||||
|
s += "%-" + fmt.Sprintf("%d", len5) + "s"
|
||||||
|
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5)
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyPrint(repo *gitpb.Repo) {
|
func verifyPrint(repo *gitpb.Repo) {
|
||||||
|
@ -72,27 +87,20 @@ func verifyPrint(repo *gitpb.Repo) {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) && !argv.ReadOnly {
|
if me.forge.Config.IsReadOnly(repo.GoPath) && !argv.FindReadOnly {
|
||||||
if repo.ReadOnly {
|
if repo.ReadOnly {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("readonly flag on repo is wrong", repo.GoPath)
|
log.Info("readonly flag on repo is wrong", repo.GoPath)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
slen := 12
|
|
||||||
var chort string = s["cver"]
|
|
||||||
var mhort string = s["mver"]
|
var mhort string = s["mver"]
|
||||||
var uhort string = s["uver"]
|
var uhort string = s["uver"]
|
||||||
if len(s["cver"]) > slen {
|
var cname string = s["cname"]
|
||||||
chort = s["cver"][:slen]
|
|
||||||
}
|
// start := fmt.Sprintf("%-40s %-12s %-12s %-12s %-8s", s["gopath"], cname, mhort, uhort, s["rtype"])
|
||||||
if len(s["mver"]) > slen {
|
start := standardStart5(s["gopath"], cname, mhort, uhort, s["rtype"])
|
||||||
mhort = s["mver"][:slen]
|
|
||||||
}
|
|
||||||
if len(s["uver"]) > slen {
|
|
||||||
uhort = s["uver"][:slen]
|
|
||||||
}
|
|
||||||
start := fmt.Sprintf("%-40s %-12s %-12s %-12s %-8s", s["gopath"], chort, mhort, uhort, s["rtype"])
|
|
||||||
|
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) {
|
if me.forge.Config.IsReadOnly(repo.GoPath) {
|
||||||
end += "(readonly) "
|
end += "(readonly) "
|
||||||
|
@ -152,29 +160,3 @@ func verify(repo *gitpb.Repo, s map[string]string) bool {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func listPrivate() {
|
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
|
||||||
for repos.Scan() {
|
|
||||||
repo := repos.Next()
|
|
||||||
if me.forge.Config.IsPrivate(repo.GoPath) {
|
|
||||||
verifyPrint(repo)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
configs := me.forge.Config.SortByGoPath()
|
|
||||||
for configs.Scan() {
|
|
||||||
thing := configs.Next()
|
|
||||||
if thing.Directory {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if thing.Private {
|
|
||||||
found := me.forge.Repos.FindByGoPath(thing.GoPath)
|
|
||||||
if found == nil {
|
|
||||||
log.Info("have not downloaded private:", thing.GoPath)
|
|
||||||
} else {
|
|
||||||
log.Info("already downloaded private:", thing.GoPath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
// An app to submit patches for the 30 GO GUI repos
|
||||||
|
|
||||||
|
func doGitPull() {
|
||||||
|
me.found.RillGitPull()
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
// An app to submit patches for the 30 GO GUI repos
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/gui"
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func doGui() {
|
||||||
|
me.myGui = gui.New()
|
||||||
|
me.myGui.Default()
|
||||||
|
|
||||||
|
me.mainWindow = gadgets.RawBasicWindow("submit & test patchsets")
|
||||||
|
me.mainWindow.Make()
|
||||||
|
me.mainWindow.Show()
|
||||||
|
me.mainbox = me.mainWindow.Box()
|
||||||
|
|
||||||
|
// disable the interface while everything is scanned
|
||||||
|
me.Disable()
|
||||||
|
|
||||||
|
vbox2 := me.mainbox.NewVerticalBox("BOX2")
|
||||||
|
globalBuildOptions(vbox2)
|
||||||
|
me.summary = submitPatchesBox(vbox2)
|
||||||
|
|
||||||
|
me.repos = makeRepoView()
|
||||||
|
|
||||||
|
// processing is done. update the repo summary box
|
||||||
|
me.summary.Update()
|
||||||
|
|
||||||
|
me.Enable()
|
||||||
|
|
||||||
|
// intermittently scans the status indefinitly
|
||||||
|
me.repos.View.Watchdog(func() {
|
||||||
|
log.Info("In main()")
|
||||||
|
// processing is done. update the repo summary box
|
||||||
|
me.summary.Update()
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
// An app to submit patches for the 30 GO GUI repos
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func doRedoGoMod() {
|
||||||
|
me.forge.RillRedoGoMod()
|
||||||
|
os.Exit(0)
|
||||||
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if !repo.IsValid() {
|
||||||
|
log.Printf("%10s %-50s", "old?", repo.GetGoPath())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Printf("running on: %-50s", repo.GetGoPath())
|
||||||
|
repo.RedoGoMod()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func doEraseGoMod() {
|
||||||
|
/*
|
||||||
|
var cmds [][]string
|
||||||
|
cmds = append(cmds, []string{"rm", "-f", "go.mod", "go.sum"})
|
||||||
|
errs := me.forge.RillCmds(me.packs, cmds)
|
||||||
|
foreach x, y := range errs {
|
||||||
|
log.Info("EraseGoMod() error", x.GoPath, y)
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
func doScan() {
|
||||||
|
me.forge.ScanGoSrc()
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "go.wit.com/log"
|
||||||
|
|
||||||
|
func findPrivate() {
|
||||||
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if me.forge.Config.IsPrivate(repo.GoPath) {
|
||||||
|
me.found.AppendUniqueGoPath(repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// finds repos that are writable
|
||||||
|
func findMine() {
|
||||||
|
log.Printf("get mine %s\n", me.forge.GetGoSrc())
|
||||||
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if me.forge.Config.IsWritable(repo.GoPath) {
|
||||||
|
me.found.AppendUniqueGoPath(repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// finds repos that are writable
|
||||||
|
func findFavorites() {
|
||||||
|
log.Printf("get mine %s\n", me.forge.GetGoSrc())
|
||||||
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if me.forge.Config.IsFavorite(repo.GoPath) {
|
||||||
|
me.found.AppendUniqueGoPath(repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// retuns true if nothing was done
|
||||||
|
func findConfig() bool {
|
||||||
|
if argv.FindMine {
|
||||||
|
findConfigMine()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if argv.FindAll {
|
||||||
|
findConfigAll()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// finds config repos that are writable
|
||||||
|
func findConfigMine() {
|
||||||
|
loop := me.forge.Config.SortByGoPath()
|
||||||
|
for loop.Scan() {
|
||||||
|
r := loop.Next()
|
||||||
|
gopath := r.GoPath
|
||||||
|
if r.GetDirectory() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if me.forge.Config.IsWritable(gopath) {
|
||||||
|
log.Info("mine:", gopath)
|
||||||
|
me.foundPaths = append(me.foundPaths, gopath)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// get everything in your config
|
||||||
|
func findConfigAll() {
|
||||||
|
loop := me.forge.Config.SortByGoPath()
|
||||||
|
for loop.Scan() {
|
||||||
|
r := loop.Next()
|
||||||
|
gopath := r.GoPath
|
||||||
|
if r.GetDirectory() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if me.forge.Config.IsWritable(gopath) {
|
||||||
|
log.Info("mine:", gopath)
|
||||||
|
me.foundPaths = append(me.foundPaths, gopath)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func findRepos() {
|
||||||
|
if argv.FindAll {
|
||||||
|
var configsave bool
|
||||||
|
repos := me.forge.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if me.forge.Config.IsReadOnly(repo.GoPath) && !argv.FindReadOnly {
|
||||||
|
if repo.ReadOnly {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Info("todo: ConfigSave() readonly flag on repo is wrong", repo.GoPath)
|
||||||
|
repo.ReadOnly = true
|
||||||
|
configsave = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
me.found.AppendUniqueGoPath(repo)
|
||||||
|
}
|
||||||
|
if configsave {
|
||||||
|
log.Info("should ConfigSave here")
|
||||||
|
me.forge.Repos.ConfigSave()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if argv.FindPrivate {
|
||||||
|
findPrivate()
|
||||||
|
}
|
||||||
|
|
||||||
|
if argv.FindMine {
|
||||||
|
findMine()
|
||||||
|
}
|
||||||
|
if argv.FindFavorites {
|
||||||
|
findFavorites()
|
||||||
|
}
|
||||||
|
}
|
96
main.go
96
main.go
|
@ -6,11 +6,9 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
"go.wit.com/dev/alexflint/arg"
|
||||||
"go.wit.com/lib/gadgets"
|
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// sent via -ldflags
|
// sent via -ldflags
|
||||||
|
@ -23,66 +21,48 @@ func main() {
|
||||||
|
|
||||||
// load the ~/.config/forge/ config
|
// load the ~/.config/forge/ config
|
||||||
me.forge = forgepb.Init()
|
me.forge = forgepb.Init()
|
||||||
os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc())
|
me.found = new(gitpb.Repos)
|
||||||
|
|
||||||
// show your forge config settings
|
// first find the repos or gopaths to operate on
|
||||||
if argv.ListConf {
|
if argv.Config {
|
||||||
me.forge.ConfigPrintTable()
|
if findConfig() {
|
||||||
os.Exit(0)
|
me.forge.ConfigPrintTable()
|
||||||
}
|
os.Exit(0)
|
||||||
|
|
||||||
// processes any --list like options
|
|
||||||
// may exit
|
|
||||||
list()
|
|
||||||
scan()
|
|
||||||
|
|
||||||
if argv.RedoGoMod {
|
|
||||||
me.forge.RillRedoGoMod()
|
|
||||||
os.Exit(0)
|
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
|
||||||
for repos.Scan() {
|
|
||||||
repo := repos.Next()
|
|
||||||
if !repo.IsValid() {
|
|
||||||
log.Printf("%10s %-50s", "old?", repo.GetGoPath())
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.Printf("running on: %-50s", repo.GetGoPath())
|
|
||||||
if argv.Erase {
|
|
||||||
repo.EraseGoMod()
|
|
||||||
} else {
|
|
||||||
repo.RedoGoMod()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
findRepos()
|
||||||
}
|
}
|
||||||
me.pp.WriteHelp(os.Stdout)
|
|
||||||
os.Exit(0)
|
|
||||||
|
|
||||||
me.myGui = gui.New()
|
log.Info("found", me.found.Len(), "repos. found", len(me.foundPaths), "paths from .config/forge")
|
||||||
me.myGui.Default()
|
|
||||||
|
|
||||||
me.mainWindow = gadgets.RawBasicWindow("submit & test patchsets")
|
// now, do something to all of them (or just print out a table of them)
|
||||||
me.mainWindow.Make()
|
var done bool = false
|
||||||
me.mainWindow.Show()
|
if argv.DoScan {
|
||||||
me.mainbox = me.mainWindow.Box()
|
doScan()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
|
||||||
// disable the interface while everything is scanned
|
if argv.DoRedoGoMod {
|
||||||
me.Disable()
|
doRedoGoMod()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
if argv.DoGitPull {
|
||||||
|
doGitPull()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
if argv.DoList {
|
||||||
|
// print out the repos
|
||||||
|
doCobol()
|
||||||
|
done = true
|
||||||
|
}
|
||||||
|
|
||||||
vbox2 := me.mainbox.NewVerticalBox("BOX2")
|
// do the gui at the very end
|
||||||
globalBuildOptions(vbox2)
|
if argv.DoGui {
|
||||||
me.summary = submitPatchesBox(vbox2)
|
doGui()
|
||||||
|
os.Exit(0)
|
||||||
me.repos = makeRepoView()
|
}
|
||||||
|
if !done {
|
||||||
// processing is done. update the repo summary box
|
// if nothing was selected, print out a table of them on STDOUT
|
||||||
me.summary.Update()
|
doCobol()
|
||||||
|
}
|
||||||
me.Enable()
|
|
||||||
|
|
||||||
// intermittently scans the status indefinitly
|
|
||||||
me.repos.View.Watchdog(func() {
|
|
||||||
log.Info("In main()")
|
|
||||||
// processing is done. update the repo summary box
|
|
||||||
me.summary.Update()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ func (r *repoWindow) mergeAllDevelToMain() bool {
|
||||||
log.Info("skipping dirty", repo.Name(), repo.State())
|
log.Info("skipping dirty", repo.Name(), repo.State())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Info("found", repo.Name(), repo.State())
|
log.Info("repo:", repo.Name(), repo.State())
|
||||||
repo.NewScan()
|
repo.NewScan()
|
||||||
if repo.Status.MergeDevelToMaster() {
|
if repo.Status.MergeDevelToMaster() {
|
||||||
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
|
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
|
||||||
|
@ -186,7 +186,7 @@ func (r *repoWindow) mergeAllUserToDevel() bool {
|
||||||
log.Info("skipping dirty", repo.Name(), repo.State())
|
log.Info("skipping dirty", repo.Name(), repo.State())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Info("found", repo.Name(), repo.State())
|
log.Info("repo:", repo.Name(), repo.State())
|
||||||
repo.NewScan()
|
repo.NewScan()
|
||||||
if repo.Status.MergeUserToDevel() {
|
if repo.Status.MergeUserToDevel() {
|
||||||
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
|
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
|
||||||
|
|
9
scan.go
9
scan.go
|
@ -1,9 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
func scan() {
|
|
||||||
if !argv.Scan {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
me.forge.ScanGoSrc()
|
|
||||||
list()
|
|
||||||
}
|
|
10
structs.go
10
structs.go
|
@ -20,10 +20,12 @@ func (b *mainType) Enable() {
|
||||||
|
|
||||||
// this app's variables
|
// this app's variables
|
||||||
type mainType struct {
|
type mainType struct {
|
||||||
pp *arg.Parser
|
pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
|
||||||
forge *forgepb.Forge
|
forge *forgepb.Forge // for holding the forge protobuf files
|
||||||
myGui *gui.Node
|
myGui *gui.Node // the gui toolkit handle
|
||||||
packs []*gitpb.Repo
|
found *gitpb.Repos // stores the list of repos to process things on
|
||||||
|
foundPaths []string // stores gopaths to act on (when doing go-clone)
|
||||||
|
configSave bool // if the config file should be saved after finishing
|
||||||
|
|
||||||
// our view of the repositories
|
// our view of the repositories
|
||||||
repos *repoWindow
|
repos *repoWindow
|
||||||
|
|
|
@ -176,33 +176,6 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
s.submitB.Disable()
|
s.submitB.Disable()
|
||||||
s.grid.NextRow()
|
s.grid.NextRow()
|
||||||
|
|
||||||
/*
|
|
||||||
// map a path to gitea
|
|
||||||
s.unknownOL = gadgets.NewBasicEntry(s.grid, "Unknown Repo:")
|
|
||||||
s.unknownSubmitB = s.grid.NewButton("map new repo path", func() {
|
|
||||||
log.Info("Submit repo:", s.unknownOL.String())
|
|
||||||
repo := me.repos.View.FindRepo(s.unknownOL.String())
|
|
||||||
if repo == nil {
|
|
||||||
log.Info("could not find repo:", s.unknownOL.String(), "in ~/go/src")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
localurl := repo.GetURL()
|
|
||||||
log.Info("found repo:", repo.GoPath(), "with giturl", localurl)
|
|
||||||
if localurl == "" {
|
|
||||||
log.Info("local repo check failed. repo")
|
|
||||||
} else {
|
|
||||||
log.Info("local repo has", localurl)
|
|
||||||
// check if go.wit.com works, if not, add it
|
|
||||||
// attempts to register the unknown repo
|
|
||||||
if gowit.Register(repo.GoPath(), localurl) {
|
|
||||||
// todo: check if this works
|
|
||||||
// s.unknownOL.Hide()
|
|
||||||
// s.unknownSubmitB.Hide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
s.unknownOL.Disable()
|
s.unknownOL.Disable()
|
||||||
s.unknownSubmitB.Disable()
|
s.unknownSubmitB.Disable()
|
||||||
s.grid.NextRow()
|
s.grid.NextRow()
|
Loading…
Reference in New Issue