remote msg()

This commit is contained in:
Jeff Carr 2024-11-07 03:32:00 -06:00
parent 9d1b3c0359
commit 66bd2481ae
2 changed files with 87 additions and 84 deletions

View File

@ -174,9 +174,11 @@ func doPublishVersion() bool {
if gopath == "go.wit.com/apps/guireleaser" {
log.Info("CAN NOT SELF UPDATE. cmd =", cmd)
log.Info("go get must be run from somewhere else other than guireleaser")
log.Info("fix this!")
os.Exit(-1)
}
err, ok, output := shell.RunCmd("", cmd)
log.Info("err =", err)
log.Info("ok =", ok)
log.Info("output =", output)
} else {
// publish go.mod & go.sum for use with go
os.Unsetenv("GO111MODULE")
log.Info("TRYING TO SELF UPDATE HERE. cmd =", cmd)
@ -187,6 +189,7 @@ func doPublishVersion() bool {
err = nil
}
}
}
if err == nil {
log.Info("SELF UPDATE OK. out =", out)
log.Info("SELF UPDATE WORKED")

146
http.go
View File

@ -42,20 +42,20 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
switch route {
case "/help":
msg(w, "list/ list modified repos")
msg(w, "list?readonly=true shows every repo")
msg(w, "")
msg(w, "doRelease runs doRelease()")
msg(w, "findNext runs findNext()")
msg(w, "showNext shows the repo for doRelease()")
msg(w, "setTargetVersion set the target version for findNext()")
msg(w, "setAllTargetVersions?version=v0.12.4 set ever repo to target version")
msg(w, "setCurrentRepo?repo=go.wit.com/gui runs setCurrentRepo(repo)")
msg(w, "")
msg(w, "setAllBranchesToMaster git checkout master on every repo")
msg(w, "")
msg(w, "setVersion?repo=go.wit.com/gui?target=0.2 attempts to set the target version to 0.2")
msg(w, "")
log.Info("list/ list modified repos")
log.Info("list?readonly=true shows every repo")
log.Info("")
log.Info("doRelease runs doRelease()")
log.Info("findNext runs findNext()")
log.Info("showNext shows the repo for doRelease()")
log.Info("setTargetVersion set the target version for findNext()")
log.Info("setAllTargetVersions?version=v0.12.4 set ever repo to target version")
log.Info("setCurrentRepo?repo=go.wit.com/gui runs setCurrentRepo(repo)")
log.Info("")
log.Info("setAllBranchesToMaster git checkout master on every repo")
log.Info("")
log.Info("setVersion?repo=go.wit.com/gui?target=0.2 attempts to set the target version to 0.2")
log.Info("")
case "/tempWin":
tempWin := makeTempView()
@ -63,62 +63,62 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
for loop.Scan() {
repo := loop.Repo()
tempWin.View.ShowRepo(repo)
msg(w, "UnmergedRepo: "+repo.Name())
log.Info("UnmergedRepo: "+repo.Name())
}
case "/doRelease":
buttonDisable()
if doRelease(w) {
buttonEnable()
msg(w, "doRelease() worked")
log.Info("doRelease() worked")
} else {
msg(w, "doRelease() failed")
log.Info("doRelease() failed")
}
case "/findNext":
me.Disable()
defer me.Enable()
if findNext() {
msg(w, "findNext() found a repo")
log.Info("findNext() found a repo")
} else {
msg(w, "findNext() did not find a repo. You might be finished?")
log.Info("findNext() did not find a repo. You might be finished?")
}
msg(w, "repo: "+me.release.repo.String())
msg(w, "name: "+me.release.version.String())
msg(w, "notes: "+me.release.notes.String())
msg(w, "status: "+me.release.status.String())
log.Info("repo: "+me.release.repo.String())
log.Info("name: "+me.release.version.String())
log.Info("notes: "+me.release.notes.String())
log.Info("status: "+me.release.status.String())
if me.current == nil {
msg(w, "findNext() == nil")
log.Info("findNext() == nil")
return
}
msg(w, me.current.StandardHeader())
msg(w, me.current.StandardReleaseHeader())
log.Info(me.current.StandardHeader())
log.Info(me.current.StandardReleaseHeader())
case "/rescanAll":
me.repos.View.ScanRepositories()
case "/setCurrentRepo":
msg(w, "repo: "+repoName)
msg(w, "version: "+version)
msg(w, "comment: "+comment)
log.Info("repo: "+repoName)
log.Info("version: "+version)
log.Info("comment: "+comment)
repo := me.repos.View.FindRepoByName(repoName)
if repo == nil {
msg(w, "FindRepoByName() returned nil")
log.Info("FindRepoByName() returned nil")
return
}
setCurrentRepo(repo, "HTTP", "doRelease() ?")
case "/IncrementRevisonVersion":
msg(w, "repo: "+repoName)
msg(w, "version: "+version)
log.Info("repo: "+repoName)
log.Info("version: "+version)
me.current.Status.IncrementRevisionVersion(comment)
case "/IncrementMinorVersion":
msg(w, "repo: "+repoName)
msg(w, "version: "+version)
log.Info("repo: "+repoName)
log.Info("version: "+version)
me.current.Status.IncrementMinorVersion("trying minor")
case "/setAllBranchesToMaster":
msg(w, "set all branches to master")
log.Info("set all branches to master")
me.Disable()
defer me.Enable()
if setAllBranchesToMaster() {
@ -127,15 +127,15 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
}
return
case "/setTargetVersion":
msg(w, "repo: "+repoName)
msg(w, "version: "+version)
log.Info("repo: "+repoName)
log.Info("version: "+version)
if me.current == nil {
msg(w, "me.current == nil")
log.Info("me.current == nil")
return
}
me.current.Status.SetTargetVersion(version)
case "/setAllTargetVersions":
msg(w, "version: "+version)
log.Info("version: "+version)
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
@ -152,77 +152,77 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
case "/whitelist":
repo := me.repos.View.FindRepoByName(repoName)
if repo == nil {
msg(w, "FindRepoByName() returned nil")
log.Info("FindRepoByName() returned nil")
return
}
msg(w, "whitelisted "+repo.Name())
log.Info("whitelisted "+repo.Name())
if whitelist == "false" {
repo.Status.Whitelist = false
} else {
repo.Status.Whitelist = true
}
case "/showNext":
msg(w, "gui repo: "+me.release.repo.String())
msg(w, "gui name: "+me.release.version.String())
msg(w, "gui notes: "+me.release.notes.String())
msg(w, "gui status: "+me.release.status.String())
msg(w, "")
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 {
msg(w, "me.current == nil")
log.Info("me.current == nil")
return
}
if checkValidGoSum(me.current) {
msg(w, "checkValidGoSum() == true")
log.Info("checkValidGoSum() == true")
} else {
msg(w, "checkValidGoSum() == false SHOULD NOT RELEASE THIS")
log.Info("checkValidGoSum() == false SHOULD NOT RELEASE THIS")
}
if me.current.Status.IsReleased() {
msg(w, "IsReleased() == true SHOULD NOT RELEASE THIS")
log.Info("IsReleased() == true SHOULD NOT RELEASE THIS")
} else {
msg(w, "IsReleased() == false")
log.Info("IsReleased() == false")
}
if me.current.Status.CheckDirty() {
msg(w, "CheckDirty() == true. SHOULD NOT RELEASE THIS")
log.Info("CheckDirty() == true. SHOULD NOT RELEASE THIS")
} else {
msg(w, "CheckDirty() == false")
log.Info("CheckDirty() == false")
}
if me.current.Status.IsPrimitive() {
msg(w, "IsPrimitive() == true")
log.Info("IsPrimitive() == true")
} else {
msg(w, "IsPrimitive() == false")
log.Info("IsPrimitive() == false")
}
if ok, compiled, err := me.current.Status.IsProtobuf(); ok {
msg(w, log.Sprint("IsProtobuf() == true compiled protobuf files = ", compiled))
log.Info(log.Sprint("IsProtobuf() == true compiled protobuf files = ", compiled))
if err != nil {
msg(w, log.Sprint("IsProtobuf() == err", err))
log.Info(log.Sprint("IsProtobuf() == err", err))
os.Exit(-1)
}
for _, s := range compiled {
log.Info("\tcompiled file found:", s)
}
} else {
msg(w, "IsProtobuf() == false")
msg(w, log.Sprint("IsProtobuf() == err", err))
log.Info("IsProtobuf() == false")
log.Info(log.Sprint("IsProtobuf() == err", err))
}
if me.current.Status.Whitelist {
msg(w, "Whitelist == true SHOULD NOT RELEASE THIS")
log.Info("Whitelist == true SHOULD NOT RELEASE THIS")
} else {
msg(w, "Whitelist == false")
log.Info("Whitelist == false")
}
msg(w, "")
log.Info("")
msg(w, repolist.ReportHeader())
msg(w, me.current.StandardHeader())
msg(w, "")
msg(w, repolist.ReleaseReportHeader())
msg(w, me.current.StandardReleaseHeader())
log.Info(repolist.ReportHeader())
log.Info(me.current.StandardHeader())
log.Info("")
log.Info(repolist.ReleaseReportHeader())
log.Info(me.current.StandardReleaseHeader())
case "/list":
me.repos.View.PrintReport(w, readonly, onlydirty, perfect)
case "/releaseList":
me.repos.View.PrintReleaseReport(w, readonly, perfect)
case "/quit":
msg(w, "Got URL /quit")
log.Info("Got URL /quit")
os.Exit(0)
case "/goweblist":
loop := me.repos.View.ReposAll()
@ -233,7 +233,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
tag := repo.Status.NewestTag()
gitAge, err := tag.GetDate()
if err != nil {
msg(w, fmt.Sprintf("tag date error", repo.Name()))
log.Info(fmt.Sprintf("tag date error", repo.Name()))
}
// if lastTag == "" {
// lastTag = tag.Name()
@ -244,17 +244,17 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
}
}
// dur := time.Since(gitAge)
// msg(w, fmt.Sprintf("%-60s %s %s %s", repo.Name(), lastTag, shell.FormatDuration(dur), lastTag, tag.Name()))
msg(w, fmt.Sprintf("%s %d %s", repo.Name(), gitAge.Unix(), lastTag))
// log.Info(fmt.Sprintf("%-60s %s %s %s", repo.Name(), lastTag, shell.FormatDuration(dur), lastTag, tag.Name()))
log.Info(fmt.Sprintf("%s %d %s", repo.Name(), gitAge.Unix(), lastTag))
/*
for _, tag := range repo.Tags.ListAll() {
msg(w, fmt.Sprintf("%-60s %s", "", tag.Name()))
log.Info(fmt.Sprintf("%-60s %s", "", tag.Name()))
}
*/
}
default:
msg(w, "BAD URL = "+route)
log.Info("BAD URL = "+route)
}
}