summaryrefslogtreecommitdiff
path: root/checkReady.go
diff options
context:
space:
mode:
Diffstat (limited to 'checkReady.go')
-rw-r--r--checkReady.go54
1 files changed, 44 insertions, 10 deletions
diff --git a/checkReady.go b/checkReady.go
index 11c1fca..2f7bde7 100644
--- a/checkReady.go
+++ b/checkReady.go
@@ -2,6 +2,9 @@
package main
import (
+ "os"
+ "path/filepath"
+
"go.wit.com/log"
)
@@ -15,34 +18,65 @@ func CheckReady() bool {
lastS := release.current.status.GetLastTagVersion()
log.Info("repo:", release.current.String(), goSumS, dirtyS, lastS)
- if dirtyS == "ready to tag version" {
- log.Info("\trepo is ready", release.current.String(), goSumS, dirtyS, lastS)
- } else {
- return false
- }
-
if release.current.status.ReadOnly() {
log.Info("\trepo is read only")
return false
}
if release.versionS == lastS {
- log.Info("\trepo is already done")
+ log.Info("\trepo is already done", lastS, "=", release.versionS)
return false
}
if goSumS == "BAD" {
- log.Info("\trepo is ready", release.current.String(), goSumS, dirtyS, lastS)
+ log.Info("\trepo is ready", release.current.String(), "BAD == BAD")
} else {
- log.Info("\trepo is ready maybe", release.current.String(), goSumS, dirtyS, lastS)
+ log.Info("\trepo is ready maybe", release.current.String(), "BAD !=", goSumS)
}
if release.current.status.CheckDirty() {
log.Info("\trepo is dirty")
return false
} else {
- log.Info("\trepo is ready", release.current.String(), goSumS, dirtyS, lastS)
+ log.Info("\trepo is ready", release.current.String(), "not dirty")
+ }
+
+ fullpath := filepath.Join(me.goSrcPwd.String(), release.current.String())
+
+ testf := filepath.Join(fullpath, "go.mod")
+ if Exists(testf) {
+ log.Info("\trepo is not ready. go.mod exists")
+ return false
}
+ testf = filepath.Join(fullpath, "go.sum")
+ if Exists(testf) {
+ log.Info("\trepo is not ready. go.sum exists")
+ return false
+ }
+
+ testf = filepath.Join(fullpath, "LICENSE")
+ if ! Exists(testf) {
+ log.Info("\trepo is not ready. missing LICENSE")
+ return false
+ }
+
+
+ // final checks here
+ if dirtyS == "ready to tag version" {
+ log.Info("\trepo is ready", release.current.String(), "ready to tag version")
+ } else {
+ return false
+ }
+
+ return true
+}
+
+// returns true if the file exists
+func Exists(file string) bool {
+ _, err := os.Stat(file)
+ if err != nil {
+ return false
+ }
return true
}