diff --git a/ape/hood.hoon b/ape/hood.hoon index 38e41042c..3e82851f7 100644 --- a/ape/hood.hoon +++ b/ape/hood.hoon @@ -2,7 +2,7 @@ :::: /hoon/hood/ape :: :: :: :: :: /? 314 :: zuse version -/+ sole, talk, helm, kiln, drum :: libraries +/+ sole, talk, helm, kiln, drum, write :: libraries [. helm kiln drum] :: :: :: :::: :: :: @@ -17,6 +17,7 @@ %drum ?>(?=(%drum -.paw) `drum-part`paw) :: %helm ?>(?=(%helm -.paw) `helm-part`paw) :: %kiln ?>(?=(%kiln -.paw) `kiln-part`paw) :: + %write ?>(?=(%write -.paw) `part:write`paw) :: == :: ++ hood-head ,_-:*hood-part :: ++ hood-make :: @@ -25,11 +26,13 @@ %drum (drum-port our) :: %helm *helm-part :: %kiln *kiln-part :: + %write *part:write :: == :: ++ hood-part :: $% [%drum %0 drum-pith] :: [%helm %0 helm-pith] :: [%kiln %0 kiln-pith] :: + [%write %0 pith:write] :: == :: -- :: :: :: :: @@ -81,8 +84,10 @@ ++ from-drum (from-lib %drum [..$ ,_se-abet]:(drum)) ++ from-helm (from-lib %helm [..$ ,_abet]:(helm)) ++ from-kiln (from-lib %kiln [..$ ,_abet]:(kiln)) +++ from-write (from-lib %write [..$ ,_abet]:(write)) :: ++ init-helm |=([way=wire *] [~ +>]) +++ made-write (wrap made):from-write ++ made-kiln (wrap take-made):from-kiln ++ mere-kiln (wrap take-mere):from-kiln ++ mere-kiln-sync (wrap take-mere-sync):from-kiln @@ -102,6 +107,7 @@ ++ poke-helm-reload (wrap poke-reload):from-helm ++ poke-helm-reload-desk (wrap poke-reload-desk):from-helm ++ poke-helm-reset (wrap poke-reset):from-helm +++ poke-helm-serve (wrap poke-serve):from-helm ++ poke-helm-send-hi (wrap poke-send-hi):from-helm ++ poke-helm-send-ask (wrap poke-send-ask):from-helm ++ poke-helm-verb (wrap poke-verb):from-helm @@ -121,6 +127,7 @@ ++ poke-kiln-overload (wrap poke-overload):from-kiln ++ poke-kiln-unmount (wrap poke-unmount):from-kiln ++ poke-kiln-unsync (wrap poke-unsync):from-kiln +++ poke-write-paste (wrap poke-paste):from-write ++ poke-will (wrap poke-will):from-helm ++ quit-drum-phat (wrap quit-phat):from-drum ++ reap-drum-phat (wrap reap-phat):from-drum diff --git a/ape/write.hoon b/ape/write.hoon deleted file mode 100644 index 0359d6d50..000000000 --- a/ape/write.hoon +++ /dev/null @@ -1,36 +0,0 @@ -:: File writer -:: -:::: /hoon/write/app - :: -|_ [bowl ~] -++ beak-now byk(r [%da now]) -++ poke-json - |= jon=json - =- (poke--data (need (- jon.+))) - => jo - %- ot :~ - pax/(cu deft (su fel:stab)) - dat/(of json/some mime/(pe / (cu taco so)) ~) :: XX mite - == -:: -++ poke-write-paste - |= [typ=?(%hoon %md %txt) txt=@t] - (poke--data [`typ /pub/paste/(scot %da now)] %mime / (taco txt)) -:: -++ poke--data - |= [[ext=(unit ,@t) pax=path] dat=$%([%json json] [%mime mime])] - ?~ ext $(ext [~ -.dat]) - =+ cay=?-(-.dat %json [-.dat !>(+.dat)], %mime [-.dat !>(+.dat)]) - ?: =(u.ext -.dat) (made pax ~ `cay) - [[ost %exec pax our ~ beak-now %cast u.ext `cay]~ +>.$] :: XX defer %nice -:: -++ made - |= [pax=wire @ res=gage] - ?. =(our src) - ~|(foreign-write/[our=our src=src] !!) - ?+ -.res ~|(gage/-.res !!) - %| (mean p.res) - %& =- [[ost %info / our -]~ +>.$] - (foal :(welp (tope beak-now ~) pax /[-.p.res]) p.res) - == --- diff --git a/lib/write.hoon b/lib/write.hoon new file mode 100644 index 000000000..e5da87271 --- /dev/null +++ b/lib/write.hoon @@ -0,0 +1,58 @@ +:: File writer module +:: +:::: /hoon/write/lib + :: +|% +++ part ,[%write %0 pith] :: no state +++ pith ,~ +-- +:: +:::: + :: +|% +++ data $%([%json json] [%mime mime]) +++ card $% [%exec wire @p ~ [beak silk]] + [%info wire @p toro] + == +-- +:: +:::: + :: +|= [bowl part] +=* par +<+ +|_ moz=(list ,[bone card]) +++ abet [(flop moz) `part`par] +++ emit |=(a=card %_(+> moz :_(moz [ost a]))) +++ beak-now byk(r [%da now]) +:: ++ poke-json +:: |= jon=json +:: =- (poke--data (need (- jon.+))) +:: => jo +:: %- ot :~ +:: pax/(cu deft (su fel:stab)) +:: dat/(of json/some mime/(pe / (cu taco so)) ~) :: XX mite +:: == +:: +++ poke-paste + |= [typ=?(%hoon %md %txt) txt=@t] ^+ abet + (poke--data [`typ /web/paste/(scot %da now)] %mime / (taco txt)) +:: +++ poke--data + |= [[ext=(unit ,@t) pax=path] dat=data] ^+ abet + ?~ ext $(ext [~ -.dat]) + =+ cay=?-(-.dat %json [-.dat !>(+.dat)], %mime [-.dat !>(+.dat)]) + ?: =(u.ext -.dat) (made pax ~ `cay) + =< abet + %^ emit %exec write/pax :: XX defer %nice + [our ~ beak-now %cast u.ext `cay] +:: +++ made + |= [pax=wire @ res=gage] ^+ abet + ?. =(our src) + ~|(foreign-write/[our=our src=src] !!) + ?+ -.res ~|(gage/-.res !!) + %| (mean p.res) + %& =- abet:(emit %info write/~ our -) + (foal :(welp (tope beak-now ~) pax /[-.p.res]) p.res) + == +-- diff --git a/pub/paste/elem.hook b/pub/paste/elem.hook index e8f92f8ef..7d02c86d5 100644 --- a/pub/paste/elem.hook +++ b/pub/paste/elem.hook @@ -6,7 +6,7 @@ ;script@"/~/as/own/~/at/home/lib/urb.js"; ;script:''' document.title = 'pastebin - urbit' - urb.appl = 'write' + urb.appl = 'hood' urb.send.mark = 'write-paste' submit = function(){ if($("select :selected").attr('value')===undefined) {