From 2c71c4a5fec1fd326c748fc67aa693387fc4a4a1 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 8 Jan 2025 02:39:30 -0600 Subject: [PATCH] keep working on why this doesn't work anymore --- doRelease.go | 15 +------ http.go | 104 ++++++++-------------------------------------- human.go | 56 ------------------------- prepareRelease.go | 1 - 4 files changed, 19 insertions(+), 157 deletions(-) delete mode 100644 human.go diff --git a/doRelease.go b/doRelease.go index 2485817..0b3c34d 100644 --- a/doRelease.go +++ b/doRelease.go @@ -9,7 +9,6 @@ import ( "time" "go.wit.com/lib/gui/shell" - "go.wit.com/lib/protobuf/forgepb" "go.wit.com/log" ) @@ -178,22 +177,12 @@ func doRelease() bool { badExit(errors.New(msg)) } - me.forge.ConfigSave() - cmd := []string{"forge", "--delete", check.GetGoPath()} - shell.RunRealtime(cmd) - me.forge = forgepb.Init() + time.Sleep(2 * time.Second) // notsure + check.Reload() // run this each time something gets published successfully rePrepareRelease() - /* - // notsure about this anymore - // update the values in the GUI - if repov := me.repos.View.FindByPath(check.GetGoPath()); repov != nil { - repov.NewScan2(check) - } - */ - // attempt to find another repo to release if !doReleaseFindNext() { log.Info("doReleaseFindNext() could not find a new", findCounter) diff --git a/http.go b/http.go index ee489e9..63acca3 100644 --- a/http.go +++ b/http.go @@ -3,8 +3,11 @@ package main import ( "fmt" "net/http" + "os" + "path/filepath" "strings" + "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -100,13 +103,13 @@ func okHandler(w http.ResponseWriter, r *http.Request) { log.Info("boo, current is missing", me.current.GetGoPath()) return } + testGoRepo(check) me.forge.HumanPrintRepo(check) return case "/list": - me.forge.PrintReleaseReport(me.forge.Repos) + me.forge.PrintHumanTable(me.found) return case "/releaseList": - me.forge.PrintReleaseReport(me.found) me.forge.PrintHumanTable(me.found) return default: @@ -114,6 +117,18 @@ func okHandler(w http.ResponseWriter, r *http.Request) { } } +func testGoRepo(check *gitpb.Repo) { + data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod")) + log.Info(string(data)) + + if me.forge.FinalGoDepsCheckOk(check) { + log.Info("forge.FinalGoDepsCheck(check) worked!") + } else { + log.Info("forge.FinalGoDepsCheck(check) failed. boo.") + } + +} + // starts and sits waiting for HTTP requests func startHTTP() { http.HandleFunc("/", okHandler) @@ -126,88 +141,3 @@ func startHTTP() { log.Println("Error starting server:", err) } } - -/* -func testNext() { - // re-scans the go.sum file. DOES NOT MODIFY ANYTHING - check := me.forge.FindByGoPath(me.current.GetGoPath()) - if check == nil { - log.Info("boo, you didn't git clone", me.current.GetGoPath()) - return - } - - data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod")) - log.Info(string(data)) - - if me.forge.FinalGoDepsCheckOk(check) { - log.Info("forge.FinalGoDepsCheck(check) worked!") - } else { - log.Info("forge.FinalGoDepsCheck(check) failed. boo.") - } - -} - -func showNext() { - log.Info("gui repo: " + me.release.repo.String()) - log.Info("gui name: " + me.release.version.String()) - log.Info("gui notes: " + me.release.notes.String()) - log.Info("gui status: " + me.release.status.String()) - log.Info("") - if me.current == nil { - log.Info("me.current == nil") - return - } - - check := me.forge.FindByGoPath(me.current.GetGoPath()) - if check == nil { - log.Info("forge: how was this not found?", me.current.GetGoPath()) - return - } - - if me.current.GetTargetVersion() == "" { - log.Info("TargetVersion == blank") - } - if me.current.GetTargetVersion() == me.current.GetCurrentVersion() { - log.Info("IsReleased() == true. do not release this a second time") - } else { - log.Info("IsReleased() == false") - } - if check.CheckDirty() { - log.Info("CheckDirty() == true. do not release dirty repos") - } else { - log.Info("CheckDirty() == false") - } - if check.GetGoPrimitive() { - log.Info("IsPrimitive() == true") - } else { - log.Info("IsPrimitive() == false") - } - if me.forge.Config.IsPrivate(check.GetGoPath()) { - log.Info("IsPrivate() == true") - } else { - log.Info("IsPrivate() == false") - } - if ok, compiled, err := me.current.IsProtobuf(); ok { - log.Info(log.Sprint("IsProtobuf() == true compiled protobuf files = ", compiled)) - if err != nil { - msg := fmt.Sprint("IsProtobuf() == err", err) - badExit(errors.New(msg)) - } - for _, s := range compiled { - log.Info("\tcompiled file found:", s) - } - } else { - log.Info("IsProtobuf() == false") - if err != nil { - log.Info(log.Sprint("IsProtobuf() == err", err)) - } - } - - testNext() - - log.Info(repolist.ReportHeader()) - log.Info("") - log.Info(repolist.ReleaseReportHeader()) - log.Info(me.forge.StandardReleaseHeader(me.current, "notsure")) -} -*/ diff --git a/human.go b/human.go deleted file mode 100644 index a615c0f..0000000 --- a/human.go +++ /dev/null @@ -1,56 +0,0 @@ -package main - -import ( - "fmt" - - "go.wit.com/lib/gui/repolist" - "go.wit.com/log" -) - -func PrintReport(readonly string, onlydirty string, perfect string) { - var count int - - log.Info(repolist.ReportHeader()) - - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - - count += 1 - header := repo.StandardHeader() - if onlydirty == "true" { - if repo.CheckDirty() { - log.Info(header + "") - } - continue - } - - if me.forge.Config.IsReadOnly(repo.GetGoPath()) { - if readonly == "true" { - log.Info(header + "readonly") - } - continue - } - if repo.State() == "PERFECT" { - if perfect == "false" { - continue - } - } - if repo.State() != "merge to main" { - log.Info(header + "") - continue - } - if repo.CheckDirty() { - log.Info(header + "") - continue - } - log.Info(header + "") - check := me.forge.FindByGoPath(repo.GetGoPath()) - if check == nil { - log.Info("boo, you didn't git clone", repo.GetGoPath()) - continue - } - me.forge.StandardReleaseHeader(check, repo.State()) - } - log.Info(fmt.Sprintf("EVERYTHING WORKED repo count = %d", count)) -} diff --git a/prepareRelease.go b/prepareRelease.go index a2ca20c..e85a660 100644 --- a/prepareRelease.go +++ b/prepareRelease.go @@ -129,5 +129,4 @@ func rePrepareRelease() { } } - me.forge.ConfigSave() }