aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/artifact.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/program/aedifex/artifact.lux')
-rw-r--r--stdlib/source/program/aedifex/artifact.lux48
1 files changed, 29 insertions, 19 deletions
diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux
index 47a9027d0..dc0892eb1 100644
--- a/stdlib/source/program/aedifex/artifact.lux
+++ b/stdlib/source/program/aedifex/artifact.lux
@@ -5,7 +5,7 @@
["." hash (#+ Hash)]]
[data
["." text
- ["%" format (#+ format)]]
+ ["%" format (#+ Format)]]
[collection
["." list ("#@." monoid)]]]
[world
@@ -42,31 +42,41 @@
text.hash
))
-(def: group-separator
- ".")
+(template [<separator> <definition>]
+ [(def: <definition>
+ Text
+ <separator>)]
-(def: version-separator
- "-")
+ ["." group-separator]
+ ["-" version-separator]
+ [":" identity-separator]
+ )
(def: #export (identity artifact)
(-> Artifact Text)
- (format (get@ #name artifact)
- ..version-separator
- (get@ #version artifact)))
+ (%.format (get@ #name artifact)
+ ..version-separator
+ (get@ #version artifact)))
+
+(def: #export (format value)
+ (Format Artifact)
+ (%.format (get@ #group value)
+ ..identity-separator
+ (..identity value)))
(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))))
+ (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))