symlink bug fixed. introduced versions and templateMetrics for hugo...
This commit is contained in:
parent
bb37d67e41
commit
15b26fbdd2
2 changed files with 8 additions and 5 deletions
13
main.go
13
main.go
|
@ -21,8 +21,13 @@ import (
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
version = "20.12.23"
|
||||||
|
)
|
||||||
|
|
||||||
func check(e error) {
|
func check(e error) {
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
fmt.Printf("\nGit hook version: %s\n~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~\n", version)
|
||||||
log.Fatal(e)
|
log.Fatal(e)
|
||||||
panic(e)
|
panic(e)
|
||||||
}
|
}
|
||||||
|
@ -178,7 +183,7 @@ func main() {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
hugoGiteaLogs := cage.Start()
|
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)
|
cage.Stop(hugoGiteaLogs)
|
||||||
|
|
||||||
if respGitea.Err != nil {
|
if respGitea.Err != nil {
|
||||||
|
@ -196,7 +201,7 @@ func main() {
|
||||||
check(err)
|
check(err)
|
||||||
}
|
}
|
||||||
} else if _, err := os.Lstat(filepath.Join(outDir, outSandpointsDir, "_preview")); err == nil {
|
} 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)
|
check(err)
|
||||||
} else if _, err := os.Stat(filepath.Join(outDir, outSandpointsDir, "_preview")); err == nil {
|
} else if _, err := os.Stat(filepath.Join(outDir, outSandpointsDir, "_preview")); err == nil {
|
||||||
err := os.RemoveAll(filepath.Join(outDir, outSandpointsDir, "_preview"))
|
err := os.RemoveAll(filepath.Join(outDir, outSandpointsDir, "_preview"))
|
||||||
|
@ -211,8 +216,6 @@ func main() {
|
||||||
if sandpointsCatalogPrefix != "" && sandpointsCatalogName != "" {
|
if sandpointsCatalogPrefix != "" && sandpointsCatalogName != "" {
|
||||||
err = os.Symlink(filepath.Join(outDir, "libraries", sandpointsCatalogName), filepath.Join(outDir, outSandpointsDir, sandpointsCatalogPrefix))
|
err = os.Symlink(filepath.Join(outDir, "libraries", sandpointsCatalogName), filepath.Join(outDir, outSandpointsDir, sandpointsCatalogPrefix))
|
||||||
check(err)
|
check(err)
|
||||||
err = os.Symlink(filepath.Join(outDir, "libraries", sandpointsCatalogName), filepath.Join(outDir, outSandpointsDir, "_preview", sandpointsCatalogPrefix))
|
|
||||||
check(err)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = os.MkdirAll(filepath.Join(outDir, outSandpointsDir), 0755)
|
err = os.MkdirAll(filepath.Join(outDir, outSandpointsDir), 0755)
|
||||||
|
@ -226,5 +229,5 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
durationMillseconds := int64(time.Since(startTime) / time.Millisecond)
|
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
BIN
sphook
Binary file not shown.
Loading…
Add table
Reference in a new issue