blob: 47a9027d08d92252681df68bdadf11f61b429dd9 (
plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
|
(.module:
[lux (#- Name)
[abstract
["." equivalence (#+ Equivalence)]
["." hash (#+ Hash)]]
[data
["." text
["%" format (#+ format)]]
[collection
["." list ("#@." monoid)]]]
[world
[net
["." uri]]]])
(type: #export Group
Text)
(type: #export Name
Text)
(type: #export Version
Text)
(type: #export Artifact
{#group Group
#name Name
#version Version})
(def: #export equivalence
(Equivalence Artifact)
($_ equivalence.product
text.equivalence
text.equivalence
text.equivalence
))
(def: #export hash
(Hash Artifact)
($_ hash.product
text.hash
text.hash
text.hash
))
(def: group-separator
".")
(def: version-separator
"-")
(def: #export (identity artifact)
(-> Artifact Text)
(format (get@ #name artifact)
..version-separator
(get@ #version artifact)))
(def: #export (path artifact)
(-> Artifact Text)
(let [directory (format (|> artifact
(get@ #group)
(text.split-all-with ..group-separator)
(text.join-with uri.separator))
uri.separator
(get@ #name artifact)
uri.separator
(get@ #version artifact))]
(format directory
uri.separator
(..identity artifact))))
(def: #export (local artifact)
(-> Artifact (List Text))
(list@compose (|> artifact
(get@ #group)
(text.split-all-with ..group-separator))
(list (get@ #name artifact)
(get@ #version artifact))))
|