Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip_existing_cast option to generate_example_page #79

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ using IOCapture
DocMeta.setdocmeta!(Replay, :DocTestSetup, :(using Replay); recursive=true)

COMMIT::String = read(`git rev-parse HEAD`, String)[begin:end-1]
SKIP_EXISTING_CAST = false

function generate_example_page(sections)
function generate_example_page(sections; skip_existing_cast=true)
path_md = joinpath(@__DIR__, "src", "examples.md")
script_md = """
# Examples
Expand Down Expand Up @@ -51,10 +52,12 @@ function generate_example_page(sections)
path_cast = joinpath(@__DIR__, "src", "assets", "$(name).cast")
cmd_record = `asciinema rec $(path_cast) --command $(cmd_jl_str) --overwrite --title $("Replay.jl - "*title)`

# Dry run not to record precompilation
run(cmd_jl)
# Record the REPL output with asciinema
run(cmd_record)
if isfile(path_cast) && !skip_existing_cast
# Dry run not to record precompilation
run(cmd_jl)
# Record the REPL output with asciinema
run(cmd_record)
end

# Add the output of the example
script_md *= """
Expand Down Expand Up @@ -216,7 +219,7 @@ sections = [
],
]

generate_example_page(sections)
generate_example_page(sections; skip_existing_cast=SKIP_EXISTING_CAST)

makedocs(;
modules=[Replay],
Expand Down
Loading