urbit/pkg/arvo/lib/versioning.hoon

54 lines
947 B
Plaintext
Raw Normal View History

2021-03-09 09:03:16 +03:00
/+ agentio
2021-03-10 08:07:58 +03:00
|_ [=bowl:gall root=mark version=@ud min=@ud]
2021-03-09 09:03:16 +03:00
+* io ~(. agentio bowl)
++ is-root
|= =mark
2021-03-15 03:46:27 +03:00
?~ (rush mark mark-parser)
%.n
%.y
2021-03-09 09:03:16 +03:00
::
2021-03-15 03:46:27 +03:00
++ mark-parser
;~(pfix (jest root) ;~(pose ;~(pfix hep dum:ag) (easy `@ud`0)))
::
++ read-version
2021-03-09 09:03:16 +03:00
|= =mark
2021-03-15 03:46:27 +03:00
(rash mark mark-parser)
2021-03-09 09:03:16 +03:00
::
++ append-version
|= ver=@ud
:((cury cat 3) root '-' (scot %ud ver))
::
++ current-version
^- mark
2021-03-09 09:03:16 +03:00
(append-version version)
::
2021-03-10 08:07:58 +03:00
++ supported
|= =mark
=/ ver
2021-03-15 03:46:27 +03:00
(read-version mark)
&((gte ver min) (lte ver version))
2021-03-10 08:07:58 +03:00
::
2021-03-09 09:03:16 +03:00
++ 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)
--