http writes moved to 'log'
This commit is contained in:
parent
66bd2481ae
commit
a95bed236f
|
@ -2,7 +2,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -12,8 +11,8 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func doRelease(w http.ResponseWriter) bool {
|
func doRelease() bool {
|
||||||
msg(w, "doRelease() on", me.current.Name())
|
log.Info("doRelease() on", me.current.Name())
|
||||||
// double check release version logic
|
// double check release version logic
|
||||||
if me.release.releaseVersionB.String() != "release version "+me.release.version.String() {
|
if me.release.releaseVersionB.String() != "release version "+me.release.version.String() {
|
||||||
log.Warn("something went wrong with the release.version:", me.release.version.String())
|
log.Warn("something went wrong with the release.version:", me.release.version.String())
|
||||||
|
|
57
http.go
57
http.go
|
@ -16,15 +16,6 @@ func cleanURL(url string) string {
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
// send stuff to the socket and stdout
|
|
||||||
func msg(w http.ResponseWriter, a ...any) {
|
|
||||||
if w == nil {
|
|
||||||
log.Info(a)
|
|
||||||
} else {
|
|
||||||
fmt.Fprintln(w, a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func okHandler(w http.ResponseWriter, r *http.Request) {
|
func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
var route string
|
var route string
|
||||||
route = cleanURL(r.URL.Path)
|
route = cleanURL(r.URL.Path)
|
||||||
|
@ -63,11 +54,11 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
repo := loop.Repo()
|
repo := loop.Repo()
|
||||||
tempWin.View.ShowRepo(repo)
|
tempWin.View.ShowRepo(repo)
|
||||||
log.Info("UnmergedRepo: "+repo.Name())
|
log.Info("UnmergedRepo: " + repo.Name())
|
||||||
}
|
}
|
||||||
case "/doRelease":
|
case "/doRelease":
|
||||||
buttonDisable()
|
buttonDisable()
|
||||||
if doRelease(w) {
|
if doRelease() {
|
||||||
buttonEnable()
|
buttonEnable()
|
||||||
log.Info("doRelease() worked")
|
log.Info("doRelease() worked")
|
||||||
} else {
|
} else {
|
||||||
|
@ -81,10 +72,10 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
log.Info("findNext() did not find a repo. You might be finished?")
|
log.Info("findNext() did not find a repo. You might be finished?")
|
||||||
}
|
}
|
||||||
log.Info("repo: "+me.release.repo.String())
|
log.Info("repo: " + me.release.repo.String())
|
||||||
log.Info("name: "+me.release.version.String())
|
log.Info("name: " + me.release.version.String())
|
||||||
log.Info("notes: "+me.release.notes.String())
|
log.Info("notes: " + me.release.notes.String())
|
||||||
log.Info("status: "+me.release.status.String())
|
log.Info("status: " + me.release.status.String())
|
||||||
|
|
||||||
if me.current == nil {
|
if me.current == nil {
|
||||||
log.Info("findNext() == nil")
|
log.Info("findNext() == nil")
|
||||||
|
@ -97,9 +88,9 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
me.repos.View.ScanRepositories()
|
me.repos.View.ScanRepositories()
|
||||||
case "/setCurrentRepo":
|
case "/setCurrentRepo":
|
||||||
|
|
||||||
log.Info("repo: "+repoName)
|
log.Info("repo: " + repoName)
|
||||||
log.Info("version: "+version)
|
log.Info("version: " + version)
|
||||||
log.Info("comment: "+comment)
|
log.Info("comment: " + comment)
|
||||||
|
|
||||||
repo := me.repos.View.FindRepoByName(repoName)
|
repo := me.repos.View.FindRepoByName(repoName)
|
||||||
if repo == nil {
|
if repo == nil {
|
||||||
|
@ -109,12 +100,12 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
setCurrentRepo(repo, "HTTP", "doRelease() ?")
|
setCurrentRepo(repo, "HTTP", "doRelease() ?")
|
||||||
case "/IncrementRevisonVersion":
|
case "/IncrementRevisonVersion":
|
||||||
log.Info("repo: "+repoName)
|
log.Info("repo: " + repoName)
|
||||||
log.Info("version: "+version)
|
log.Info("version: " + version)
|
||||||
me.current.Status.IncrementRevisionVersion(comment)
|
me.current.Status.IncrementRevisionVersion(comment)
|
||||||
case "/IncrementMinorVersion":
|
case "/IncrementMinorVersion":
|
||||||
log.Info("repo: "+repoName)
|
log.Info("repo: " + repoName)
|
||||||
log.Info("version: "+version)
|
log.Info("version: " + version)
|
||||||
|
|
||||||
me.current.Status.IncrementMinorVersion("trying minor")
|
me.current.Status.IncrementMinorVersion("trying minor")
|
||||||
case "/setAllBranchesToMaster":
|
case "/setAllBranchesToMaster":
|
||||||
|
@ -127,15 +118,15 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
case "/setTargetVersion":
|
case "/setTargetVersion":
|
||||||
log.Info("repo: "+repoName)
|
log.Info("repo: " + repoName)
|
||||||
log.Info("version: "+version)
|
log.Info("version: " + version)
|
||||||
if me.current == nil {
|
if me.current == nil {
|
||||||
log.Info("me.current == nil")
|
log.Info("me.current == nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
me.current.Status.SetTargetVersion(version)
|
me.current.Status.SetTargetVersion(version)
|
||||||
case "/setAllTargetVersions":
|
case "/setAllTargetVersions":
|
||||||
log.Info("version: "+version)
|
log.Info("version: " + version)
|
||||||
|
|
||||||
loop := me.repos.View.ReposSortByName()
|
loop := me.repos.View.ReposSortByName()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
|
@ -155,17 +146,17 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Info("FindRepoByName() returned nil")
|
log.Info("FindRepoByName() returned nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("whitelisted "+repo.Name())
|
log.Info("whitelisted " + repo.Name())
|
||||||
if whitelist == "false" {
|
if whitelist == "false" {
|
||||||
repo.Status.Whitelist = false
|
repo.Status.Whitelist = false
|
||||||
} else {
|
} else {
|
||||||
repo.Status.Whitelist = true
|
repo.Status.Whitelist = true
|
||||||
}
|
}
|
||||||
case "/showNext":
|
case "/showNext":
|
||||||
log.Info("gui repo: "+me.release.repo.String())
|
log.Info("gui repo: " + me.release.repo.String())
|
||||||
log.Info("gui name: "+me.release.version.String())
|
log.Info("gui name: " + me.release.version.String())
|
||||||
log.Info("gui notes: "+me.release.notes.String())
|
log.Info("gui notes: " + me.release.notes.String())
|
||||||
log.Info("gui status: "+me.release.status.String())
|
log.Info("gui status: " + me.release.status.String())
|
||||||
log.Info("")
|
log.Info("")
|
||||||
if me.current == nil {
|
if me.current == nil {
|
||||||
log.Info("me.current == nil")
|
log.Info("me.current == nil")
|
||||||
|
@ -218,9 +209,9 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Info(repolist.ReleaseReportHeader())
|
log.Info(repolist.ReleaseReportHeader())
|
||||||
log.Info(me.current.StandardReleaseHeader())
|
log.Info(me.current.StandardReleaseHeader())
|
||||||
case "/list":
|
case "/list":
|
||||||
me.repos.View.PrintReport(w, readonly, onlydirty, perfect)
|
me.repos.View.PrintReport(readonly, onlydirty, perfect)
|
||||||
case "/releaseList":
|
case "/releaseList":
|
||||||
me.repos.View.PrintReleaseReport(w, readonly, perfect)
|
me.repos.View.PrintReleaseReport(readonly, perfect)
|
||||||
case "/quit":
|
case "/quit":
|
||||||
log.Info("Got URL /quit")
|
log.Info("Got URL /quit")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
@ -254,7 +245,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
log.Info("BAD URL = "+route)
|
log.Info("BAD URL = " + route)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ func createReleaseBox(box *gui.Node) {
|
||||||
|
|
||||||
me.release.releaseVersionB = me.release.grid.NewButton("release version", func() {
|
me.release.releaseVersionB = me.release.grid.NewButton("release version", func() {
|
||||||
buttonDisable()
|
buttonDisable()
|
||||||
if doRelease(nil) {
|
if doRelease() {
|
||||||
buttonEnable()
|
buttonEnable()
|
||||||
log.Info("doRelease() worked")
|
log.Info("doRelease() worked")
|
||||||
} else {
|
} else {
|
||||||
|
@ -146,7 +146,7 @@ func createReleaseBox(box *gui.Node) {
|
||||||
// incase something, somewhere, goes wrong
|
// incase something, somewhere, goes wrong
|
||||||
duration := repolist.TimeFunction(func() {
|
duration := repolist.TimeFunction(func() {
|
||||||
for n := 0; n <= len(me.repos.View.AllRepos()); n++ {
|
for n := 0; n <= len(me.repos.View.AllRepos()); n++ {
|
||||||
if doRelease(nil) {
|
if doRelease() {
|
||||||
log.Info("doRelease() worked")
|
log.Info("doRelease() worked")
|
||||||
} else {
|
} else {
|
||||||
if me.release.status.String() == "ALL DONE?" {
|
if me.release.status.String() == "ALL DONE?" {
|
||||||
|
|
Loading…
Reference in New Issue