mirror of
https://github.com/urbit/shrub.git
synced 2025-01-01 17:16:47 +03:00
base: add %runtime-version
This commit is contained in:
parent
d4b900bf3f
commit
c85aca347c
117
pkg/arvo/app/runtime-version.hoon
Normal file
117
pkg/arvo/app/runtime-version.hoon
Normal file
@ -0,0 +1,117 @@
|
||||
/+ default-agent, dbug, verb
|
||||
=>
|
||||
|%
|
||||
+$ app-state [%0 latest=@t]
|
||||
+$ card card:agent:gall
|
||||
+$ vere-update [cur=vere next=(unit vere)]
|
||||
::
|
||||
++ set-timer
|
||||
|= now=@da
|
||||
^- card
|
||||
:* %pass
|
||||
/timer
|
||||
%arvo
|
||||
%b
|
||||
%wait
|
||||
(add now ~m30)
|
||||
==
|
||||
++ request-latest-vere
|
||||
^- card
|
||||
:* %pass
|
||||
/vere
|
||||
%arvo
|
||||
%i
|
||||
%request
|
||||
[%'GET' 'https://bootstrap.urbit.org/vere/live/last' ~ ~]
|
||||
*outbound-config:iris
|
||||
==
|
||||
:: parse out the commit suffix for people on pre-release vere
|
||||
:: these revisions look like /vere/~.2.7-de2d39b
|
||||
:: we will have better pre-release (pace) handling later
|
||||
++ get-current-version
|
||||
|= current=vere
|
||||
^- @t
|
||||
=/ v
|
||||
%+ rush
|
||||
(slav %ta (rear rev.current))
|
||||
;~((glue hep) (star ;~(pose nud dot)) (star aln))
|
||||
?~ v (slav %ta (rear rev.current))
|
||||
(crip -.u.v)
|
||||
::
|
||||
++ is-equal-version
|
||||
|= [latest=@t current=vere]
|
||||
=(latest (get-current-version current))
|
||||
--
|
||||
^- agent:gall
|
||||
=| app-state
|
||||
=* state -
|
||||
%- agent:dbug
|
||||
%+ verb |
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
::
|
||||
++ on-init
|
||||
^- (quip card _this)
|
||||
=/ cur .^(vere %$ /(scot %p our.bowl)//(scot %da now.bowl)/zen/ver)
|
||||
:- [request-latest-vere ~]
|
||||
this(latest (get-current-version cur))
|
||||
::
|
||||
++ on-save
|
||||
^- vase
|
||||
!>(state)
|
||||
::
|
||||
++ on-load
|
||||
|= =vase
|
||||
^- (quip card _this)
|
||||
=/ old !<(app-state vase)
|
||||
`this(state old)
|
||||
::
|
||||
++ on-watch
|
||||
|= =path
|
||||
^- (quip card _this)
|
||||
?> (team:title our.bowl src.bowl)
|
||||
?+ path (on-watch:def path)
|
||||
[%version ~]
|
||||
=/ cur .^(vere %$ /(scot %p our.bowl)//(scot %da now.bowl)/zen/ver)
|
||||
:_ this
|
||||
:_ ~
|
||||
?: (is-equal-version latest cur)
|
||||
[%give %fact ~ %vere-update !>([cur=cur next=~])]
|
||||
=| next=vere
|
||||
:* %give %fact ~ %vere-update
|
||||
!>(`vere-update`[cur=cur next=`next(rev /vere/(scot %ta latest))])
|
||||
==
|
||||
==
|
||||
::
|
||||
++ on-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
^- (quip card _this)
|
||||
?+ wire (on-arvo:def wire sign-arvo)
|
||||
::
|
||||
[%timer ~]
|
||||
?> ?=([%behn %wake *] sign-arvo)
|
||||
?< ?=(^ error.sign-arvo)
|
||||
[[request-latest-vere (set-timer now.bowl) ~] this]
|
||||
::
|
||||
[%vere ~]
|
||||
?> ?=([%iris %http-response %finished *] sign-arvo)
|
||||
?> =(200 status-code.response-header.client-response.sign-arvo)
|
||||
=/ res full-file.client-response.sign-arvo
|
||||
?< ?=(~ res)
|
||||
=/ cur .^(vere %$ /(scot %p our.bowl)//(scot %da now.bowl)/zen/ver)
|
||||
:_ this(latest q.data.u.res)
|
||||
?: =(q.data.u.res latest) ~
|
||||
=| next=vere
|
||||
:_ ~
|
||||
:* %give %fact ~[/version] %vere-update
|
||||
!>(`vere-update`[cur=cur next=`next(rev /vere/(scot %ta latest))])
|
||||
==
|
||||
==
|
||||
::
|
||||
++ on-poke on-poke:def
|
||||
++ on-leave on-leave:def
|
||||
++ on-peek on-peek:def
|
||||
++ on-agent on-agent:def
|
||||
++ on-fail on-fail:def
|
||||
--
|
24
pkg/arvo/mar/vere-update.hoon
Normal file
24
pkg/arvo/mar/vere-update.hoon
Normal file
@ -0,0 +1,24 @@
|
||||
|_ [cur=vere next=(unit vere)]
|
||||
++ en-vere
|
||||
|= v=vere
|
||||
%- pairs:enjs:format
|
||||
:- [%non s+non.v]
|
||||
:- [%rev (path:enjs:format rev.v)]
|
||||
%+ turn kel.v
|
||||
|= w=weft
|
||||
[lal.w (numb:enjs:format num.w)]
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun ,[cur=vere next=(unit vere)]
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ json
|
||||
%- pairs:enjs:format
|
||||
:- [%cur (en-vere cur)]
|
||||
?~ next ~
|
||||
:- [%next (en-vere u.next)] ~
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../base-dev/mar/vere.hoon
|
@ -1,17 +0,0 @@
|
||||
|_ v=vere
|
||||
++ grab
|
||||
|%
|
||||
++ noun vere
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ json
|
||||
%- pairs:enjs:format
|
||||
:- [%non s+non.v]
|
||||
:- [%rev (path:enjs:format rev.v)]
|
||||
%+ turn kel.v
|
||||
|= w=weft
|
||||
[lal.w (numb:enjs:format num.w)]
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
Loading…
Reference in New Issue
Block a user