First generator build ran.

This commit is contained in:
Elliot Glaysher 2018-10-10 15:26:51 -07:00
parent e0100a32be
commit 31613fcca0
9 changed files with 78 additions and 38 deletions

View File

@ -226,4 +226,6 @@
++ woot-helm (wrap take-woot):from-helm
++ writ-kiln-autoload (wrap take-writ-autoload):from-kiln
++ writ-kiln-sync (wrap take-writ-sync):from-kiln
++ bound (wrap take-bound):from-helm
--

View File

@ -2,10 +2,15 @@
::
:: outer gate is a standard generator
::
|= [bowl:gall base-path=[=desk =spur] $~]
|= [[now=@da eny=@ bek=beak] $~ $~]
::
:- %build
|= http-request
:: :- %build
|= [authorized=? http-request:light]
^- mime
:- ['text' 'html' ~]
%- as-octs:mimes:html
%- crip
%- en-xml:html
^- manx
;html
;head
@ -13,7 +18,7 @@
==
;body
;h1:"Ran generator"
;p:"Executing on {<(scot %p our)>}."
:: ;p:"Executing on {<(scot %p our)>}."
;p:"The method was {<(trip method)>}."
;p:"The url was {<(trip url)>}."
==

View File

@ -3,18 +3,13 @@
:::: /hoon/serve/hood/gen
::
/? 310
/+ old-zuse
=, old-zuse
::
::::
::
:- %say
::
:: TODO: dojo doesn't like the types?
|= $: {now/@da eny/@uvJ bec/beak}
{{pax/$@(term {i/knot t/path}) ~} ~}
{{=binding:light =generator:light ~} ~}
==
:- %helm-serve
?@ pax pax
=+ bem=(need (tome pax))
?. =([%da now] r.bem) :: XX actual sentinel
bem
bem(r [%ud 0])
[%helm-serve binding generator]

View File

@ -51,7 +51,8 @@
{$flog wire flog:dill} ::
{$funk wire @p @p @} ::
{$nuke wire ship} ::
{$serv wire ?(desk beam)} ::
:: {$serv wire ?(desk beam)} ::
[%serve wire binding:light generator:light] ::
{$poke wire dock pear} ::
{$want wire sock path *} :: send message
== ::
@ -111,9 +112,9 @@
%^ emit %poke /helm/ask/(scot %p ~socden-malzod)
[[~socden-malzod %ask] %ask-mail mel]
::
++ poke-serve
|= top/?(desk beam) =< abet
(emit %serv /helm/serv top)
:: ++ poke-serve
:: |= top/?(desk beam) =< abet
:: (emit %serv /helm/serv top)
::
++ poke-hi
|= mes/@t
@ -245,6 +246,14 @@
|= {way/wire her/ship cop/coop} =< abet
(emit %flog ~ %text "woot: {<[way cop]>}")
::
++ poke-serve
|= [=binding:light =generator:light] =< abet
(emit %serve /helm/serv binding generator)
::
++ take-bound
|= [wir=wire success=? binding=binding:light] =< abet
(emit %flog ~ %text "bound: {<success>}")
::
++ poke-tlon-init-stream
:: creates stream channel and makes it pull from
:: urbit-meta on {met}.

View File

@ -11,7 +11,7 @@
::
++ grab :: convert from
|%
++ noun mime :: clam from %noun
+$ noun mime :: clam from %noun
++ tape
|=(a/_"" [/application/x-urb-unknown (as-octt:mimes:html a)])
--

View File

@ -1268,6 +1268,7 @@
$well `%e
$wipe `%f
%connect `%l
%serve `%l
==
--
--

View File

@ -160,7 +160,7 @@
+$ action
$% :: dispatch to a generator
::
[%gen generator=[=desk path=(list @t)] args=*]
[%gen =generator]
:: dispatch to an application
::
[%app app=term]
@ -225,10 +225,20 @@
==
==
==
:: +render-tang: renders a tang and adds <br/> tags between each line
::
++ render-tang
|= {wid/@u tan/tang}
^- marl
=/ raw=(list tape) (zing (turn tan |=(a/tank (wash 0^wid a))))
::
|- ^- marl
?~ raw ~
[;/(i.raw) ;br; $(raw t.raw)]
:: +internal-server-error: 500 page, with a tang
::
++ internal-server-error
|= [authorized=? url=@t =tang]
|= [authorized=? url=@t t=tang]
^- octs
%- as-octs:mimes:html
%- crip
@ -242,7 +252,7 @@
;p:"There was an error while handling the request for {<(trip url)>}."
;* ?: authorized
;=
;p:"hi"
;code:"*{(render-tang 80 t)}"
==
~
==
@ -319,21 +329,22 @@
?- -.u.action
::
%gen
=/ =disc:ford [our desk.generator.u.action]
::
=- [[duct %pass /run-build/a %f %build our live=%.n schematic=-]~ state]
=- [[duct %pass /run-build %f %build our live=%.n schematic=-]~ state]
::
^- schematic:ford
::
=- [%cast disc %mime -]
=- [%cast [our desk.generator.u.action] %mime -]
::
^- schematic:ford
:+ %call
:+ %call
[%core [[our desk.generator.u.action] (flop path.generator.u.action)]]
:: TODO: Figure out what goes in generators. We need to slop the
:: prelude with the arguments passed in.
::
[%$ %txt !>('one two three')]
:: :+ %call
:: :+ %call
:: [%core [disc path.generator.u.action]]
:: []
:: [authenticated http-request]
[%$ %noun !>([[now=now eny=eny bek=[our desk.generator.u.action [%da now]]] ~ ~])]
[%$ %noun !>([authenticated http-request])]
::
%app
:_ state
@ -505,11 +516,11 @@
?: ?=(%incomplete -.made-result)
%^ return-static-data-on-duct 500 'text/html'
:: TODO: Thread original URL and authentication state here.
(internal-server-error %.n 'http://' tang.made-result)
(internal-server-error %.y 'http://' tang.made-result)
::
?: ?=(%error -.build-result.made-result)
%^ return-static-data-on-duct 500 'text/html'
(internal-server-error %.n 'http://' message.build-result.made-result)
(internal-server-error %.y 'http://' message.build-result.made-result)
::
=/ =cage (result-to-cage:ford build-result.made-result)
::
@ -796,7 +807,7 @@
%+ add-binding binding.task
?- -.task
%connect [%app app.task]
%serve [%gen generator.task arguments.task]
%serve [%gen generator.task]
==
[moves light-gate]
::
@ -817,7 +828,7 @@
=/ =sign q.wrapped-sign
:: :wire must at least contain two parts, the type and the build
::
?> ?=([@ @ *] wire)
?> ?=([@ *] wire)
::
|^ ^- [p=(list move) q=_light-gate]
::

View File

@ -2240,7 +2240,7 @@
[%connect =binding app=term]
:: connects a binding to a generator
::
[%serve =binding generator=[=desk path=(list @t)] arguments=*]
[%serve =binding =generator]
:: disconnects a binding
::
:: This must be called with the same duct that made the binding in
@ -2270,6 +2270,23 @@
::
path=(list @t)
==
:: +generator: a generator on the local ship that handles requests
::
:: This refers to a generator on the local ship, run with a set of
:: arguments. Since http requests are time sensitive, we require that the
:: generator be on the current ship.
::
+$ generator
$: :: desk: desk on current ship that contains the generator
::
=desk
:: path: path on :desk to the generator's hoon file
::
path=(list @t)
:: args: arguments passed to the gate
::
args=*
==
:: %config: http configuration
::
+| %config

View File

@ -628,7 +628,7 @@
::
%+ weld
%+ expect-eq
!> /run-build/a
!> /run-build
!> p.card
::
%+ expect-schematic
@ -643,7 +643,7 @@
now=~1111.1.3
scry=*sley
^= take-args
:* wire=/run-build/a duct=~[/http-blah]
:* wire=/run-build duct=~[/http-blah]
^- (hypo sign:light-gate)
:- *type
:^ %f %made ~1111.1.3