nix: Make postgrest-watch postgrest-docs-check work

This moves the _build folder into the repo root, to avoid postgrest-watch ending in an
infinite loop of restarting the build.

Also, for repeated use during development, running linkcheck is not a good idea, this
will quickly result in rate-limiting requests from various servers.
This commit is contained in:
Wolfgang Walther
2024-02-18 16:12:20 +01:00
parent b435f1b2d4
commit c196d406d4
3 changed files with 14 additions and 15 deletions
+1
View File
@@ -23,3 +23,4 @@ coverage
.hpc .hpc
loadtest loadtest
.history .history
.docs-build
-1
View File
@@ -1,4 +1,3 @@
_build
Pipfile.lock Pipfile.lock
*.aux *.aux
*.log *.log
+13 -14
View File
@@ -35,24 +35,24 @@ let
if [ "$_arg_language" == "" ]; then if [ "$_arg_language" == "" ]; then
# clean previous build, otherwise some errors might be supressed # clean previous build, otherwise some errors might be supressed
rm -rf "_build/html/default" rm -rf "../.docs-build/html/default"
if [ -d languages ]; then if [ -d languages ]; then
# default to updating all existing locales # default to updating all existing locales
build gettext _build/gettext build gettext ../.docs-build/gettext
${python}/bin/sphinx-intl update -p _build/gettext ${python}/bin/sphinx-intl update -p ../.docs-build/gettext
fi fi
build html "_build/html/default" build html "../.docs-build/html/default"
else else
# clean previous build, otherwise some errors might be supressed # clean previous build, otherwise some errors might be supressed
rm -rf "_build/html/$_arg_language" rm -rf "../.docs-build/html/$_arg_language"
# update and build specific locale, can be used to create new locale # update and build specific locale, can be used to create new locale
build gettext _build/gettext build gettext ../.docs-build/gettext
${python}/bin/sphinx-intl update -p _build/gettext -l "$_arg_language" ${python}/bin/sphinx-intl update -p ../.docs-build/gettext -l "$_arg_language"
build html "_build/html/$_arg_language" -D "language=$_arg_language" build html "../.docs-build/html/$_arg_language" -D "language=$_arg_language"
fi fi
''; '';
@@ -78,7 +78,7 @@ let
server = Server() server = Server()
server.watch("**/*.rst", shell(build)) server.watch("**/*.rst", shell(build))
server.watch(f"locales/{locale}/LC_MESSAGES/*.po", shell(build)) server.watch(f"locales/{locale}/LC_MESSAGES/*.po", shell(build))
server.serve(root=f"_build/html/{locale}") server.serve(root=f"../.docs-build/html/{locale}")
''; '';
serve = serve =
@@ -139,7 +139,7 @@ let
workingDir = "/docs"; workingDir = "/docs";
} }
'' ''
${python}/bin/sphinx-build --color -b linkcheck . _build ${python}/bin/sphinx-build --color -b linkcheck . ../.docs-build
''; '';
check = check =
@@ -150,10 +150,9 @@ let
workingDir = "/docs"; workingDir = "/docs";
} }
'' ''
${build}/bin/postgrest-docs-build ${build}
${dictcheck}/bin/postgrest-docs-dictcheck ${dictcheck}
${linkcheck}/bin/postgrest-docs-linkcheck ${spellcheck}
${spellcheck}/bin/postgrest-docs-spellcheck
''; '';
in in