summaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'http.go')
-rw-r--r--http.go98
1 files changed, 14 insertions, 84 deletions
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,28 +117,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
}
}
-// starts and sits waiting for HTTP requests
-func startHTTP() {
- http.HandleFunc("/", okHandler)
-
- p := fmt.Sprintf(":%d", argv.Port)
- log.Println("Running on port", p)
-
- err := http.ListenAndServe(p, nil)
- if err != nil {
- 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
- }
-
+func testGoRepo(check *gitpb.Repo) {
data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod"))
log.Info(string(data))
@@ -147,67 +129,15 @@ func testNext() {
}
-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
- }
+// starts and sits waiting for HTTP requests
+func startHTTP() {
+ http.HandleFunc("/", okHandler)
- check := me.forge.FindByGoPath(me.current.GetGoPath())
- if check == nil {
- log.Info("forge: how was this not found?", me.current.GetGoPath())
- return
- }
+ p := fmt.Sprintf(":%d", argv.Port)
+ log.Println("Running on port", p)
- 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))
- }
+ err := http.ListenAndServe(p, nil)
+ if err != nil {
+ log.Println("Error starting server:", err)
}
-
- testNext()
-
- log.Info(repolist.ReportHeader())
- log.Info("")
- log.Info(repolist.ReleaseReportHeader())
- log.Info(me.forge.StandardReleaseHeader(me.current, "notsure"))
}
-*/