Clean up store stuff
parent
00d19637c1
commit
9e93f6251e
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2006, 2007 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: assocs io io.files kernel namespaces serialize ;
|
||||
USING: assocs io io.files kernel namespaces serialize init ;
|
||||
IN: store
|
||||
|
||||
TUPLE: store path data ;
|
||||
|
@ -30,3 +30,8 @@ C: <store> store
|
|||
] [
|
||||
drop >r 2dup set-global r> set-at
|
||||
] if ;
|
||||
|
||||
: define-store ( path id -- )
|
||||
over >r
|
||||
[ >r resource-path load-store r> set-global ] 2curry
|
||||
r> add-init-hook ;
|
||||
|
|
|
@ -8,6 +8,12 @@ TUPLE: pastebin pastes ;
|
|||
: <pastebin> ( -- pastebin )
|
||||
V{ } clone pastebin construct-boa ;
|
||||
|
||||
! Persistence
|
||||
SYMBOL: store
|
||||
"pastebin.store" store define-store
|
||||
<pastebin> pastebin store get store-variable
|
||||
: save-pastebin-store ( -- ) store get-global save-store ;
|
||||
|
||||
TUPLE: paste
|
||||
summary author channel mode contents date
|
||||
annotations n ;
|
||||
|
@ -19,12 +25,6 @@ TUPLE: annotation summary author mode contents ;
|
|||
|
||||
C: <annotation> annotation
|
||||
|
||||
SYMBOL: store
|
||||
|
||||
"pastebin.store" resource-path load-store store set-global
|
||||
|
||||
<pastebin> \ pastebin store get store-variable
|
||||
|
||||
: get-paste ( n -- paste )
|
||||
pastebin get pastebin-pastes nth ;
|
||||
|
||||
|
@ -71,9 +71,6 @@ SYMBOL: store
|
|||
|
||||
\ feed.xml { } define-action
|
||||
|
||||
: save-pastebin-store ( -- )
|
||||
store get-global save-store ;
|
||||
|
||||
: add-paste ( paste pastebin -- )
|
||||
>r now over set-paste-date r>
|
||||
pastebin-pastes 2dup length swap set-paste-n push ;
|
||||
|
|
Loading…
Reference in New Issue