mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-25 07:52:59 +03:00
base-dev: add docket mark
This commit is contained in:
parent
f958b7874f
commit
41ae07f321
176
pkg/base-dev/lib/docket.hoon
Normal file
176
pkg/base-dev/lib/docket.hoon
Normal file
@ -0,0 +1,176 @@
|
||||
/- *docket
|
||||
|%
|
||||
::
|
||||
++ mime
|
||||
|%
|
||||
+$ draft
|
||||
$: title=(unit @t)
|
||||
info=(unit @t)
|
||||
color=(unit @ux)
|
||||
glob=(unit url)
|
||||
base=(unit term)
|
||||
version=(unit version)
|
||||
website=(unit url)
|
||||
license=(unit cord)
|
||||
==
|
||||
::
|
||||
++ finalize
|
||||
|= =draft
|
||||
^- (unit docket)
|
||||
?~ title.draft ~
|
||||
?~ info.draft ~
|
||||
?~ color.draft ~
|
||||
?~ glob.draft ~
|
||||
?~ base.draft ~
|
||||
?~ version.draft ~
|
||||
?~ website.draft ~
|
||||
?~ license.draft ~
|
||||
=, draft
|
||||
:- ~
|
||||
:* %1
|
||||
u.title
|
||||
u.info
|
||||
u.color
|
||||
u.glob
|
||||
u.base
|
||||
u.version
|
||||
u.website
|
||||
u.license
|
||||
==
|
||||
::
|
||||
++ from-clauses
|
||||
=| =draft
|
||||
|= cls=(list clause)
|
||||
^- (unit docket)
|
||||
=* loop $
|
||||
?~ cls (finalize draft)
|
||||
=* clause i.cls
|
||||
=. draft
|
||||
?- -.clause
|
||||
%title draft(title `title.clause)
|
||||
%info draft(info `info.clause)
|
||||
%color draft(color `color.clause)
|
||||
%glob draft(glob `url.clause)
|
||||
%base draft(base `base.clause)
|
||||
%version draft(version `version.clause)
|
||||
%website draft(website `website.clause)
|
||||
%license draft(license `license.clause)
|
||||
==
|
||||
loop(cls t.cls)
|
||||
::
|
||||
++ to-clauses
|
||||
|= d=docket
|
||||
^- (list clause)
|
||||
:~ title+title.d
|
||||
info+info.d
|
||||
color+color.d
|
||||
glob+glob.d
|
||||
base+base.d
|
||||
version+version.d
|
||||
website+website.d
|
||||
license+license.d
|
||||
==
|
||||
::
|
||||
++ spit-clause
|
||||
|= =clause
|
||||
^- tape
|
||||
%+ weld " {(trip -.clause)}+"
|
||||
?- -.clause
|
||||
?(%title %info %glob %website %license %base) "'{(trip +.clause)}'"
|
||||
%color (scow %ux color.clause)
|
||||
::
|
||||
%version
|
||||
=, version.clause
|
||||
"[{(scow %ud major)} {(scow %ud minor)} {(scow %ud patch)}]"
|
||||
==
|
||||
::
|
||||
++ spit-docket
|
||||
|= dock=docket
|
||||
^- tape
|
||||
;: welp
|
||||
":~\0a"
|
||||
`tape`(zing (join "\0a" (turn (to-clauses dock) spit-clause)))
|
||||
"\0a=="
|
||||
==
|
||||
--
|
||||
::
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
|%
|
||||
::
|
||||
++ update
|
||||
|= u=^update
|
||||
~& u
|
||||
^- json
|
||||
%+ frond -.u
|
||||
^- json
|
||||
?- -.u
|
||||
%del-dock s+desk.u
|
||||
::
|
||||
%initial
|
||||
%- pairs
|
||||
%+ turn ~(tap by initial.u)
|
||||
|=([=desk d=^docket] [desk (docket d)])
|
||||
::
|
||||
%add-dock
|
||||
%- pairs
|
||||
:~ desk+s+desk.u
|
||||
docket+(docket docket.u)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ num
|
||||
|= a=@u
|
||||
^- ^tape
|
||||
=/ p=json (numb a)
|
||||
?> ?=(%n -.p)
|
||||
(trip p.p)
|
||||
::
|
||||
|
||||
++ version
|
||||
|= v=^version
|
||||
^- json
|
||||
:- %s
|
||||
%- crip
|
||||
"{(num major.v)}.{(num minor.v)}.{(num patch.v)}"
|
||||
|
||||
++ merge
|
||||
|= [a=json b=json]
|
||||
^- json
|
||||
?> &(?=(%o -.a) ?=(%o -.b))
|
||||
[%o (~(uni by p.a) p.b)]
|
||||
::
|
||||
++ docket
|
||||
|= d=^docket
|
||||
^- json
|
||||
%- pairs
|
||||
:~ title+s+title.d
|
||||
info+s+info.d
|
||||
color+s+(scot %ux color.d)
|
||||
glob+s+glob.d
|
||||
base+s+base.d
|
||||
version+(version version.d)
|
||||
license+s+license.d
|
||||
website+s+website.d
|
||||
==
|
||||
::
|
||||
++ case
|
||||
|= c=^case
|
||||
%+ frond -.c
|
||||
?- -.c
|
||||
%da s+(scot %da p.c)
|
||||
%tas s+(scot %tas p.c)
|
||||
%ud (numb p.c)
|
||||
==
|
||||
::
|
||||
++ treaty
|
||||
|= t=^treaty
|
||||
%+ merge (docket docket.t)
|
||||
%- pairs
|
||||
:~ ship+s+(scot %p ship.t)
|
||||
desk+s+desk.t
|
||||
cass+(case case.t)
|
||||
hash+s+(scot %uv hash.t)
|
||||
==
|
||||
--
|
||||
--
|
25
pkg/base-dev/mar/docket.hoon
Normal file
25
pkg/base-dev/mar/docket.hoon
Normal file
@ -0,0 +1,25 @@
|
||||
/+ dock=docket
|
||||
|_ =docket:dock
|
||||
++ grow
|
||||
|%
|
||||
++ mime
|
||||
^- ^mime
|
||||
[/text/x-docket (as-octt:mimes:html (spit-docket:mime:dock docket))]
|
||||
++ noun docket
|
||||
++ json (docket:enjs:dock docket)
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
::
|
||||
++ mime
|
||||
|= [=mite len=@ud tex=@]
|
||||
^- docket:dock
|
||||
%- need
|
||||
%- from-clauses:mime:dock
|
||||
!<((list clause:dock) (slap !>(~) (ream tex)))
|
||||
|
||||
::
|
||||
++ noun docket:dock
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
54
pkg/base-dev/sur/docket.hoon
Normal file
54
pkg/base-dev/sur/docket.hoon
Normal file
@ -0,0 +1,54 @@
|
||||
|%
|
||||
::
|
||||
+$ version
|
||||
[major=@ud minor=@ud patch=@ud]
|
||||
::
|
||||
+$ glob (map path mime)
|
||||
::
|
||||
+$ url cord
|
||||
::
|
||||
:: $charge: A realized $docket
|
||||
::
|
||||
+$ charge
|
||||
[=glob =docket]
|
||||
::
|
||||
:: $clause: A key and value, as part of a docket
|
||||
::
|
||||
:: Only used to parse $docket
|
||||
::
|
||||
+$ clause
|
||||
$% [%title title=@t]
|
||||
[%info info=@t]
|
||||
[%color color=@ux]
|
||||
[%glob url=cord]
|
||||
[%base base=term]
|
||||
[%version =version]
|
||||
[%website website=url]
|
||||
[%license license=cord]
|
||||
==
|
||||
::
|
||||
:: $docket: A infoion of JS bundles for a desk
|
||||
::
|
||||
+$ docket
|
||||
$: %1
|
||||
title=@t
|
||||
info=@t
|
||||
color=@ux
|
||||
glob=url
|
||||
base=term
|
||||
=version
|
||||
website=url
|
||||
license=cord
|
||||
==
|
||||
::
|
||||
:: $treaty: A foreign docket
|
||||
+$ treaty
|
||||
[=ship =desk =case hash=@uv =docket]
|
||||
::
|
||||
::
|
||||
+$ update
|
||||
$% [%initial initial=(map desk docket)]
|
||||
[%add-dock =desk =docket]
|
||||
[%del-dock =desk]
|
||||
==
|
||||
--
|
Loading…
Reference in New Issue
Block a user