aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/artifact/snapshot
diff options
context:
space:
mode:
authorEduardo Julian2021-02-01 04:59:32 -0400
committerEduardo Julian2021-02-01 04:59:32 -0400
commit3d457763e34d4dd1992427b3918b351ac684adb7 (patch)
tree5e6ead8ab0c360d6c3eca5765b6be0be782709e2 /stdlib/source/program/aedifex/artifact/snapshot
parent1797521191746640e761cc1b4973d46b8c403dee (diff)
Improved compilation of loops and pattern-matching for Python.
Diffstat (limited to 'stdlib/source/program/aedifex/artifact/snapshot')
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot/version/value.lux42
1 files changed, 42 insertions, 0 deletions
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux
new file mode 100644
index 000000000..7356d897c
--- /dev/null
+++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux
@@ -0,0 +1,42 @@
+(.module:
+ [lux #*
+ [abstract
+ [equivalence (#+ Equivalence)]]
+ [data
+ ["." product]
+ ["." text
+ ["%" format]]]]
+ ["." /// (#+ Snapshot)
+ ["#." time]
+ ["#." stamp]])
+
+(type: #export Value
+ {#version Text
+ #snapshot Snapshot})
+
+(def: #export equivalence
+ (Equivalence Value)
+ ($_ product.equivalence
+ text.equivalence
+ ///.equivalence
+ ))
+
+(def: separator
+ "-")
+
+(def: #export snapshot
+ "SNAPSHOT")
+
+(def: #export (format (^slots [#version #snapshot]))
+ (%.Format Value)
+ (case snapshot
+ #///.Local
+ version
+
+ (#///.Remote stamp)
+ (let [(^slots [#///stamp.time #///stamp.build]) stamp]
+ (%.format (text.replace_all ..snapshot
+ (///time.format time)
+ version)
+ ..separator
+ (%.nat build)))))