summaryrefslogtreecommitdiff
path: root/checkReady.go
diff options
context:
space:
mode:
Diffstat (limited to 'checkReady.go')
-rw-r--r--checkReady.go65
1 files changed, 24 insertions, 41 deletions
diff --git a/checkReady.go b/checkReady.go
index 0b5a879..69f42f8 100644
--- a/checkReady.go
+++ b/checkReady.go
@@ -7,44 +7,27 @@ import (
"go.wit.com/log"
)
-func ReCheckReady() bool {
- return false
-}
-
-/*
-- // allrepos map[string]*repo
--
-- keys := make([]string, 0, len(me.allrepos))
-- for key := range me.allrepos {
-- keys = append(keys, key)
-- }
-- sort.Strings(keys)
--
-- for _, path := range keys {
-- repo := me.allrepos[path]
-*/
-
func CheckReady() bool {
- if release.current == nil {
+ if me.current == nil {
log.Info("find the next repo first")
return false
}
- goSumS := release.current.GoState()
- dirtyS := release.current.State()
- lastS := release.current.Status.GetLastTagVersion()
- currentS := release.current.Status.GetCurrentBranchVersion()
+ goSumS := me.current.GoState()
+ dirtyS := me.current.State()
+ lastS := me.current.Status.GetLastTagVersion()
+ currentS := me.current.Status.GetCurrentBranchVersion()
var targetS string
- targetS = release.version.String()
+ targetS = me.release.version.String()
- log.Info("repo:", release.current.State(), goSumS, dirtyS, lastS, currentS, targetS)
+ log.Info("repo:", me.current.State(), goSumS, dirtyS, lastS, currentS, targetS)
if goSumS == "RELEASED" {
return true
}
- if release.current.Status.IsPrimitive() {
+ if me.current.Status.IsPrimitive() {
if targetS == lastS {
- release.current.SetGoState("RELEASED")
+ me.current.SetGoState("RELEASED")
}
return true
}
@@ -53,45 +36,45 @@ func CheckReady() bool {
}
if goSumS == "READY" {
if targetS == lastS {
- release.current.SetGoState("RELEASED")
+ me.current.SetGoState("RELEASED")
return true
}
if lastS == currentS {
- release.current.SetGoState("UNRELEASED")
+ me.current.SetGoState("UNRELEASED")
}
return true
}
- release.current.SetGoState("NOT READY")
- if release.current.Status.ReadOnly() {
+ me.current.SetGoState("NOT READY")
+ if me.current.Status.ReadOnly() {
log.Info("\trepo is read only")
return false
}
if targetS == lastS {
log.Info("\trepo is already done", lastS, "=", targetS)
- release.current.SetGoState("READY")
+ me.current.SetGoState("READY")
return true
}
if lastS == currentS {
log.Info("\trepo is already done", lastS, "=", targetS)
- release.current.SetGoState("READY")
+ me.current.SetGoState("READY")
return true
}
if goSumS == "BAD" {
- log.Info("\trepo is ready", release.current.State(), "BAD == BAD")
+ log.Info("\trepo is ready", me.current.State(), "BAD == BAD")
} else {
- log.Info("\trepo is ready maybe", release.current.State(), "BAD !=", goSumS)
+ log.Info("\trepo is ready maybe", me.current.State(), "BAD !=", goSumS)
}
- if release.current.Status.CheckDirty() {
+ if me.current.Status.CheckDirty() {
log.Info("\trepo is dirty")
return false
} else {
- log.Info("\trepo is ready", release.current.State(), "not dirty")
+ log.Info("\trepo is ready", me.current.State(), "not dirty")
}
- fullpath := filepath.Join(me.goSrcPwd.String(), release.current.State())
+ fullpath := filepath.Join(me.goSrcPwd.String(), me.current.State())
testf := filepath.Join(fullpath, "go.mod")
if Exists(testf) {
@@ -113,14 +96,14 @@ func CheckReady() bool {
// final checks here
if dirtyS == "unchanged" {
- log.Info("\trepo is ready", release.current.Name(), "unchanged")
+ log.Info("\trepo is ready", me.current.Name(), "unchanged")
} else {
log.Info("\trepo is not ready", dirtyS, "!= 'unchanged'")
return false
}
- curName := release.current.Status.GetCurrentBranchName()
- mName := release.current.Status.GetMasterBranchName()
+ curName := me.current.Status.GetCurrentBranchName()
+ mName := me.current.Status.GetMasterBranchName()
if curName == mName {
log.Info("\trepo is ready working from main branch", curName, "=", mName)
@@ -129,7 +112,7 @@ func CheckReady() bool {
return false
}
- release.current.SetGoState("READY")
+ me.current.SetGoState("READY")
return true
}