mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 20:02:51 +03:00
%bake schematic
This commit is contained in:
parent
a80123dac6
commit
fefa1aafd8
@ -104,6 +104,8 @@
|
|||||||
test-cast
|
test-cast
|
||||||
test-cast-grow
|
test-cast-grow
|
||||||
test-mute
|
test-mute
|
||||||
|
test-bake-renderer
|
||||||
|
test-bake-mark
|
||||||
==
|
==
|
||||||
++ test-tear
|
++ test-tear
|
||||||
:- `tank`leaf+"test-tear"
|
:- `tank`leaf+"test-tear"
|
||||||
@ -5380,6 +5382,156 @@
|
|||||||
(expect-ford-empty ford ~nul)
|
(expect-ford-empty ford ~nul)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
++ test-bake-renderer
|
||||||
|
:- `tank`leaf+"test-bake-renderer"
|
||||||
|
::
|
||||||
|
=/ ford *ford-gate
|
||||||
|
::
|
||||||
|
=/ hoon-src-type=type [%atom %$ ~]
|
||||||
|
=/ scry-results=(map [term beam] cage)
|
||||||
|
%- my :~
|
||||||
|
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/ren]]
|
||||||
|
:- %hoon
|
||||||
|
:- hoon-src-type
|
||||||
|
'''
|
||||||
|
/= data /!noun/
|
||||||
|
data
|
||||||
|
'''
|
||||||
|
::
|
||||||
|
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/data]]
|
||||||
|
:- %hoon
|
||||||
|
:- hoon-src-type
|
||||||
|
'''
|
||||||
|
[1 2 3 ~]
|
||||||
|
'''
|
||||||
|
==
|
||||||
|
::
|
||||||
|
=^ results1 ford
|
||||||
|
%- test-ford-call-with-comparator :*
|
||||||
|
ford
|
||||||
|
now=~1234.5.6
|
||||||
|
scry=(scry-with-results scry-results)
|
||||||
|
::
|
||||||
|
::
|
||||||
|
^= call-args
|
||||||
|
:* duct=~[/path] type=~ %make ~nul
|
||||||
|
%pin ~1234.5.6
|
||||||
|
[%bake %foo *coin `rail:ford-gate`[[~nul %home] /data]]
|
||||||
|
==
|
||||||
|
::
|
||||||
|
^= comparator
|
||||||
|
|= moves=(list move:ford-gate)
|
||||||
|
::
|
||||||
|
?> =(1 (lent moves))
|
||||||
|
?> ?=(^ moves)
|
||||||
|
?> ?=([* %give %made @da %complete %success %pin *] i.moves)
|
||||||
|
=/ result result.p.card.i.moves
|
||||||
|
=/ pin-result build-result.result
|
||||||
|
?> ?=([%success %bake *] build-result.pin-result)
|
||||||
|
::
|
||||||
|
=/ =cage cage.build-result.pin-result
|
||||||
|
::
|
||||||
|
%+ weld
|
||||||
|
%- expect-eq !>
|
||||||
|
:- %noun
|
||||||
|
p.cage
|
||||||
|
::
|
||||||
|
%+ weld
|
||||||
|
%- expect-eq !>
|
||||||
|
:- [1 2 3 ~]
|
||||||
|
q.q.cage
|
||||||
|
::
|
||||||
|
%- expect-eq !>
|
||||||
|
:- &
|
||||||
|
(~(nest ut p.q.cage) | -:!>([1 2 3 ~]))
|
||||||
|
==
|
||||||
|
::
|
||||||
|
;: weld
|
||||||
|
results1
|
||||||
|
(expect-ford-empty ford ~nul)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ test-bake-mark
|
||||||
|
:- `tank`leaf+"test-bake-mark"
|
||||||
|
::
|
||||||
|
=/ ford *ford-gate
|
||||||
|
::
|
||||||
|
=/ hoon-src-type=type [%atom %$ ~]
|
||||||
|
::
|
||||||
|
=/ hoon-src=@ta
|
||||||
|
'''
|
||||||
|
|_ cell=^
|
||||||
|
++ grab
|
||||||
|
|%
|
||||||
|
++ noun ^
|
||||||
|
--
|
||||||
|
--
|
||||||
|
'''
|
||||||
|
=/ scry-results=(map [term beam] (unit cage))
|
||||||
|
%- my :~
|
||||||
|
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/mar]]
|
||||||
|
:- ~
|
||||||
|
:- %hoon
|
||||||
|
:- hoon-src-type
|
||||||
|
hoon-src
|
||||||
|
::
|
||||||
|
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/foo/ren]]
|
||||||
|
~
|
||||||
|
::
|
||||||
|
:- [%cx [[~nul %home %da ~1234.5.6] /hoon/data]]
|
||||||
|
:- ~
|
||||||
|
:- %hoon
|
||||||
|
:- hoon-src-type
|
||||||
|
'''
|
||||||
|
[12 13]
|
||||||
|
'''
|
||||||
|
==
|
||||||
|
::
|
||||||
|
=^ results1 ford
|
||||||
|
%- test-ford-call-with-comparator :*
|
||||||
|
ford
|
||||||
|
now=~1234.5.6
|
||||||
|
scry=(scry-with-results-and-failures scry-results)
|
||||||
|
::
|
||||||
|
::
|
||||||
|
^= call-args
|
||||||
|
:* duct=~[/path] type=~ %make ~nul
|
||||||
|
%pin ~1234.5.6
|
||||||
|
[%bake %foo *coin `rail:ford-gate`[[~nul %home] /hoon/data]]
|
||||||
|
==
|
||||||
|
::
|
||||||
|
^= comparator
|
||||||
|
|= moves=(list move:ford-gate)
|
||||||
|
::
|
||||||
|
?> =(1 (lent moves))
|
||||||
|
?> ?=(^ moves)
|
||||||
|
?> ?=([* %give %made @da %complete %success %pin *] i.moves)
|
||||||
|
=/ result result.p.card.i.moves
|
||||||
|
=/ pin-result build-result.result
|
||||||
|
?> ?=([%success %bake *] build-result.pin-result)
|
||||||
|
::
|
||||||
|
=/ =cage cage.build-result.pin-result
|
||||||
|
::
|
||||||
|
%+ weld
|
||||||
|
%- expect-eq !>
|
||||||
|
:- %foo
|
||||||
|
p.cage
|
||||||
|
::
|
||||||
|
%+ weld
|
||||||
|
%- expect-eq !>
|
||||||
|
:- [12 13]
|
||||||
|
q.q.cage
|
||||||
|
::
|
||||||
|
%- expect-eq !>
|
||||||
|
:- &
|
||||||
|
(~(nest ut p.q.cage) | -:!>([12 13]))
|
||||||
|
==
|
||||||
|
::
|
||||||
|
;: weld
|
||||||
|
results1
|
||||||
|
(expect-ford-empty ford ~nul)
|
||||||
|
==
|
||||||
|
::
|
||||||
::
|
::
|
||||||
:: |utilities: helper arms
|
:: |utilities: helper arms
|
||||||
::
|
::
|
||||||
|
@ -2689,7 +2689,7 @@
|
|||||||
::
|
::
|
||||||
%pin (make-pin date schematic)
|
%pin (make-pin date schematic)
|
||||||
%alts (make-alts choices)
|
%alts (make-alts choices)
|
||||||
%bake !!
|
%bake (make-bake renderer query-string path-to-render)
|
||||||
%bunt (make-bunt disc mark)
|
%bunt (make-bunt disc mark)
|
||||||
%call (make-call gate sample)
|
%call (make-call gate sample)
|
||||||
%cast (make-cast disc mark input)
|
%cast (make-cast disc mark input)
|
||||||
@ -2778,6 +2778,62 @@
|
|||||||
::
|
::
|
||||||
[build [%build-result %success %alts u.result] accessed-builds]
|
[build [%build-result %success %alts u.result] accessed-builds]
|
||||||
::
|
::
|
||||||
|
++ make-bake
|
||||||
|
|= [renderer=term query-string=coin path-to-render=rail]
|
||||||
|
^- build-receipt
|
||||||
|
::
|
||||||
|
=/ path-build=^build
|
||||||
|
[date.build [%path disc.path-to-render %ren renderer]]
|
||||||
|
::
|
||||||
|
=^ path-result accessed-builds (depend-on path-build)
|
||||||
|
?~ path-result
|
||||||
|
[build [%blocks [path-build]~ ~] accessed-builds]
|
||||||
|
:: if no renderer at :renderer path, try a mark instead
|
||||||
|
::
|
||||||
|
?. ?=([~ %success %path *] path-result)
|
||||||
|
::
|
||||||
|
=/ mark-build=^build
|
||||||
|
:- date.build
|
||||||
|
[%cast disc.path-to-render renderer [%core path-to-render]]
|
||||||
|
::
|
||||||
|
=^ mark-build-result accessed-builds (depend-on mark-build)
|
||||||
|
?~ mark-build-result
|
||||||
|
[build [%blocks [mark-build]~ ~] accessed-builds]
|
||||||
|
::
|
||||||
|
?. ?=([~ %success %cast *] mark-build-result)
|
||||||
|
(wrap-error mark-build-result)
|
||||||
|
::
|
||||||
|
=/ =build-result
|
||||||
|
[%success %bake cage.u.mark-build-result]
|
||||||
|
::
|
||||||
|
[build [%build-result build-result] accessed-builds]
|
||||||
|
:: build a +scaffold from the renderer source
|
||||||
|
::
|
||||||
|
=/ hood-build=^build [date.build [%hood rail.u.path-result]]
|
||||||
|
::
|
||||||
|
=^ hood-result accessed-builds (depend-on hood-build)
|
||||||
|
?~ hood-result
|
||||||
|
[build [%blocks [hood-build]~ ~] accessed-builds]
|
||||||
|
::
|
||||||
|
?. ?=([~ %success %hood *] hood-result)
|
||||||
|
(wrap-error hood-result)
|
||||||
|
:: link the renderer, passing through :path-to-render and :query-string
|
||||||
|
::
|
||||||
|
=/ plan-build=^build
|
||||||
|
[date.build [%plan path-to-render query-string scaffold.u.hood-result]]
|
||||||
|
::
|
||||||
|
=^ plan-result accessed-builds (depend-on plan-build)
|
||||||
|
?~ plan-result
|
||||||
|
[build [%blocks [plan-build]~ ~] accessed-builds]
|
||||||
|
::
|
||||||
|
?. ?=([~ %success %plan *] plan-result)
|
||||||
|
(wrap-error plan-result)
|
||||||
|
::
|
||||||
|
=/ =build-result
|
||||||
|
[%success %bake %noun vase.u.plan-result]
|
||||||
|
::
|
||||||
|
[build [%build-result build-result] accessed-builds]
|
||||||
|
::
|
||||||
++ make-bunt
|
++ make-bunt
|
||||||
|= [=disc mark=term]
|
|= [=disc mark=term]
|
||||||
^- build-receipt
|
^- build-receipt
|
||||||
|
Loading…
Reference in New Issue
Block a user