diff --git a/.gitignore b/.gitignore index 8ee819d..0b5f155 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.jl.cov *.jl.*.cov *.jl.mem -*.DS_Store \ No newline at end of file +*.DS_Store +Manifest.toml diff --git a/.travis.yml b/.travis.yml index ef62158..604889b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,16 +16,13 @@ branches: jobs: include: - stage: deploy - julia: 0.7 + julia: nightly os: linux script: - - julia -e 'Pkg.clone(pwd()); Pkg.build("Literate")' - - julia -e 'Pkg.add("Documenter"); Pkg.add("Plots"); Pkg.build("Plots")' - - julia -e 'cd(Pkg.dir("Literate")); include("docs/make.jl")' + - julia docs/make.jl notifications: email: false git: depth: 99999999 after_success: - # push coverage results to Codecov - - julia -e 'cd(Pkg.dir("Literate")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' + - julia test/coverage.jl diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..a0d42e1 --- /dev/null +++ b/Project.toml @@ -0,0 +1,11 @@ +name = "Literate" +uuid = "98b081ad-f1c9-55d3-8b20-4c87d4299306" +version = "0.2.2" + +[deps] +Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" + +[targets.test.deps] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/appveyor.yml b/appveyor.yml index df3d989..fb15a51 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,14 +1,14 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.7-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.7-latest-win64.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" -matrix: - allow_failures: - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" +# matrix: +# allow_failures: +# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" +# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" branches: only: diff --git a/docs/make.jl b/docs/make.jl index e7cd5df..ff0bdce 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,10 +1,12 @@ +using Pkg +pkg"add Plots#master" +pkg"add GR#master" +pkg"add Documenter" +pkg"precompile" + using Documenter using Literate -# import these to make sure they precompile here instead of when generating output -import Plots -import GR - # generate examples EXAMPLE = joinpath(@__DIR__, "..", "examples", "example.jl") OUTPUT = joinpath(@__DIR__, "src/generated") @@ -53,7 +55,7 @@ deploydocs( repo = "github.com/fredrikekre/Literate.jl.git", target = "build", osname = "linux", - julia = "0.6", + julia = "nightly", deps = nothing, make = nothing ) diff --git a/docs/src/outputformats.md b/docs/src/outputformats.md index 333f344..d300da3 100644 --- a/docs/src/outputformats.md +++ b/docs/src/outputformats.md @@ -4,6 +4,7 @@ When the source is parsed, and have been processed it is time to render the outp We will consider the following source snippet: ```@eval +import Markdown Markdown.parse("```julia\n" * rstrip(read("outputformats.jl", String)) * "\n```") ``` @@ -14,7 +15,8 @@ and see how this is rendered in each of the output formats. The (default) markdown output of the source snippet above is as follows ```@eval -file = joinpath(@__DIR__, "src/generated/name.md") +import Markdown +file = joinpath(@__DIR__, "../src/generated/name.md") str = "````markdown\n" * rstrip(read(file, String)) * "\n````" rm(file) Markdown.parse(str) @@ -55,7 +57,8 @@ Literate.notebook The (default) script output of the source snippet above is as follows ```@eval -file = joinpath(@__DIR__, "src/generated/outputformats.jl") +import Markdown +file = joinpath(@__DIR__, "../src/generated/outputformats.jl") str = "```julia\n" * rstrip(read(file, String)) * "\n```" rm(file) Markdown.parse(str) diff --git a/src/Documenter.jl b/src/Documenter.jl index d7d3f03..115d3e7 100644 --- a/src/Documenter.jl +++ b/src/Documenter.jl @@ -1,7 +1,6 @@ # this file contains some utilities copied from the Documenter.jl package # (https://github.com/JuliaDocs/Documenter.jl), see LICENSE.md for license module Documenter -using Logging function withoutput(f) # Save the default output streams. @@ -14,14 +13,14 @@ function withoutput(f) redirect_stdout(pipe.in) redirect_stderr(pipe.in) # Also redirect logging stream to the same pipe - logger = ConsoleLogger(pipe.in) + logger = Base.CoreLogging.SimpleLogger(pipe.in) # Bytes written to the `pipe` are captured in `output` and converted to a `String`. output = UInt8[] # Run the function `f`, capturing all output that it might have generated. # Success signals whether the function `f` did or did not throw an exception. - result, success, backtrace = with_logger(logger) do + result, success, backtrace = Base.CoreLogging.with_logger(logger) do try f(), true, Vector{Ptr{Cvoid}}() catch err diff --git a/src/Literate.jl b/src/Literate.jl index 226a0d2..1f9e5fc 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -319,18 +319,12 @@ function markdown(inputfile, outputdir; preprocess = identity, postprocess = ide # change the Edit on GitHub link repo = get(ENV, "TRAVIS_REPO_SLUG", nothing) build_dir = get(ENV, "TRAVIS_BUILD_DIR", nothing) - @show build_dir - if build_dir !== nothing - @show relpath(inputfile, build_dir) - end if repo === nothing - println("repo === nothing") path = "" else pkg = String(first(split(last(split(repo, '/')), '.'))) pkgsrc = Base.find_package(pkg) if pkgsrc === nothing - println("pkgsrc === nothing") path = "" else repo_root = first(split(pkgsrc, "src/" * pkg * ".jl")) @@ -533,7 +527,7 @@ function execute_notebook(nb) stream = Dict{String,Any}() stream["output_type"] = "stream" stream["name"] = "stdout" - stream["text"] = collect(Any, eachline(IOBuffer(String(str)), chomp = false)) # 0.7 chomp = false => keep = true + stream["text"] = collect(Any, eachline(IOBuffer(String(str)), keep = true)) push!(cell["outputs"], stream) end @@ -550,7 +544,7 @@ function execute_notebook(nb) # we need to split some mime types into vectors of lines instead of a single string for mime in ("image/svg+xml", "text/html") if haskey(dd, mime) - dd[mime] = collect(Any, eachline(IOBuffer(dd[mime]), chomp = false)) + dd[mime] = collect(Any, eachline(IOBuffer(dd[mime]), keep = true)) end end execute_result["data"] = dd diff --git a/test/coverage.jl b/test/coverage.jl new file mode 100644 index 0000000..75bcef6 --- /dev/null +++ b/test/coverage.jl @@ -0,0 +1,6 @@ +using Pkg +Pkg.add("Coverage") +using Coverage +cd(joinpath(@__DIR__, "..")) do + Codecov.submit(Codecov.process_folder()) +end