Skip to content

Commit 21e05a3

Browse files
authored
Merge pull request #26 from mortenpi/mp/toml
Use TOML standard library explicitly instead of `Pkg.TOML`
2 parents 462485b + 239969e commit 21e05a3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
88
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
99
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1010
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
11+
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
1112
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1213

1314
[compat]

src/PkgAuthentication.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Downloads
44
import JSON
55
import Pkg
66
import Random
7+
import TOML
78

89
const pkg_server_env_var_name = "JULIA_PKG_SERVER"
910

@@ -132,7 +133,7 @@ end
132133
function step(state::NeedAuthentication)::Union{HasToken, NoAuthentication}
133134
path = token_path(state.server)
134135
if isfile(path)
135-
toml = Pkg.TOML.parsefile(path)
136+
toml = TOML.parsefile(path)
136137
if is_token_valid(toml)
137138
return HasToken(state.server, mtime(path), toml)
138139
else
@@ -226,9 +227,9 @@ function step(state::HasNewToken)::Union{HasNewToken, Success, Failure}
226227
mkpath(dirname(path))
227228
try
228229
open(path, "w") do io
229-
Pkg.TOML.print(io, state.token)
230+
TOML.print(io, state.token)
230231
end
231-
if Pkg.TOML.parsefile(path) == state.token
232+
if TOML.parsefile(path) == state.token
232233
return Success(state.token)
233234
else
234235
return HasNewToken(state.server, state.token, 0)

0 commit comments

Comments
 (0)