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