From 558833ef8bb815d44f41972b72cf89e8d2bb258c Mon Sep 17 00:00:00 2001 From: Helmut Haensel Date: Mon, 8 Jun 2020 15:25:26 +0200 Subject: [PATCH 1/2] Add Project.toml, speedup of isregistered and getkey, consistency of target determination --- Project.toml | 8 ++++++++ REQUIRE | 3 --- src/AssetRegistry.jl | 10 ++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 Project.toml delete mode 100644 REQUIRE diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..6211a8a --- /dev/null +++ b/Project.toml @@ -0,0 +1,8 @@ +name = "AssetRegistry" +uuid = "bf4720bc-e11a-5d0c-854e-bdca1663c893" +version = "0.1.0" + +[deps] +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +Pidfile = "fa939f87-e72e-5be4-a000-7fc836dbe307" +SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" diff --git a/REQUIRE b/REQUIRE deleted file mode 100644 index 2265bed..0000000 --- a/REQUIRE +++ /dev/null @@ -1,3 +0,0 @@ -julia 0.7 -Pidfile -JSON diff --git a/src/AssetRegistry.jl b/src/AssetRegistry.jl index 9f392f1..028b46f 100644 --- a/src/AssetRegistry.jl +++ b/src/AssetRegistry.jl @@ -113,9 +113,15 @@ function deregister(path; registry_file = joinpath(homedir(), ".jlassetregistry. key end -getkey(path) = baseurl[] * "/assetserver/" * bytes2hex(sha1(abspath(path))) * "-" * basename(path) +generatekey(path) = baseurl[] * "/assetserver/" * bytes2hex(sha1(path)) * "-" * basename(path) -isregistered(path) = haskey(registry, getkey(path)) +isregistered(path) = normpath(abspath(expanduser(path))) in values(registry) + +function getkey(path) + target = normpath(abspath(expanduser(path))) + key = findfirst(x -> x == target, registry) + key === nothing ? generatekey(path) : key +end function __init__() baseurl[] = get(ENV, "JULIA_ASSETREGISTRY_BASEURL", get(ENV, "JUPYTERHUB_SERVICE_PREFIX", "")) From fdf283117b20989f88c4a1fc64767f849d49d398 Mon Sep 17 00:00:00 2001 From: Helmut Haensel Date: Wed, 10 Jun 2020 18:13:53 +0200 Subject: [PATCH 2/2] include test packages in Project.toml and .gitignore Manifest.toml --- .gitignore | 1 + Project.toml | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index 8c960ec..3f02ca7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.jl.cov *.jl.*.cov *.jl.mem +Manifest.toml diff --git a/Project.toml b/Project.toml index 6211a8a..84bacb6 100644 --- a/Project.toml +++ b/Project.toml @@ -6,3 +6,10 @@ version = "0.1.0" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" Pidfile = "fa939f87-e72e-5be4-a000-7fc836dbe307" SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" + +[extras] +Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test", "Distributed"]