diff --git a/main.go b/main.go index 1435825..966c934 100644 --- a/main.go +++ b/main.go @@ -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) } diff --git a/sphook b/sphook index 5d79e83..7a16f49 100755 Binary files a/sphook and b/sphook differ