urbit/pkg/arvo/lib/versioning.hoon

56 lines
980 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
|= [=mark =vase]
^- cage
:- current-version
?: =(mark current-version)
vase
((tube-to mark) vase)
2021-03-09 09:03:16 +03:00
::
++ 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
|= [=mark =vase]
^- cage
:- mark
?: =(mark current-version)
vase
((tube-from mark) vase)
2021-03-09 09:03:16 +03:00
--