refactor into deskjam and deskpack-0 marks

This commit is contained in:
niblyx 2023-03-17 12:56:31 -04:00
parent ba24b4bbf7
commit 96d1d6e21e
11 changed files with 65 additions and 60 deletions

View File

@ -2,8 +2,12 @@
/+ webui, rudder, server, dbug, verb, default-agent,
j=jam-desk
:: import to force compilation during development
/= j- /mar/jam-desk-0
/$ jam-to-mime %jam %mime
/= dj- /mar/deskjam
/= dp- /mar/deskpack-0
/= jt- /ted/jam-desk-url
::
/$ deskpack-0-to-mime %deskpack-0 %mime
/$ deskjam-to-deskpack-0 %deskjam %deskpack-0
::
|%
+$ state-0 [%0 data]
@ -137,7 +141,7 @@
=/ =jam !<(jam result)
:_ this
:~ :* %pass / %agent [our dap]:bowl %poke
%jam-desk-action !>(stage-mapp+(cue-and-clam:jc jam))
%jam-desk-action !>([%stage-mapp (deskjam-to-deskpack-0 jam)])
== ==
==
::
@ -147,15 +151,8 @@
|_ =bowl:gall
++ sour (scot %p our.bowl)
++ snow (scot %da now.bowl)
++ jam-mark %jam-desk-0
++ desks .^((set desk) %cd /[sour]/base/[snow])
::
:: ++ jam-to-mime
:: |= =beak
:: .^ $-(@ mime) %cf
:: (weld (en-beam beak(q %base) ~) /jam/mime)
:: ==
::
++ new-desk-card
|= [=desk =mapp]
^- card
@ -200,18 +197,6 @@
::
++ en-mapp
|= [=desk files=(list path)]
:: ^- mapp
:: |^
:: (~(gas by *mapp) (turn files mage))
:: ++ mage
:: |= file=path
:: ^- (pair path page:clay)
:: :- file
:: ^- page:clay
:: :- (rear file)
:: ~| [%missing-source-file beak file]
:: .^(* %cx (weld (en-beam beak ~) file))
:: --
^- mapp
=+ .^(=dome:clay %cv /[sour]/[desk]/[snow])
=/ commit=@ud ud:.^(cass:clay %cw /[sour]/[desk]/[snow])
@ -239,9 +224,8 @@
++ desk-to-mime
|= =desk
^- mime
%- jam-to-mime
%- jam ^- (cask)
[jam-mark desk (en-mapp-full desk)]
%- deskpack-0-to-mime
[desk (en-mapp-full desk)]
::
++ file-args
|= args=(list [k=@t v=@t])
@ -254,9 +238,8 @@
++ subdesk-to-mime
|= [=desk files=(list path)]
^- mime
%- jam-to-mime
%- jam ^- (cask)
[jam-mark desk (en-mapp-part desk files)]
%- deskpack-0-to-mime
[desk (en-mapp-part desk files)]
::
++ simple-desk-jam
|= [=eyre-id =desk]

View File

@ -1,18 +1,9 @@
/- *jam-desk
/+ multipart
|_ [our=ship now=time]
++ en-beak |=(dap=term /(scot %p our)/[dap]/(scot %da now))
++ jam-to-mime .^($-(@ mime) %cf (welp (en-beak %base) /jam/mime))
++ desks .^((set desk) %cd (en-beak %base))
::
++ cue-and-clam
|= =jam
^- [desk mapp]
=/ =(cask) ((cask) (cue jam))
?+ p.cask !!
%jam-desk-0
(,[desk mapp] q.cask)
==
++ sour (scot %p our)
++ snow (scot %da now)
++ desks .^((set desk) %cd /[sour]/base/[snow])
:: list to unit
::
++ lint
@ -32,7 +23,7 @@
?. =(key n) ~
[~ `mold`body:p]
::
++ desk-files |=(=desk .^((list path) %ct (en-beak desk)))
++ desk-files |=(=desk .^((list path) %ct /[sour]/[desk]/[snow]))
::
++ desk-axal
|= =desk

View File

@ -1,5 +1,6 @@
/- *jam-desk
/+ rudder, multipart, w=webui-pages, h=jam-desk
/$ deskjam-to-deskpack-0 %deskjam %deskpack-0
|%
++ path-to-term
|= =path
@ -31,7 +32,7 @@
=/ args=(map @t @t)
?~(body ~ (frisk:rudder q.u.body))
?~ url=(~(get by args) 'url') ~
url-thread+u.url
[%url-thread u.url]
=/ jam=(unit jam)
%- lint:hc
^- (list jam)
@ -42,7 +43,7 @@
%file [~ `jam`body:p]
==
?~ jam ~
stage-mapp+(cue-and-clam:hc u.jam)
[%stage-mapp (deskjam-to-deskpack-0 u.jam)]
::
++ final
%+ alert:rudder

View File

@ -39,7 +39,7 @@
;td
;a/"/apps/jam-desk/download/{(trip desk)}"
=id "download"
=download "{(trip desk)}.jam"
=download "{(trip desk)}.deskjam"
=title "download this file"
; ⬇️
==

View File

@ -35,7 +35,7 @@
;input
=type "file"
=name "file"
=accept ".jam";
=accept ".deskjam";
==
;td
;button

View File

@ -28,7 +28,7 @@
Select files and folders to jam.
==
;td
;button(type "submit", download "{(trip desk)}.jam"): download
;button(type "submit", download "{(trip desk)}.deskjam"): download
==
==
;* folder-hierarchy

16
desk/mar/deskjam.hoon Normal file
View File

@ -0,0 +1,16 @@
=, mimes:html
|_ mud=@
++ grow
|%
++ noun mud
++ jam mud
++ mime [/application/octet-stream (as-octs mud)]
--
++ grab
|%
++ noun @
++ jam @
++ mime |=(mim=^mime q.q.mim)
--
++ grad %mime
--

25
desk/mar/deskpack-0.hoon Normal file
View File

@ -0,0 +1,25 @@
/- *jam-desk
=, mimes:html
|_ dp=deskpack
++ grow
|%
++ noun dp
++ deskjam jam
++ jam (^jam [%deskpack-0 dp])
++ mime :- /application/octet-stream
(as-octs:mimes:html jam)
--
++ grab
|%
++ noun deskpack
++ deskjam jam
++ jam
|= mud=@
=/ =(cask) ;;((cask) (cue mud))
?+ p.cask ~|([%unknown-deskjam-mark mark=p.cask] !!)
%deskpack-0 ;;(deskpack q.cask)
==
++ mime |=(mim=^mime (jam q.q.mim))
--
++ grad %noun
--

View File

@ -1,12 +0,0 @@
/- *jam-desk
|_ [=desk =mapp]
++ grow
|%
++ noun [desk mapp]
--
++ grab
|%
++ noun ,[^desk ^mapp]
--
++ grad %noun
--

View File

@ -10,8 +10,8 @@
++ mime [/application/octet-stream (as-octs mud)]
--
++ grab
|% :: convert from
++ noun @ :: clam from %noun
|%
++ noun @
--
++ grad %mime
--

View File

@ -1,6 +1,7 @@
|%
+$ data [=staged dest=(unit [mode=?(%n %m) =desk])]
+$ mapp (map path page:clay)
+$ deskpack [desk mapp]
+$ staged
%- unit
$: =stage=time