guireleaser/main.go

91 lines
1.8 KiB
Go
Raw Normal View History

package main
import (
"embed"
"fmt"
"strings"
"time"
"go.wit.com/gui"
"go.wit.com/log"
)
// TODO: autocompute these in the gui
var releaseReasonS string = "deb packager"
var releaseVersion string = "0.20.3"
var widgetVersion string = "1.1.18"
//go:embed resources/*
var resToolkit embed.FS
func main() {
me = new(autoType)
me.allrepos = make(map[string]*repo)
me.myGui = gui.New()
me.myGui.InitEmbed(resToolkit)
me.myGui.Default()
me.mainWindow = me.myGui.NewWindow("GUI release manager")
me.mainBox = me.mainWindow.NewBox("bw hbox", true)
globalDisplayOptions(me.mainBox)
repoworld()
me.releaseReasonS = releaseReasonS
for _, repo := range me.allrepos {
repo.status.UpdateCurrent()
repo.newScan()
if repo.String() == "go.wit.com/widget" {
repo.targetVersion.SetText("v" + widgetVersion)
} else {
repo.targetVersion.SetText("v" + releaseVersion)
}
if strings.HasPrefix(repo.String(), "go.wit.com/dev/") {
lasttag := repo.status.GetLastTagVersion()
repo.targetVersion.SetText(lasttag)
}
// if repo.String() == "go.wit.com/apps/guireleaser" {
}
log.Info("Creating the Release Window")
createReleaseBox(me.mainBox)
createUnreleaseBox(me.mainBox)
showHideRepos()
release.openrepo.Disable()
// scan repos every 30 seconds
// check every second for the checkbox changing
var i int = 60
myTicker(1*time.Second, "newScan()", func() {
i += 1
if !me.scanEveryMinute.Checked() {
if i < 60 {
i = 60
}
// print every 13 seconds
if i%13 == 0 {
log.Info("Not auto scanning", i)
}
return
}
if i < 60 {
return
}
i = 0
duration := timeFunction(func() {
scanGoSum()
for _, repo := range me.allrepos {
repo.newScan()
}
})
s := fmt.Sprint(duration)
me.autoWorkingPwd.SetText(s)
})
}