Repository navigation
Expand file tree
/
Copy pathjulia.lua
More file actions
64 lines (55 loc) · 1.86 KB
/
Copy pathjulia.lua
File metadata and controls
64 lines (55 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-- julia: live crawl of https://julialang-s3.julialang.org/bin/versions.json
-- (ported from vcollector official/julia.go).
local C = dofile(__vmr_plugin_dir .. "/_vmr_common.lua")
plugin_name = "julia"
sdk_name = "julia"
plugin_version = "0.1"
homepage = "https://julialang.org/"
ic = C.installer({
flag_files = {
windows = { "LICENSE.md" },
darwin = { "LICENSE.md" },
linux = { "LICENSE.md" },
},
binary_dirs = {
windows = { { "bin" } },
darwin = { { "bin" } },
linux = { { "bin" } },
},
})
local DOWNLOAD_URL = "https://julialang-s3.julialang.org/bin/versions.json"
local ARCH_MAP = { aarch64 = "arm64", x86_64 = "amd64" }
local OS_MAP = { linux = "linux", mac = "darwin", winnt = "windows" }
function crawl()
local vl = vmrNewVersionList()
local resp = vmrGetResponse(DOWNLOAD_URL, 300, {})
local root = vmrInitGJson(resp)
vmrMapEach(root, "", function(vstr, entry)
vmrSliceEach(entry, "files", function(_, file)
if vmrGetString(file, "kind") ~= "archive" then
return
end
if not vmrContains(vmrGetString(file, "extension"), "tar.gz") then
return
end
local arch = ARCH_MAP[vmrGetString(file, "arch")]
local os_name = OS_MAP[vmrGetString(file, "os")]
if not arch or not os_name then
return
end
local sum = vmrGetString(file, "sha256")
vmrAddItem(vl, vstr, {
url = vmrGetString(file, "url"),
arch = arch,
os = os_name,
sum = sum,
sum_type = (sum ~= "") and "sha256" or "",
size = 0,
installer = vmrInstallerUnarchiver,
lts = "",
extra = "",
})
end)
end)
return vl
end