Skip to content

Commit

Permalink
use JuliaGPsDocs (#312)
Browse files Browse the repository at this point in the history
* use JuliaGPsDocs

* remove examples Manifests

* update examples/README to common docs

* .gitignore Manifest.toml
  • Loading branch information
st-- authored Apr 7, 2022
1 parent 0440ea6 commit 7fc120e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 5,148 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
*.jl.mem
*.ipynb
.DS_Store
/test/Manifest.toml
/test/ppl/Manifest.toml
/Manifest.toml
/dev/
/docs/build/
/docs/src/generated/
/docs/site/
*/.ipynb_checkpoints
.vscode/settings.json

Manifest.toml
61 changes: 0 additions & 61 deletions docs/literate.jl

This file was deleted.

57 changes: 15 additions & 42 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,48 +1,18 @@
### Process examples
# Always rerun examples
const EXAMPLES_OUT = joinpath(@__DIR__, "src", "examples")
ispath(EXAMPLES_OUT) && rm(EXAMPLES_OUT; recursive=true)
mkpath(EXAMPLES_OUT)
using Pkg
Pkg.add(Pkg.PackageSpec(; url="https://github.com/JuliaGaussianProcesses/JuliaGPsDocs.jl")) # While the package is unregistered, it's a workaround

# Install and precompile all packages
# Workaround for https://github.com/JuliaLang/Pkg.jl/issues/2219
examples = filter!(isdir, readdir(joinpath(@__DIR__, "..", "examples"); join=true))
let script = "using Pkg; Pkg.activate(ARGS[1]); Pkg.instantiate()"
for example in examples
if !success(`$(Base.julia_cmd()) -e $script $example`)
error(
"project environment of example ",
basename(example),
" could not be instantiated",
)
end
end
end
# Run examples asynchronously
processes = let literatejl = joinpath(@__DIR__, "literate.jl")
map(examples) do example
return run(
pipeline(
`$(Base.julia_cmd()) $literatejl $(basename(example)) $EXAMPLES_OUT`;
stdin=devnull,
stdout=devnull,
stderr=stderr,
);
wait=false,
)::Base.Process
end
end

# Check that all examples were run successfully
isempty(processes) || success(processes) || error("some examples were not run successfully")

### Build documentation
using Documenter
using JuliaGPsDocs

using AbstractGPs
# If any features of AbstractGPs depend on optional packages (e.g. via @require),
# make sure to load them here in order to generate the full API documentation.

JuliaGPsDocs.generate_examples(AbstractGPs)

### Build documentation
using Documenter

# Doctest setup
DocMeta.setdocmeta!(
AbstractGPs,
Expand All @@ -63,10 +33,13 @@ makedocs(;
"Home" => "index.md",
"The Main APIs" => "api.md",
"Concrete Features" => "concrete_features.md",
"Examples" =>
map(filter!(filename -> endswith(filename, ".md"), readdir(EXAMPLES_OUT))) do x
return joinpath("examples", x)
end,
"Examples" => map(
basename.(
filter!(isdir, readdir(joinpath(@__DIR__, "src", "examples"); join=true)),
),
) do x
joinpath("examples", x, "index.md")
end,
],
#strict=true,
checkdocs=:exports,
Expand Down
Loading

0 comments on commit 7fc120e

Please sign in to comment.