From d0e81beafdad4dcdb5f6fbaf80cdf261212ab640 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Tue, 3 Dec 2019 09:10:21 +0100 Subject: [PATCH] Fix devurl when running on Travis CI, fixes #87. --- src/Literate.jl | 3 ++- test/runtests.jl | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Literate.jl b/src/Literate.jl index 317f859..2aa693a 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -230,7 +230,8 @@ function create_configuration(inputfile; user_config, user_kwargs) if haskey(ENV, "HAS_JOSH_K_SEAL_OF_APPROVAL") # Travis CI repo_slug = get(ENV, "TRAVIS_REPO_SLUG", "unknown-repository") deploy_folder = if get(ENV, "TRAVIS_PULL_REQUEST", nothing) == "false" - get(ENV, "TRAVIS_TAG", get(user_config, "devurl", "dev")) + t = get(ENV, "TRAVIS_TAG", "") + isempty(t) ? get(user_config, "devurl", "dev") : t else "previews/PR$(get(ENV, "TRAVIS_PULL_REQUEST", "##"))" end diff --git a/test/runtests.jl b/test/runtests.jl index 8b99564..d5b3369 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -312,7 +312,7 @@ const GITLAB_ENV = Dict( # Travis with with PR preview build withenv(TRAVIS_ENV..., - "TRAVIS_TAG" => nothing, + "TRAVIS_TAG" => "", "TRAVIS_PULL_REQUEST" => "42") do Literate.script(inputfile, outdir) end @@ -323,7 +323,7 @@ const GITLAB_ENV = Dict( # Travis with no tag -> dev directory withenv(TRAVIS_ENV..., - "TRAVIS_TAG" => nothing) do + "TRAVIS_TAG" => "") do Literate.script(inputfile, outdir) end script = read(joinpath(outdir, "inputfile.jl"), String) @@ -512,7 +512,7 @@ end end # Travis with PR preview build withenv(TRAVIS_ENV..., - "TRAVIS_TAG" => nothing, + "TRAVIS_TAG" => "", "TRAVIS_PULL_REQUEST" => "42") do Literate.markdown(inputfile, outdir) end @@ -524,7 +524,7 @@ end end # Travis with no tag -> dev directory withenv(TRAVIS_ENV..., - "TRAVIS_TAG" => nothing) do + "TRAVIS_TAG" => "") do Literate.markdown(inputfile, outdir) end markdown = read(joinpath(outdir, "inputfile.md"), String) @@ -794,7 +794,7 @@ end end # no tag -> latest directory withenv(TRAVIS_ENV..., - "TRAVIS_TAG" => nothing) do + "TRAVIS_TAG" => "") do Literate.notebook(inputfile, outdir, execute = false) end notebook = read(joinpath(outdir, "inputfile.ipynb"), String) @@ -951,7 +951,7 @@ end end # Overwriting of URLs withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Literate.jl", - "TRAVIS_TAG" => nothing, + "TRAVIS_TAG" => "", "TRAVIS_PULL_REQUEST" => "false", "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do Literate.script(inputfile, outdir; config=config)