1
1
mirror of https://github.com/urbit/shrub.git synced 2024-12-26 05:23:35 +03:00
shrub/pkg/arvo/lib/versioning.hoon
2021-03-19 10:24:35 +10:00

54 lines
947 B
Plaintext

/+ agentio
|_ [=bowl:gall root=mark version=@ud min=@ud]
+* io ~(. agentio bowl)
++ is-root
|= =mark
?~ (rush mark mark-parser)
%.n
%.y
::
++ mark-parser
;~(pfix (jest root) ;~(pose ;~(pfix hep dum:ag) (easy `@ud`0)))
::
++ read-version
|= =mark
(rash mark mark-parser)
::
++ append-version
|= ver=@ud
:((cury cat 3) root '-' (scot %ud ver))
::
++ current-version
^- mark
(append-version version)
::
++ supported
|= =mark
=/ ver
(read-version mark)
&((gte ver min) (lte ver version))
::
++ convert-to
|= =cage
^- vase
?: =(p.cage current-version)
q.cage
((tube-to p.cage) q.cage)
::
++ tube-to
|= =mark
.^(tube:clay %cc (scry:io %home /[mark]/[current-version]))
::
++ tube-from
|= =mark
.^(tube:clay %cc (scry:io %home /[current-version]/[mark]))
::
++ convert-from
|= =cage
^- vase
?: =(p.cage current-version)
q.cage
((tube-from p.cage) q.cage)
--