Skip to content

Commit

Permalink
nix: Make postgrest-watch postgrest-docs-check work
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wolfgangwalther committed Feb 18, 2024
1 parent b435f1b commit c196d40
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ coverage
.hpc
loadtest
.history
.docs-build
1 change: 0 additions & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
_build
Pipfile.lock
*.aux
*.log
Expand Down
27 changes: 13 additions & 14 deletions nix/tools/docs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ let
if [ "$_arg_language" == "" ]; then
# clean previous build, otherwise some errors might be supressed
rm -rf "_build/html/default"
rm -rf "../.docs-build/html/default"
if [ -d languages ]; then
# default to updating all existing locales
build gettext _build/gettext
${python}/bin/sphinx-intl update -p _build/gettext
build gettext ../.docs-build/gettext
${python}/bin/sphinx-intl update -p ../.docs-build/gettext
fi
build html "_build/html/default"
build html "../.docs-build/html/default"
else
# 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
build gettext _build/gettext
${python}/bin/sphinx-intl update -p _build/gettext -l "$_arg_language"
build gettext ../.docs-build/gettext
${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
'';

Expand All @@ -78,7 +78,7 @@ let
server = Server()
server.watch("**/*.rst", 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 =
Expand Down Expand Up @@ -139,7 +139,7 @@ let
workingDir = "/docs";
}
''
${python}/bin/sphinx-build --color -b linkcheck . _build
${python}/bin/sphinx-build --color -b linkcheck . ../.docs-build
'';

check =
Expand All @@ -150,10 +150,9 @@ let
workingDir = "/docs";
}
''
${build}/bin/postgrest-docs-build
${dictcheck}/bin/postgrest-docs-dictcheck
${linkcheck}/bin/postgrest-docs-linkcheck
${spellcheck}/bin/postgrest-docs-spellcheck
${build}
${dictcheck}
${spellcheck}
'';

in
Expand Down

0 comments on commit c196d40

Please sign in to comment.