mirror of
https://github.com/urbit/shrub.git
synced 2024-12-12 10:29:01 +03:00
Merge branch 'test' into demo
Conflicts: urb/urbit.pill urb/zod/base/ape/hood.hoon urb/zod/base/mar/hoon.hoon
This commit is contained in:
commit
49ee373df7
@ -1,524 +0,0 @@
|
||||
:: digital ocean fleet management
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 314
|
||||
/- *talk
|
||||
/+ talk, sole, http
|
||||
|
||||
::
|
||||
::
|
||||
:::: sivtyv-barnel
|
||||
::
|
||||
|
||||
!:
|
||||
|%
|
||||
++ instance
|
||||
$: plat=?(%do %gce) name=@t id=@t status=@t created=@da snapshot=name=@t ::disk=@u region=@t
|
||||
::ip=(list ,@if)
|
||||
==
|
||||
++ create-req-do
|
||||
$:
|
||||
name=@t ::region=@t
|
||||
size=@t image=@t ssh=(list cord)
|
||||
backups=(unit ,?) ipv6=(unit ,?)
|
||||
private-networking=(unit ,?) user-data=(unit ,@t)
|
||||
==
|
||||
++ create-req-gce ,[project=@t zone=@t name=@t machine-type=@t]
|
||||
++ axle
|
||||
$: auth=[do=keys gce=keys] toke=[do=tokens gce=tokens]
|
||||
insts=(map ,@t instance)
|
||||
==
|
||||
++ keys ,[authc=(unit ,@t) client-secret=(unit ,@t)]
|
||||
++ tokens ,[access=@t refresh=@t]
|
||||
++ move ,[bone card]
|
||||
++ card
|
||||
$% [%diff %json json]
|
||||
[%wait wire @da]
|
||||
[%send wire [ship term] %poke %talk-command command]
|
||||
[%them wire (unit hiss)]
|
||||
==
|
||||
--
|
||||
!:
|
||||
|% :::
|
||||
++ parse-iso8601
|
||||
=< (cook to-time (parsf ;"{parse-day}T{parse-seconds}{parse-zone}"))
|
||||
|%
|
||||
++ to-time
|
||||
|= [[y=@u m=@u d=@u] t=[h=@u m=@u s=@u ms=@u] [syn=? zh=@u zm=@u]]
|
||||
^- @da
|
||||
%- year
|
||||
^- date
|
||||
=: h.t ?:(syn (sub h.t zh) (add h.t zh))
|
||||
m.t ?:(syn (sub m.t zm) (add m.t zm))
|
||||
==
|
||||
[[& y] m d h.t m.t s.t (div (mul ms.t 0x1.0000) 1.000) ~]
|
||||
++ parse-day (parsf ;"{dem}\-{dem}\-{dem}")
|
||||
++ parse-seconds (parsf ;"{dem}:{dem}:{dem}{(optional ;~(pfix dot dem))}")
|
||||
++ optional |*(fel=_rule ;~(pose fel (easy 0)))
|
||||
++ parse-zone
|
||||
;~ pose
|
||||
(cold [& 0 0] (jest 'Z'))
|
||||
(parsf ;"{parse-zone-sign}{dem}:{dem}")
|
||||
==
|
||||
++ parse-zone-sign ;~(plug ;~(pose (cold & lus) (cold | hep)))
|
||||
--
|
||||
++ key-do
|
||||
(mo [%start 'power_on'] [%stop 'shutdown'] [%reboot 'power_cycle'] ~)
|
||||
++ adapter-do
|
||||
|= a=cord
|
||||
(~(got by key-do) a)
|
||||
++ parse-ip-do
|
||||
=> jo
|
||||
%- ot
|
||||
:_ ~ v4/(ar (ot 'ip_address'^(su lip:ag) ~))
|
||||
++ parse-ip-gce
|
||||
=> jo
|
||||
%+ cu |=(a=(list (list ,@if)) `(list ,@if)`(zing a))
|
||||
(ar (ot 'accessConfigs'^(ar (ot 'natIP'^(su lip:ag) ~)) ~))
|
||||
++ tail-url
|
||||
|= a=cord
|
||||
-:(flop q.q:(need (epur a)))
|
||||
++ parse-region
|
||||
=> jo
|
||||
(ot name/so ~)
|
||||
++ parse-id-text
|
||||
|= jon=json
|
||||
?.(?=([?(%n %s) *] jon) ~ (some p.jon))
|
||||
++ create-do-body
|
||||
|= $: name=@t ::region=@t
|
||||
size=@t image=@t ssh-keys=(list cord)
|
||||
backups=(unit ,?) ipv6=(unit ,?) private-networking=(unit ,?) user-data=(unit ,@t)
|
||||
==
|
||||
%- jobe
|
||||
:~ name/s/name ::region/s/region
|
||||
size/s/size image/s/image ::(jone image)
|
||||
backups/?~(backups ~ b/u.backups) ipv6/?~(ipv6 ~ b/u.ipv6)
|
||||
'user_data'^?~(user-data ~ s/u.user-data) 'private_networking'^?~(private-networking ~ b/u.private-networking)
|
||||
==
|
||||
++ convert-do
|
||||
|= a=?(%start %stop %reboot)
|
||||
?- a
|
||||
%start
|
||||
'power_on'
|
||||
%stop
|
||||
'shutdown'
|
||||
%reboot
|
||||
'power_cycle'
|
||||
==
|
||||
++ state-to-json
|
||||
|= a=(list instance)
|
||||
:- %a
|
||||
%+ turn a
|
||||
|= instance
|
||||
^- json
|
||||
%- jobe
|
||||
:~ name/`json`s/name
|
||||
id/s/id
|
||||
status/s/status
|
||||
created/s/(crip (dust (yore created)))
|
||||
::region/s/region
|
||||
snapshot/s/snapshot
|
||||
:: disk/`json`(jone disk)
|
||||
::ip/a/(turn ip |=(a=@if s/(rsh 3 1 (scot %if a))))
|
||||
==
|
||||
--
|
||||
!:
|
||||
|_ [bowl vat=axle]
|
||||
::
|
||||
++ prep ,_`.
|
||||
::
|
||||
++ peer
|
||||
|= pax=path
|
||||
^- [(list move) _+>.$]
|
||||
:_ +>.$
|
||||
=+ lis=(~(tap by insts.vat))
|
||||
[ost %diff %json (state-to-json (turn lis |=(a=[@t instance] +.a)))]~
|
||||
::
|
||||
++ spam
|
||||
|= jon=json
|
||||
%+ turn (~(tap by sup))
|
||||
|= [sub=bone @ pax=path]
|
||||
^- move
|
||||
[sub %diff %json jon]
|
||||
++ httpreq
|
||||
|= $: pour-path=wire
|
||||
domain=(list cord) end-point=path
|
||||
req-type=$?(%get %delt [%post json]) headers=math
|
||||
queries=quay
|
||||
==
|
||||
^- move
|
||||
=+ ^- parsed-url=purl
|
||||
:+ ^= host-port :: ++hart
|
||||
:+ security=%.y
|
||||
port=~
|
||||
host=[%.y [path=[%com domain]]]
|
||||
endpoint=[extensions=~ point=end-point] :: ++pork,
|
||||
q-strings=queries :: ++quay
|
||||
=+ ^- request=hiss :: cast to hiss
|
||||
:- parsed-url
|
||||
?@ req-type
|
||||
[req-type headers ~]
|
||||
[%post headers ~ (tact (pojo +.req-type))]
|
||||
:^ ost %them pour-path
|
||||
`(unit hiss)`[~ request]
|
||||
::
|
||||
++ auth-queries
|
||||
|= code=cord
|
||||
:~ 'grant_type'^'authorization_code'
|
||||
'code'^code
|
||||
:- 'client_id'
|
||||
'd8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f'
|
||||
'redirect_uri'^'http://localhost:8443/home/pub/cloud/fab'
|
||||
==
|
||||
::
|
||||
++ poke-cloud-auth
|
||||
|= [cde=cord typ=cord]
|
||||
^- [(list move) _+>.$]
|
||||
?: =(%do typ)
|
||||
=. authc.do.auth.vat
|
||||
[~ cde]
|
||||
:_ +>.$ ~
|
||||
=. access.gce.toke.vat
|
||||
cde
|
||||
:_ +>.$
|
||||
:- list-instances-gce
|
||||
~[(publish [%lin & 'successfully authenticated to gce']~)]
|
||||
::
|
||||
++ poke-cloud-secret
|
||||
|= [secret=cord typ=cord]
|
||||
^- [(list move) _+>.$]
|
||||
?+ typ ~|(missing-platform=typ !!)
|
||||
%do
|
||||
=. client-secret.do.auth.vat
|
||||
[~ secret]
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
%+ httpreq /auth-do
|
||||
:^ ~[%digitalocean %cloud] `path`/v1/oauth/token
|
||||
[%post ~]
|
||||
:- ~ `quay`['client_secret'^secret (auth-queries (need authc.do.auth.vat))]
|
||||
==
|
||||
::
|
||||
++ receive-auth
|
||||
|= [pour-path=cord resp=httr]
|
||||
^- [(list move) _+>.$]
|
||||
~| resp
|
||||
=+ body=(rash q:(need r.resp) apex:poja)
|
||||
~| recieve-auth/resp(r body)
|
||||
?+ pour-path !!
|
||||
%auth-do
|
||||
=+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body))
|
||||
=: access.do.toke.vat ac
|
||||
refresh.do.toke.vat re
|
||||
==
|
||||
:_ +>.$
|
||||
:~ list-instances-do
|
||||
(publish [%lin & 'successfully authenticated']~)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ poke-json
|
||||
|= act=json
|
||||
^- [(list move) _+>.$]
|
||||
=+ do=(need ((ot action/so ~):jo act))
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
?+ do !!
|
||||
%list
|
||||
list-instances-do
|
||||
::
|
||||
%create-do
|
||||
(create-do act)
|
||||
::
|
||||
%create-gce
|
||||
(create-gce-disk act)
|
||||
::
|
||||
?(%start %stop %reboot %delete)
|
||||
=+ id=(need ((ot id/so ~):jo act))
|
||||
(instance-action id do)
|
||||
==
|
||||
::
|
||||
++ instance-action
|
||||
|= $: id=@t
|
||||
$= action $?
|
||||
%start %stop %reboot %delete
|
||||
== ==
|
||||
=+ d=(~(got by insts.vat) id)
|
||||
~| 'can\'t find id'
|
||||
=+ typ=?~(d !! -.d)
|
||||
?- typ
|
||||
%do
|
||||
=+ meth=?:(?=(%delete action) %delt [%post (jobe type/s/(convert-do action) ~)])
|
||||
^- move
|
||||
=+ ^= req
|
||||
%- httpreq :*
|
||||
/action-test
|
||||
~[%digitalocean %api]
|
||||
?:(?=(%delt meth) /v2/droplets/[id] /v2/droplets/[id]/actions)
|
||||
meth
|
||||
%^ mo ['Content-Type' 'application/json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~
|
||||
*quay
|
||||
==
|
||||
req
|
||||
%gce
|
||||
?- action
|
||||
%start
|
||||
!!
|
||||
%stop
|
||||
!!
|
||||
%reboot
|
||||
!!
|
||||
%delete
|
||||
!!
|
||||
==
|
||||
==
|
||||
::
|
||||
++ create-do
|
||||
|= act=json
|
||||
=+ ^- deets=create-req-do
|
||||
%- need
|
||||
%. act
|
||||
=> jo
|
||||
%- ot
|
||||
:~ name/so size/so image/so :: id key:img object region/so
|
||||
ssh/(ar so) backups/(mu bo)
|
||||
'ipv6'^(mu bo) 'priv_networking'^(mu bo) 'user_data'^(mu so)
|
||||
==
|
||||
=+ ^- body=json
|
||||
%- create-do-body :*
|
||||
name.deets size.deets image.deets ssh.deets backups.deets ::region.deets
|
||||
ipv6.deets private-networking.deets user-data.deets
|
||||
==
|
||||
%- httpreq :*
|
||||
/create-do
|
||||
~[%digitalocean %api] /v2/droplets
|
||||
[%post body]
|
||||
%^ mo ['Content-Type' 'application/json; charset=utf-8' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
::
|
||||
++ create-gce-disk
|
||||
|= act=json :: num=(unit ,@u)
|
||||
~& act
|
||||
=+ :- name=(need ((ot name/so ~):jo act))
|
||||
snapshot=(need ((ot 'instance_img'^so ~):jo act))
|
||||
=+ :- name=(need ((ot name/so ~):jo act))
|
||||
snap=(need ((ot snap/so ~):jo act))
|
||||
=+ ^- body=json
|
||||
(jobe name/s/name %'sourceSnapshot'^s/'compute/v1/projects/urbcloud/global/snapshots/snapshot-1' ~) ::^so/snap ~)
|
||||
%- httpreq
|
||||
:* /create-gce-disk/snapshot/name
|
||||
~['googleapis' 'www'] /compute/v1/projects/urbcloud/zones/us-central1-a/disks
|
||||
[%post body]
|
||||
%^ mo ['Content-Type' 'application/json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
::
|
||||
++ ask-disk-status
|
||||
|= pax=path ^- move
|
||||
~& 'ask disk status'
|
||||
=+ :- safe=(slav %uv ?~(pax !! -.pax))
|
||||
snap=?.(?=([* ^] pax) !! i.t.pax)
|
||||
=+ link=(need (epur ?~(pax !! safe)))
|
||||
=. r.link ['access_token'^access.gce.toke.vat r.link]
|
||||
:^ ost %them `wire`/disk-status/snap
|
||||
`(unit hiss)`[~ [link [%get ~ ~]]]
|
||||
::
|
||||
++ disk-status ::receive
|
||||
|= [ins-img=@t resp=httr]
|
||||
^- [(list move) _+>.$]
|
||||
~& 'disk status called'
|
||||
=+ hcode=p.resp
|
||||
?: =('200' hcode)
|
||||
~| 'did not receive 200' !!
|
||||
=+ :-(parsed=(rash q:(need r.resp) apex:poja) jo)
|
||||
~& parsed
|
||||
=+ :- status=(need ((ot status/so ~) parsed))
|
||||
lin=(need ((ot 'selfLink'^so ~) parsed))
|
||||
=+ link=(scot %uv lin)
|
||||
?: =('DONE' status)
|
||||
~& resp
|
||||
~& 'boot disk now running, now starting instance'
|
||||
=+ target=(need ((ot 'targetLink'^so ~):jo parsed))
|
||||
=+ nam=-:(flop q.q:(need (epur target)))
|
||||
~& nam
|
||||
:_ +>.$ ~[(create-gce nam ins-img)]
|
||||
:_ +>.$
|
||||
[ost %wait `path`[%check-status link ins-img ~] `@da`(add ~s3 now)]~ :: refesh every 10 sec
|
||||
::
|
||||
++ create-gce
|
||||
|= [name=@t snap=@t]
|
||||
~& create-gce-received/snap
|
||||
=+ src=(cat 3 'compute/v1/projects/urbcloud/zones/us-central1-a/disks/' name)
|
||||
=+ ^- body=json
|
||||
%- jobe
|
||||
:~ name/s/name 'machineType'^s/'zones/us-central1-a/machineTypes/n1-standard-1'
|
||||
:- %disks :- %a :_ ~
|
||||
(jobe boot/b/%.y type/s/'persistent' source/s/src ~)
|
||||
:- 'networkInterfaces' :- %a :_ ~
|
||||
(joba 'network' `json`[%s 'global/networks/default'])
|
||||
==
|
||||
%- httpreq
|
||||
:* `path`/create-gce
|
||||
`(list cord)`~['googleapis' 'www'] `path`/compute/v1/projects/urbcloud/zones/us-central1-a/'instances'
|
||||
[%post `json`body]
|
||||
%^ mo ['Content-Type' 'application/json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~]
|
||||
~
|
||||
`quay`[%key access.gce.toke.vat]~
|
||||
==
|
||||
::
|
||||
++ wake
|
||||
|= [pour-path=path ~]
|
||||
?+ -.pour-path !!
|
||||
%refresh-do
|
||||
:_ +>.$
|
||||
[list-instances-do]~
|
||||
%refresh-gce
|
||||
:_ +>.$
|
||||
[list-instances-gce]~
|
||||
%check-status
|
||||
:_ +>.$
|
||||
[(ask-disk-status +.pour-path)]~
|
||||
==
|
||||
::
|
||||
++ list-instances-gce
|
||||
=+ ^= lis
|
||||
:*
|
||||
/list-gce
|
||||
~[%googleapis %www] /compute/v1/projects/urbcloud/zones/['us-central1-a']/'instances'
|
||||
%get ~
|
||||
^- quay
|
||||
[%'access_token' access.gce.toke.vat]~
|
||||
==
|
||||
(httpreq lis)
|
||||
::
|
||||
++ receive-list-gce
|
||||
|= resp=httr
|
||||
^- [(list move) _+>.$]
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja) :: body httr to json
|
||||
=+ items=(need ((ot items/(ar some) ~):jo parsed))
|
||||
=+ ^- ins=(list ,[@t instance])
|
||||
~| 'bad-json'^items
|
||||
%+ turn items
|
||||
|= in=json
|
||||
=< [id .]
|
||||
^- instance
|
||||
:- %gce
|
||||
%- need
|
||||
%. in =+ jo
|
||||
%- ot
|
||||
:~ name/so id/so status/so 'creationTimestamp'^(su parse-iso8601) ::zone/so
|
||||
'machineType'^(cu tail-url so)
|
||||
:: 'networkInterfaces'^parse-ip-gce
|
||||
==
|
||||
=+ ^= new
|
||||
%+ skip ins
|
||||
|=(a=[@t instance] (~(has by insts.vat) id.a))
|
||||
=. insts.vat
|
||||
(~(gas by insts.vat) new)
|
||||
=+ buf=`@da`(add ~s10 now)
|
||||
:_ +>.$
|
||||
=+ lis=(~(tap by insts.vat))
|
||||
:_ (spam (state-to-json (turn lis |=(a=[@t instance] +.a))))
|
||||
[ost %wait /refresh-gce buf]
|
||||
|
||||
++ list-instances-do
|
||||
=+ ^= lis
|
||||
:~ /list-do
|
||||
~[%digitalocean %api] /v2/droplets
|
||||
%get
|
||||
(mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~)
|
||||
==
|
||||
(httpreq lis)
|
||||
::
|
||||
++ receive-list-do
|
||||
|= resp=httr
|
||||
^- [(list move) _+>.$]
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja) :: parse httr to json
|
||||
~| recieve-list/parsed
|
||||
=+ dar=(need ((ot droplets/(ar some) ~):jo parsed)) :: reparse ar of insts
|
||||
=. insts.vat
|
||||
%- ~(gas by insts.vat)
|
||||
^- dropz=(list ,[@t instance])
|
||||
~| bad-json/-.dar
|
||||
%+ turn dar
|
||||
|= drp=json ^- [@t instance]
|
||||
=- ~! - -
|
||||
=< [id .]
|
||||
^- instance
|
||||
:- %do
|
||||
%- need
|
||||
%. drp
|
||||
=+ jo
|
||||
%- ot
|
||||
:~ name/so id/parse-id-text status/so 'created_at'^(su parse-iso8601) ::region/parse-region
|
||||
image/(ot name/so ~) ::disk/ni
|
||||
:: networks/parse-ip-do
|
||||
==
|
||||
=+ buf=`@da`(add ~s10 now)
|
||||
:_ +>.$
|
||||
=+ lis=(~(tap by insts.vat) *(list ,[@t instance]))
|
||||
:_ (spam (state-to-json (turn lis |=(a=[@t instance] +.a))))
|
||||
[ost %wait /refresh-do buf]
|
||||
|
||||
++ thou
|
||||
|= [pour-path=path resp=httr]
|
||||
^- [(list move) _+>.$]
|
||||
?+ -.pour-path ~& pour-path !!
|
||||
%auth-do
|
||||
(receive-auth -.pour-path resp)
|
||||
::
|
||||
%auth-gce
|
||||
(receive-auth -.pour-path resp)
|
||||
::
|
||||
%list-do
|
||||
(receive-list-do resp)
|
||||
%list-gce
|
||||
(receive-list-gce resp)
|
||||
::
|
||||
$?
|
||||
%delete %reboot %'power_cycle' %shutdown %'power_off'
|
||||
%'power_on' %'password_reset' %'enable_ipv6' %'enable_private_networking'
|
||||
%snapshot %upgrade :: add retrieve droplet action
|
||||
%create-do %create-gce %action-test
|
||||
==
|
||||
:_ +>.$ ~
|
||||
::
|
||||
?(%create-gce-disk %disk-status)
|
||||
=+ snap=?~(t.pour-path !! i.t.pour-path)
|
||||
(disk-status snap resp)
|
||||
::
|
||||
%check-status
|
||||
:_ +>.$ ~[(ask-disk-status +.pour-path)]
|
||||
::
|
||||
%pub
|
||||
:_ +>.$ ~
|
||||
::
|
||||
==
|
||||
++ publish
|
||||
|= [act=(list speech)]
|
||||
^- move
|
||||
=+ ^= spchz
|
||||
%+ turn act
|
||||
|= sp=speech
|
||||
=+ ^= tail
|
||||
:- ^- audience
|
||||
:+ :- `partner`[%& our ?+((clan our) !! %czar %court, %duke %porch)]
|
||||
^- (pair envelope delivery)
|
||||
[`envelope`[& ~] %pending]
|
||||
~
|
||||
~
|
||||
`statement`[now ~ sp]
|
||||
^- thought
|
||||
:- `@`(sham eny tail)
|
||||
tail
|
||||
=+ mez=[%talk-command [%publish `(list thought)`spchz]]
|
||||
[ost %send /pub [our %talk] %poke mez]
|
||||
--
|
@ -672,7 +672,7 @@
|
||||
^- (quip move +>)
|
||||
~? !=(src.hid our.hid) [%dojo-peer-stranger ost.hid src.hid pax]
|
||||
:: ?> =(src.hid our.hid)
|
||||
?< (~(has by hoc) ost.hid)
|
||||
~? (~(has by hoc) ost.hid) [%dojo-peer-replaced ost.hid pax]
|
||||
?> =(~ pax)
|
||||
=< he-abet
|
||||
%~ he-peer he
|
||||
|
@ -1,5 +1,5 @@
|
||||
:: :: ::
|
||||
:::: /hoon/hood/ape :: ::
|
||||
:: :: ::
|
||||
:::: /hoon/hood/ape :: ::
|
||||
:: :: ::
|
||||
/? 314 :: zuse version
|
||||
/+ sole, talk, helm, kiln, drum :: libraries
|
||||
@ -53,7 +53,7 @@
|
||||
++ coup-kiln-spam ::
|
||||
|= [way=wire saw=(unit tang)]
|
||||
~? ?=(^ saw) [%kiln-spam-lame u.saw]
|
||||
[~ +>]
|
||||
[~ +>]
|
||||
::
|
||||
++ coup-drum-phat (wrap take-coup-phat):from-drum
|
||||
++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum
|
||||
|
@ -178,7 +178,7 @@
|
||||
|= [wid=@u tan=tang]
|
||||
^- tape
|
||||
=+ rolt=|=(a=wall `tape`?~(a ~ :(weld i.a "\0a" $(a t.a))))
|
||||
(rolt (turn tan |=(a=tank (rolt (wash 0^wid a)))))
|
||||
(rolt (turn (flop tan) |=(a=tank (rolt (wash 0^wid a)))))
|
||||
::
|
||||
::
|
||||
++ add-cookies
|
||||
@ -187,7 +187,7 @@
|
||||
=+ cuh=(turn `(list ,@t)`cug |=(a=@t set-cookie/a))
|
||||
hit(q (weld cuh q.hit))
|
||||
::
|
||||
++ add-poll :: inject dependency
|
||||
++ inject :: inject dependency
|
||||
|= [dep=@uvH max=[[%html ~] [[%head ~] hed=marl] [[%body ~] tal=marl] ~]]
|
||||
^- manx
|
||||
=: hed.max :_(hed.max ;meta(charset "utf-8", urb_injected "");)
|
||||
@ -197,7 +197,7 @@
|
||||
max(hed :_(hed.max ;script@"/~/on/{<dep>}.js"(urb_injected "");))
|
||||
::
|
||||
++ add-json :: inject window.urb
|
||||
|= [urb=json jaz=cord] ^- cord
|
||||
|= [urb=json jaz=cord] ^- cord
|
||||
=- (cat 3 (crip -) jaz)
|
||||
"""
|
||||
var _urb = {(pojo urb)}
|
||||
@ -221,7 +221,6 @@
|
||||
|= tan=tang
|
||||
;html
|
||||
;head
|
||||
;meta(charset "utf-8");
|
||||
;link(rel "stylesheet", href "/home/lib/base.css");
|
||||
;title: server error
|
||||
==
|
||||
@ -765,7 +764,7 @@
|
||||
=- `silk`[%cast %mime %done ~ cay(q.q -)]
|
||||
?+ p.cay q.q.cay :: inject dependency long-poll
|
||||
%urb =| urb=[[%html ~] [[%head ~] marl] [[%body ~] manx marl] ~]
|
||||
.*(.(urb q.q.cay) !=((add-poll p.sih urb)))
|
||||
.*(.(urb q.q.cay) !=((inject p.sih urb)))
|
||||
==
|
||||
~| q.q.cay
|
||||
=+ ((hard ,[mit=mite rez=octs]) q.q.cay)
|
||||
@ -809,7 +808,7 @@
|
||||
|= [sas=@ud dep=@uvH mez=tang]
|
||||
^+ +>
|
||||
:: (back ha/~ dep %tang !>(mez)) ::tang->urb chain may be source of failure
|
||||
(give-html sas ~ (add-poll dep (render-tang mez)))
|
||||
(give-html sas ~ (inject dep (render-tang mez)))
|
||||
::
|
||||
++ give-html
|
||||
|= [sas=@ud cug=(list ,@t) max=manx]
|
||||
|
@ -6,7 +6,6 @@
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
::
|
||||
++ gift gift-ford :: out result <-$
|
||||
++ heel path :: functional ending
|
||||
++ kiss kiss-ford :: in request ->$
|
||||
@ -57,7 +56,7 @@
|
||||
++ calx :: concrete cache line
|
||||
$% [%hood p=calm q=(pair beam cage) r=hood] :: compile
|
||||
[%bake p=calm q=(trel mark beam heel) r=(unit vase)]:: load
|
||||
[%lilt p=calm q=arch r=(jug mark mark)] :: translation graph
|
||||
[%lilt p=calm q=beak r=(jug mark mark)] :: translation graph
|
||||
[%slit p=calm q=[p=type q=type] r=type] :: slam type
|
||||
[%slim p=calm q=[p=type q=twig] r=(pair type nock)]:: mint
|
||||
[%slap p=calm q=[p=vase q=twig] r=vase] :: compute
|
||||
@ -221,6 +220,7 @@
|
||||
?- -.+.sih
|
||||
%writ
|
||||
?~ p.sih +>.$
|
||||
:: ~& writ/tea
|
||||
=+ [dap=(~(got by deh.bay) dep) bem=`beam`[bek sup]]
|
||||
=- ?~(dop con con(deh.bay (~(put by deh.bay) dep dop)))
|
||||
^- [dop=$|(~ _dap) con=_+>.$]
|
||||
@ -335,6 +335,11 @@
|
||||
%2 nuf
|
||||
%1 nuf
|
||||
%0
|
||||
:: ~& :- %clef-new
|
||||
:: ?+ sem `@tas`sem
|
||||
:: %hood [%hood (tope &1.q.q.hoc)]
|
||||
:: %bake [%bake `mark`&1.q.q.hoc (tope &2.q.q.hoc)]
|
||||
:: ==
|
||||
:- p=(came p.nuf `calx`[sem `calm`[now p.q.nuf] q.q.hoc q.q.nuf])
|
||||
q=q.nuf
|
||||
==
|
||||
@ -539,7 +544,7 @@
|
||||
%+ (clef %hood) (fine cof bem(r [%ud 0]) cay)
|
||||
^- (burg (pair beam cage) hood)
|
||||
|= [cof=cafe bum=beam cay=cage]
|
||||
:: ~& fade/clef-miss/bem
|
||||
:: ~& fade/clef-miss/bem
|
||||
=+ rul=(fair bum)
|
||||
?. ?=(@ q.q.cay)
|
||||
(flaw cof ~)
|
||||
@ -551,7 +556,7 @@
|
||||
++ fang :: protocol door
|
||||
|= [cof=cafe for=mark]
|
||||
^- (bolt vase)
|
||||
%+ cope (make cof [%core bek /[for]/mar])
|
||||
%+ cope (make cof [%core (norm ska bek /[for]/mar)])
|
||||
;~(cope furl feel)
|
||||
::
|
||||
++ fair :: hood parsing rule
|
||||
@ -835,7 +840,9 @@
|
||||
|= [cof=cafe arc=arch]
|
||||
?^ q.arc
|
||||
%+ (flux some) cof
|
||||
|=([cof=cafe arg=heel] (cope (liar cof bem) (lake for)))
|
||||
|= [cof=cafe arg=heel] ^- (bolt vase)
|
||||
%+ cool |.(leaf/"ford: load {<for>} {<(tope bem)>}")
|
||||
(cope (liar cof bem) (lake for))
|
||||
?. (~(has by r.arc) %hook)
|
||||
(flue cof)
|
||||
%+ cope (lend cof bem(s [%hook s.bem]))
|
||||
@ -843,7 +850,8 @@
|
||||
?~ q.arc
|
||||
(flue cof)
|
||||
%+ (flux some) cof
|
||||
|= [cof=cafe arg=heel]
|
||||
|= [cof=cafe arg=heel] ^- (bolt vase)
|
||||
%+ cool |.(leaf/"ford: hook {<for>} {<(tope bem)>}")
|
||||
%+ cope (fade cof %hook bem)
|
||||
|= [cof=cafe hyd=hood]
|
||||
(cope (abut:(meow bem arg) cof hyd) (lake for))
|
||||
@ -917,7 +925,7 @@
|
||||
=+ von=(save ~ %cy bem)
|
||||
?~ von [p=cof q=[%1 [%y bem ~] ~ ~]]
|
||||
%+ flag (norm ska bem)
|
||||
(fine cof ((hard arch) q.q:(need u.von)))
|
||||
(fine cof ?>(?=([~ %arch ^] u.von) ((hard arch) q.q.u.u.von)))
|
||||
::
|
||||
++ liar :: load vase
|
||||
|= [cof=cafe bem=beam]
|
||||
@ -937,13 +945,14 @@
|
||||
::
|
||||
++ lilt
|
||||
|= cof=cafe ^- (bolt (jug mark mark))
|
||||
%+ (clef %lilt) (fine cof bek)
|
||||
^- (burg beak (jug mark mark))
|
||||
|= [cof=cafe bek=beak]
|
||||
=. ^bek bek
|
||||
%+ cope (lend cof [bek /mar])
|
||||
|= [cof=cafe arc=arch]
|
||||
%+ (clef %lilt) (fine cof arc)
|
||||
|= [cof=cafe arc=arch]
|
||||
:: =- =+((cope - |=([cafe lil=(jug mark mark)] ~&(lil=lil (flue cof)))) +<)
|
||||
=+ all=(~(tap by r.arc))
|
||||
~! all
|
||||
=+ all=(~(tap by r.arc))
|
||||
|- ^- (bolt (jug mark mark))
|
||||
?~ all (flue cof)
|
||||
%+ cope $(cof cof, all t.all)
|
||||
@ -999,7 +1008,6 @@
|
||||
%+ cope ((~(got by mal) i.wuy) cof arg)
|
||||
|= [cof=cafe hoc=vase]
|
||||
(cope (lope cof i.wuy t.wuy hoc) (flux some))
|
||||
::
|
||||
++ lime :: load beam
|
||||
|= [cof=cafe for=mark bem=beam arg=heel]
|
||||
=+ [mob=bem mer=(flop arg)]
|
||||
@ -1069,7 +1077,7 @@
|
||||
++ mail :: cached mint
|
||||
|= [cof=cafe sut=type gen=twig]
|
||||
^- (bolt (pair type nock))
|
||||
%+ (clef %slim) (fine cof sut gen)
|
||||
%+ (clef %slim) (fine cof sut gen)
|
||||
|= [cof=cafe sut=type gen=twig]
|
||||
=+ puz=(mule |.((~(mint ut sut) [%noun gen])))
|
||||
?- -.puz
|
||||
@ -1088,7 +1096,6 @@
|
||||
++ make :: reduce silk
|
||||
|= [cof=cafe kas=silk]
|
||||
^- (bolt gage)
|
||||
:: ~& [%make (,@tas -.kas)]
|
||||
?- -.kas
|
||||
^
|
||||
%. [cof p.kas q.kas]
|
||||
@ -1113,7 +1120,7 @@
|
||||
::
|
||||
%boil
|
||||
^- (bolt gage)
|
||||
:: %+ cool |.(leaf/"ford: boil {<p.kas>} {<(tope q.kas)>} {<r.kas>}")
|
||||
%+ cool |.(leaf/"ford: boil {<p.kas>} {<(tope q.kas)>} {<r.kas>}")
|
||||
%+ cope (lamp cof q.kas)
|
||||
|= [cof=cafe bem=beam]
|
||||
%+ cope (lime cof p.kas bem r.kas)
|
||||
@ -1673,8 +1680,9 @@
|
||||
~
|
||||
::
|
||||
++ load :: highly forgiving
|
||||
:: |= old=axle
|
||||
:: ..^$(+>- old)
|
||||
|= old=axle
|
||||
=. pol.old (~(run by pol.old) |=(baby +<(jav ~)))
|
||||
..^$(+>- old)
|
||||
::=. old
|
||||
:: ?. ?=([%0 *] old) old :: remove at 1
|
||||
:: :- %1
|
||||
@ -1683,13 +1691,13 @@
|
||||
:: ?> ?=([n=[p=* q=[tad=* dym=* deh=* jav=*]] l=* r=*] +.old)
|
||||
:: :- [p.n.+.old [tad.q.n.+.old dym.q.n.+.old deh.q.n.+.old ~]]
|
||||
:: [$(+.old l.+.old) $(+.old r.+.old)]
|
||||
|= old=*
|
||||
=+ lox=((soft axle) old)
|
||||
^+ ..^$
|
||||
?~ lox
|
||||
~& %ford-reset
|
||||
..^$
|
||||
..^$(+>- u.lox)
|
||||
::|= old=*
|
||||
::=+ lox=((soft axle) old)
|
||||
::^+ ..^$
|
||||
::?~ lox
|
||||
:: ~& %ford-reset
|
||||
:: ..^$
|
||||
::..^$(+>- u.lox)
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
|
||||
|
@ -4157,7 +4157,7 @@
|
||||
|* [hel=(list) hev=(list)]
|
||||
|- ^+ hev
|
||||
=+ ^= sev
|
||||
=+ [inx=0 sev=*(map ,@t (list ,@ud))]
|
||||
=+ [inx=0 sev=*(map ,_i.-.hev (list ,@ud))]
|
||||
|- ^+ sev
|
||||
?~ hev sev
|
||||
=+ guy=(~(get by sev) i.hev)
|
||||
@ -6445,7 +6445,7 @@
|
||||
:- %mean
|
||||
=+ fek=~(feck ap p.gen)
|
||||
?^ fek [%dtzz %tas u.fek]
|
||||
[%brdt [%cnhp [%cnzy %cain] [%zpgr p.gen] ~]]
|
||||
[%brdt [%cnhp [%cnzy %cain] [%zpgr [%tsgr [~ 3] p.gen]] ~]]
|
||||
q.gen
|
||||
::
|
||||
[%sgcb *] [%sggr [%mean [%brdt p.gen]] q.gen]
|
||||
|
@ -102,9 +102,7 @@
|
||||
::
|
||||
++ do-info
|
||||
|= [mez=tape pax=path tor=toro]
|
||||
=+ syd=q:(need (tome pax))
|
||||
=- abet:abet:(spam:(work syd) leaf/mez ~)
|
||||
(emit %info /kiln our tor)
|
||||
abet:(emit:(spam leaf/mez ~) %info /kiln our tor)
|
||||
::
|
||||
++ poke-rm |=(a=path (do-info "removed" a (fray a)))
|
||||
++ poke-cp
|
||||
|
@ -1,43 +0,0 @@
|
||||
~% %util +> ~
|
||||
|%
|
||||
++ kids (list inline)
|
||||
++ inline
|
||||
=+ ^= inlik
|
||||
$% [%emph p=?] :: strong?
|
||||
[%delt ~] :: strikethrough
|
||||
[%link p=tape q=(unit tape)]
|
||||
[%blot p=tape q=(unit tape)] :: image
|
||||
==
|
||||
=+ ^= inlin
|
||||
$% [%$ p=tape]
|
||||
[%line ~]
|
||||
[%code p=tape]
|
||||
[%html p=cord]
|
||||
==
|
||||
$&([p=inlik q=kids] inlin)
|
||||
::
|
||||
::
|
||||
++ elem $&(tops node)
|
||||
++ tops :: childful block
|
||||
$: $= p
|
||||
$% [%bloq ~]
|
||||
[%list p=? q=$|(char [p=@u q=char])] :: tight, ordered?
|
||||
[%item ~]
|
||||
==
|
||||
q=(list elem)
|
||||
==
|
||||
:: ++ mist |*(a=_,* ,[i=a t=$|(~ (mist a))]) :: .=(%mist +(%list))
|
||||
++ node :: childless block
|
||||
$% [%para p=kids]
|
||||
[%hrul ~]
|
||||
[%head p=@u q=kids]
|
||||
[%code p=(unit ,[p=char q=@u r=tape]) q=wain] :: info, contents
|
||||
[%html p=wain]
|
||||
[%defn ~] :: empty para
|
||||
==
|
||||
::
|
||||
++ sqar
|
||||
~/ %sqar
|
||||
|= @t
|
||||
*(list elem)
|
||||
--
|
@ -4,10 +4,10 @@
|
||||
|_ mud=@t
|
||||
++ grow :: convert to
|
||||
|% ++ mime [/text/css (taco mud)] :: convert to %mime
|
||||
++ psal ;style :: convert to %hymn
|
||||
++ elem ;style :: convert to %hymn
|
||||
;- (trip mud)
|
||||
==
|
||||
++ hymn ;html:(head:"{psal}" body)
|
||||
++ hymn ;html:(head:"{elem}" body)
|
||||
--
|
||||
++ grab
|
||||
|% :: convert from
|
||||
|
@ -14,11 +14,10 @@
|
||||
|%
|
||||
++ md :: convert from %md
|
||||
=< |=(src=@t (mark src))
|
||||
~% %utyl ..is ~
|
||||
::~% %utyl +>+>+>+> ~
|
||||
~% %down ..is ~
|
||||
|%
|
||||
++ mark
|
||||
~/ %dawn
|
||||
~/ %mark
|
||||
|= p=@t
|
||||
(normalize (rash p parse))
|
||||
--
|
||||
@ -34,10 +33,10 @@
|
||||
;* (sing don)
|
||||
==
|
||||
==
|
||||
++ psal :: convert to %psal
|
||||
++ elem :: convert to %elem
|
||||
;div
|
||||
;* (sing don)
|
||||
==
|
||||
:: ++ react psal
|
||||
:: ++ react elem
|
||||
--
|
||||
--
|
||||
|
@ -1,5 +1,5 @@
|
||||
::
|
||||
:::: /hoon/core/psal/mar
|
||||
:::: /hoon/core/elem/mar
|
||||
::
|
||||
/? 314
|
||||
|_ own=manx
|
@ -8,7 +8,7 @@
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ mime [/text/hoon (taco own)] :: convert to %mime
|
||||
++ psal :: convert to %html
|
||||
++ elem :: convert to %html
|
||||
;div:pre(urb_codemirror ""):"{(trip own)}"
|
||||
:: =+ gen-id="src-{<`@ui`(mug own)>}"
|
||||
:: ;div
|
||||
@ -21,7 +21,7 @@
|
||||
:: """
|
||||
:: ==
|
||||
++ hymn
|
||||
:: ;html:(head:title:"Source" "+{psal}")
|
||||
:: ;html:(head:title:"Source" "+{elem}")
|
||||
;html
|
||||
;head
|
||||
;title:"Source"
|
||||
|
@ -8,9 +8,20 @@
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ mime `^mime`[/text/hoon (taco own)] :: convert to %mime
|
||||
++ psal ;div:pre(urb_codemirror ""):"{(trip own)}" :: convert to %html
|
||||
++ elem :: convert to %html
|
||||
;div:pre(urb_codemirror ""):"{(trip own)}"
|
||||
:: =+ gen-id="src-{<`@ui`(mug own)>}"
|
||||
:: ;div
|
||||
:: ;textarea(id "{gen-id}"):"{(trip own)}"
|
||||
:: ;script:"""
|
||||
:: CodeMirror.fromTextArea(
|
||||
:: window[{<gen-id>}],
|
||||
:: \{lineNumbers:true, readOnly:true}
|
||||
:: )
|
||||
:: """
|
||||
:: ==
|
||||
++ hymn
|
||||
:: ;html:(head:title:"Source" "+{psal}")
|
||||
:: ;html:(head:title:"Source" "+{elem}")
|
||||
;html
|
||||
;head
|
||||
;title:"Source"
|
||||
|
@ -6,10 +6,10 @@
|
||||
++ grow
|
||||
|%
|
||||
++ mime [/application/javascript (taco (,@t mud))]
|
||||
++ psal ;script
|
||||
++ elem ;script
|
||||
;- (trip (,@t mud))
|
||||
==
|
||||
++ hymn ;html:(head:"+{psal}" body)
|
||||
++ hymn ;html:(head:"+{elem}" body)
|
||||
--
|
||||
++ grab
|
||||
|% :: convert from
|
||||
|
@ -17,5 +17,5 @@
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
++ noun manx :: clam from %noun
|
||||
++ psal |= a=manx a
|
||||
++ elem |= a=manx a
|
||||
-- --
|
||||
|
@ -1,5 +1,5 @@
|
||||
::
|
||||
:::: /hoon/core/psal/mar
|
||||
:::: /hoon/core/elem/mar
|
||||
::
|
||||
/? 314
|
||||
!:
|
||||
@ -53,8 +53,8 @@
|
||||
++ mime
|
||||
=< mime
|
||||
|%
|
||||
++ psal own
|
||||
++ hymn ;html:(head:title:"snip" body:"+{psal}") :: convert to %hymn
|
||||
++ elem own
|
||||
++ hymn ;html:(head:title:"snip" body:"+{elem}") :: convert to %hymn
|
||||
++ html (crip (poxo hymn)) :: convert to %html
|
||||
++ mime [/text/html (taco html)] :: convert to %mime
|
||||
--
|
||||
@ -62,7 +62,7 @@
|
||||
++ garb [%react-snip ~]
|
||||
++ grab |% :: convert from
|
||||
++ noun manx :: clam from %noun
|
||||
++ psal
|
||||
++ elem
|
||||
|= a=manx
|
||||
=+ (hedtal +.a)
|
||||
;div:(h1:"*{hed}" div:"*{tal}")
|
||||
|
@ -1,5 +1,5 @@
|
||||
::
|
||||
:::: /hoon/core/psal/mar
|
||||
:::: /hoon/core/elem/mar
|
||||
::
|
||||
/? 314
|
||||
!:
|
||||
@ -7,7 +7,7 @@
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ psal
|
||||
++ elem
|
||||
=- ;pre:code:"{(trip (role (turn - crip)))}" :: XX
|
||||
^- wall %- zing ^- (list wall)
|
||||
(turn tan |=(a=tank (wash 0^160 a)))
|
||||
|
@ -15,7 +15,7 @@
|
||||
=> v=.
|
||||
|%
|
||||
++ mime => v [/text/plain (taco (role txt))]
|
||||
++ psal => v ;div: {(trip (role txt))}
|
||||
++ elem => v ;div: {(trip (role txt))}
|
||||
--
|
||||
++ grad
|
||||
|%
|
||||
|
@ -1,46 +0,0 @@
|
||||
/+ sqar
|
||||
// /=try=/daun
|
||||
!:
|
||||
=-
|
||||
;html
|
||||
;head
|
||||
;title: skuaring
|
||||
==
|
||||
;body
|
||||
;p: 15 skwared is *{(sing (sqar -))}
|
||||
==
|
||||
==
|
||||
'''
|
||||
## Why is a spec needed?
|
||||
|
||||
John Gruber's [canonical description of Markdown's
|
||||
syntax](http://daringfireball.net/projects/markdown/syntax)
|
||||
does not specify the syntax unambiguously. Here are some examples of
|
||||
questions it does not answer:
|
||||
|
||||
1. How much indentation is needed for a sublist? The spec says that
|
||||
continuation paragraphs need to be indented four spaces, but is
|
||||
not fully <emph>explicit</emph> about sublists. It is natural to think that
|
||||
they, too, must be indented four spaces, but `Markdown.pl` does
|
||||
not require that. This is hardly a "corner case," and divergences
|
||||
between implementations on this issue often lead to surprises for
|
||||
users in real documents. (See [this comment by John
|
||||
Gruber](http://article.gmane.org/gmane.text.markdown.general/1997).)
|
||||
|
||||
2. Is a blank line needed before a block quote or header?
|
||||
Most implementations do not require the blank line. However,
|
||||
this can lead to unexpected results in hard-wrapped text, and
|
||||
also to ambiguities in parsing (note that some implementations
|
||||
put the header inside the blockquote, while others do not).
|
||||
(John Gruber has also spoken [in favor of requiring the blank
|
||||
lines](http://article.gmane.org/gmane.text.markdown.general/2146).)
|
||||
|
||||
3. Is a blank line needed before an indented code block?
|
||||
(`Markdown.pl` requires it, but this is not mentioned in the
|
||||
documentation, and some implementations do not require it.)
|
||||
|
||||
``` markdown
|
||||
paragraph
|
||||
code?
|
||||
```
|
||||
'''
|
Loading…
Reference in New Issue
Block a user