symlink bug fixed. introduced versions and templateMetrics for hugo...

This commit is contained in:
Marcell Mars 2020-12-22 00:47:04 +01:00
parent bb37d67e41
commit 15b26fbdd2
2 changed files with 8 additions and 5 deletions

13
main.go
View file

@ -21,8 +21,13 @@ import (
"github.com/spf13/viper"
)
var (
version = "20.12.23"
)
func check(e error) {
if e != nil {
fmt.Printf("\nGit hook version: %s\n~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~\n", version)
log.Fatal(e)
panic(e)
}
@ -178,7 +183,7 @@ func main() {
}()
hugoGiteaLogs := cage.Start()
respGitea := commands.Execute([]string{"-s", tmpRepoPath, "-d", tmpHugoGiteaPath, "-e", "gitea"})
respGitea := commands.Execute([]string{"-s", tmpRepoPath, "-d", tmpHugoGiteaPath, "-e", "gitea", "--templateMetrics"})
cage.Stop(hugoGiteaLogs)
if respGitea.Err != nil {
@ -196,7 +201,7 @@ func main() {
check(err)
}
} else if _, err := os.Lstat(filepath.Join(outDir, outSandpointsDir, "_preview")); err == nil {
err := os.Remove(filepath.Join(outDir, outSandpointsDir, "_preview"))
err := os.RemoveAll(filepath.Join(outDir, outSandpointsDir, "_preview"))
check(err)
} else if _, err := os.Stat(filepath.Join(outDir, outSandpointsDir, "_preview")); err == nil {
err := os.RemoveAll(filepath.Join(outDir, outSandpointsDir, "_preview"))
@ -211,8 +216,6 @@ func main() {
if sandpointsCatalogPrefix != "" && sandpointsCatalogName != "" {
err = os.Symlink(filepath.Join(outDir, "libraries", sandpointsCatalogName), filepath.Join(outDir, outSandpointsDir, sandpointsCatalogPrefix))
check(err)
err = os.Symlink(filepath.Join(outDir, "libraries", sandpointsCatalogName), filepath.Join(outDir, outSandpointsDir, "_preview", sandpointsCatalogPrefix))
check(err)
}
} else {
err = os.MkdirAll(filepath.Join(outDir, outSandpointsDir), 0755)
@ -226,5 +229,5 @@ func main() {
}
durationMillseconds := int64(time.Since(startTime) / time.Millisecond)
logLines = logLines + fmt.Sprintf("Total processing time: %d ms", durationMillseconds)
logLines = logLines + fmt.Sprintf("Total processing time: %d ms\n\nGit hook version: %s\n~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~\n", durationMillseconds, version)
}

BIN
sphook

Binary file not shown.