keep working on why this doesn't work anymore

This commit is contained in:
Jeff Carr 2025-01-08 02:39:30 -06:00
parent 3d94edd024
commit 2c71c4a5fe
4 changed files with 19 additions and 157 deletions

View File

@ -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)

104
http.go
View File

@ -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"))
}
*/

View File

@ -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))
}

View File

@ -129,5 +129,4 @@ func rePrepareRelease() {
}
}
me.forge.ConfigSave()
}