diff --git a/Project.toml b/Project.toml index dbaee7b..ca6829f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,13 +1,12 @@ name = "LiveServer" uuid = "16fef848-5104-11e9-1b77-fb7a48bbb589" authors = ["Jonas Asprion "] -version = "1.3.1" +version = "1.4.0" [deps] HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36" MIMEs = "6c6e2e6c-3030-632d-7369-2d6c69616d65" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/src/LiveServer.jl b/src/LiveServer.jl index e4ac569..bb49ad3 100644 --- a/src/LiveServer.jl +++ b/src/LiveServer.jl @@ -1,6 +1,6 @@ module LiveServer -import Sockets, Pkg, MIMEs +import Sockets, MIMEs using Base.Filesystem using Base.Threads: @spawn diff --git a/src/utils.jl b/src/utils.jl index fd73d92..1e3aefc 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -184,8 +184,6 @@ subfolder `docs`. * `verbose=false`: boolean switch to make the server print information about file changes and connections. -* `doc_env=false`: a boolean switch to make the server start by activating the - doc environment or not (i.e. the `Project.toml` in `docs/`). * `literate=nothing`: see `literate_dir`. * `literate_dir=nothing`: Path to a directory containing Literate scripts if these are not simply under `docs/src`. @@ -271,7 +269,12 @@ function servedocs(; ) # activate the doc environment if required - doc_env && Pkg.activate(joinpath(foldername, "Project.toml")) + if doc_env + msg = "The `doc_env` keyword argument is deprecated. Configure the environment " * + "before calling LiveServer.servedocs instead." + Base.depwarn(msg, :servedocs) + prev = deprecated_activate(joinpath(foldername, "Project.toml")) + end # trigger a first pass of Documenter (& possibly Literate) Main.include(abspath(path2makejl)) @@ -291,10 +294,18 @@ function servedocs(; ) # when the serve loop is interrupted, de-activate the environment - doc_env && Pkg.activate() + if doc_env + deprecated_activate(prev) + end return end +function deprecated_activate(path) + prev = Base.ACTIVE_PROJECT[] + Base.ACTIVE_PROJECT[] = path + return prev +end + # # Miscellaneous utils diff --git a/test/Project.toml b/test/Project.toml index c48b09a..c8bafe7 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -2,7 +2,6 @@ Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" MIMEs = "6c6e2e6c-3030-632d-7369-2d6c69616d65" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"