You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
670 B

  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "path/filepath"
  6. )
  7. func writeLogToFile(logLines, path string) {
  8. lastPublishCommitLog, err := os.Create(filepath.Join(path, "last-commit-log.txt"))
  9. check(err)
  10. defer lastPublishCommitLog.Close()
  11. fmt.Fprintln(lastPublishCommitLog, logLines)
  12. }
  13. func writeLastCommitLog(logLines string, isBare bool, hugo *Hugo, hook *Hook) {
  14. if isBare {
  15. if hook.Publish {
  16. writeLogToFile(logLines, filepath.Join(hook.PublicHTMLPath, hugo.PublicHTMLName))
  17. } else {
  18. writeLogToFile(logLines, filepath.Join(hook.PublicHTMLPath, hugo.PublicHTMLName, "_preview"))
  19. }
  20. } else {
  21. writeLogToFile(logLines, filepath.Join(hugo.DestinationDir))
  22. }
  23. }