hardcoded path is now hook struct property...

This commit is contained in:
Marcell Mars 2021-03-20 23:28:33 +01:00
parent c61d9ec19b
commit 24ad682cb4
1 changed files with 8 additions and 5 deletions

View File

@ -23,19 +23,22 @@ The `sphook` binary is only tested on Linux virtual server and developer's lapto
```
If you want to build it against another directory where Hugo will render its content you should manually find the line:
```
outDir := filepath.Join("/", "var", "www", "html", "sandpoints")
hook.PublicHTMLPath = filepath.Join("/var", "www", "html", "sandpoints")
```
change it there and rebuild it.
## Two scenarios: post-commit (local) & post-receive (gitea)
`sphook` should work as it is for two scenarios:
- _bare_ git repository and in our case we run it against the `gitea` instances (git web frontend).
- Gitea keeps its `post-receive` hooks inside the `hooks/post-receive.d/` directory relative to particular _bare_ git repository. `sphook` should land there as it is, no need to change the name, and it will run after every remote `git push` into the repo.
- _working_ git repository
- that's usually a contributor running the local instance of a git repository. In order for `sphinx` to work as `post-commit` hook it should be placed inside `.git/hooks/` directory, renamed to `post-commit` and made executable (`chmod +x post-commit`). Hugo, via that hook, will render its output into:
`/var/www/html/sandpoints/{hugo_project_name}-{`\`crc32.ChecksumIEEE(git_repo_path)\`}`.
`/var/www/html/sandpoints/{hugo_project_name}-{`\`crc32.ChecksumIEEE(git_repo_path)\`}`.
## Install `sphook` in Gitea via its web ui