diff options
author | Eduardo Julian | 2020-08-26 23:04:27 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-08-26 23:04:27 -0400 |
commit | c8f9f42a258f1f2f961c7f8c5571cce843e97a0a (patch) | |
tree | 887cb4d557b149826c6c9e59ea821942045b08d4 /stdlib/source/program/aedifex/artifact | |
parent | d77ce19bf01a009cf5255e0a5d8201d8cc2f2178 (diff) |
Download and catch dependencies in Aedifex.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/aedifex/artifact.lux | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux new file mode 100644 index 000000000..a6865f688 --- /dev/null +++ b/stdlib/source/program/aedifex/artifact.lux @@ -0,0 +1,68 @@ +(.module: + [lux (#- Name) + [abstract + ["." 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 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)))) |