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

Remove Pkg as a dependency #184

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name = "LiveServer"
uuid = "16fef848-5104-11e9-1b77-fb7a48bbb589"
authors = ["Jonas Asprion <jonas.asprion@gmx.ch", "Thibaut Lienart <tlienart@me.com>"]
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"

Expand Down
2 changes: 1 addition & 1 deletion src/LiveServer.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module LiveServer

import Sockets, Pkg, MIMEs
import Sockets, MIMEs
using Base.Filesystem
using Base.Threads: @spawn

Expand Down
19 changes: 15 additions & 4 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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))
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Loading