move code into forgepb
This commit is contained in:
parent
bc710a8fd2
commit
a0428fa5f6
19
doRelease.go
19
doRelease.go
|
@ -8,8 +8,6 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-cmd/cmd"
|
||||
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/log"
|
||||
|
@ -140,20 +138,6 @@ func doRelease() bool {
|
|||
}
|
||||
}
|
||||
|
||||
pb := me.forge.FindByGoPath(me.current.GetGoPath())
|
||||
if pb != nil {
|
||||
// pb.UpdatePublished()
|
||||
/* remove. earlier protected against nil
|
||||
if !pb.IsPrimitive() {
|
||||
loop := pb.Published.SortByGoPath()
|
||||
for loop.Scan() {
|
||||
t := loop.Next()
|
||||
log.Info("new Published dep:", t.GetGoPath(), t.GetVersion())
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
log.Info("PUBLISH OK")
|
||||
// me.current.SetGoState("RELEASED")
|
||||
|
||||
|
@ -267,7 +251,6 @@ func doPublishVersion() bool {
|
|||
}
|
||||
|
||||
// try to pull from google
|
||||
var result cmd.Status
|
||||
if gopath == me.startRepo.GetGoPath() {
|
||||
log.Info("CAN NOT SELF UPDATE. cmd =", docmd)
|
||||
log.Info("go get must be run from somewhere else other than startRepo")
|
||||
|
@ -278,7 +261,7 @@ func doPublishVersion() bool {
|
|||
// publish go.mod & go.sum for use with go
|
||||
os.Unsetenv("GO111MODULE")
|
||||
log.Info("TRYING TO SELF UPDATE HERE. cmd =", docmd)
|
||||
result = me.startRepo.Run(docmd)
|
||||
result := me.startRepo.Run(docmd)
|
||||
|
||||
if result.Error != nil {
|
||||
log.Info("SELF UPDATE FAILED. error =", result.Error)
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package main
|
||||
|
||||
// like tcl/tk, use ENV variables to set display preferences
|
||||
/*
|
||||
func hideFunction(r *repolist.RepoRow) {
|
||||
// always show dirty repos
|
||||
if r.Status.IsDirty() {
|
||||
r.Show()
|
||||
return
|
||||
}
|
||||
|
||||
// hide read-only repos
|
||||
if os.Getenv("AUTOTYPIST_READONLY") == "hide" {
|
||||
if r.Status.ReadOnly() {
|
||||
// log.Info(r.Name(), "hiding read-only repo")
|
||||
r.Hide()
|
||||
return
|
||||
} else {
|
||||
// log.Info(r.Name(), "not hiding read-only repo")
|
||||
}
|
||||
}
|
||||
|
||||
// show repos with mismatched mode
|
||||
// this means, if you are in "devel" mode, show all the repos that
|
||||
// might be stuck on the wrong branch, like 'master' or '<username>'
|
||||
if os.Getenv("AUTOTYPIST_MODE") != "" {
|
||||
if !r.Status.IsCorrectMode(os.Getenv("AUTOTYPIST_MODE")) {
|
||||
r.Show()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// show everything else. often this will be "unconforming" repos
|
||||
// if you what those repos ignored, add these to the config file
|
||||
// as read-only=true
|
||||
r.Show()
|
||||
}
|
||||
*/
|
13
http.go
13
http.go
|
@ -28,7 +28,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
repoName := r.URL.Query().Get("repo")
|
||||
version := r.URL.Query().Get("version")
|
||||
comment := r.URL.Query().Get("comment")
|
||||
whitelist := r.URL.Query().Get("whitelist")
|
||||
|
||||
switch route {
|
||||
case "/help":
|
||||
|
@ -89,18 +88,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
setCurrentRepo(repo, "HTTP", "doRelease() ?")
|
||||
return
|
||||
case "/whitelist":
|
||||
repo := me.repos.View.FindByName(repoName)
|
||||
if repo == nil {
|
||||
log.Info("FindRepoByName() returned nil")
|
||||
return
|
||||
}
|
||||
log.Info("whitelisted " + repo.Name())
|
||||
if whitelist == "false" {
|
||||
repo.Status.Whitelist = false
|
||||
} else {
|
||||
repo.Status.Whitelist = true
|
||||
}
|
||||
case "/testNext":
|
||||
testNext()
|
||||
return
|
||||
|
|
42
main.go
42
main.go
|
@ -110,23 +110,10 @@ func main() {
|
|||
me.release.box.Disable()
|
||||
me.Disable()
|
||||
|
||||
// register a Show/Hide function for the repo list table
|
||||
// me.repos.View.RegisterHideFunction(hideFunction)
|
||||
|
||||
// scan in the State of all the repos
|
||||
// TODO: should not really be necessary directly after init()
|
||||
me.repos.View.ScanRepositories()
|
||||
|
||||
loop := me.repos.View.ReposSortByName()
|
||||
for loop.Scan() {
|
||||
repo := loop.Repo()
|
||||
if me.forge.Config.IsPrivate(repo.GetGoPath()) {
|
||||
// repo.Status.SetPrivate(true)
|
||||
} else {
|
||||
// repo.Status.SetPrivate(false)
|
||||
}
|
||||
}
|
||||
|
||||
// todo: add this to forgepb
|
||||
me.startRepo = me.forge.FindWorkingDirRepo()
|
||||
|
||||
|
@ -147,32 +134,3 @@ func main() {
|
|||
// me.summary.Update()
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
// start the initail scan and make sure each repo is set
|
||||
// to the master branch
|
||||
func setAllBranchesToMaster() bool {
|
||||
var worked bool = true
|
||||
loop := me.repos.View.ReposSortByName()
|
||||
for loop.Scan() {
|
||||
repo := loop.Repo()
|
||||
if repo.ReadOnly() {
|
||||
continue
|
||||
}
|
||||
if repo.IsDirty() {
|
||||
continue
|
||||
}
|
||||
if repo.Status.Whitelist {
|
||||
continue
|
||||
}
|
||||
if repo.Status.CheckoutMaster() {
|
||||
log.Warn("git checkout master branch worked", repo.Name())
|
||||
} else {
|
||||
log.Warn("git checkout master branch failed", repo.Name())
|
||||
worked = false
|
||||
}
|
||||
// repo.NewScan()
|
||||
}
|
||||
return worked
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -107,7 +107,6 @@ func createReleaseBox(box *gui.Node) {
|
|||
// tmp := me.current.GoState()
|
||||
if repov := me.repos.View.FindByPath(me.current.GetGoPath()); repov != nil {
|
||||
log.Info("trying to whitelist repo", me.current.GetGoPath())
|
||||
repov.Status.Whitelist = true
|
||||
}
|
||||
findNext()
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue