furnace.utilities: use a method based on where instead of vocab-path to find dir of vocab
parent
9905b52f15
commit
b29aa88f3c
|
@ -0,0 +1,22 @@
|
|||
USING: furnace.utilities io.encodings.utf8 io.files io.files.temp kernel
|
||||
multiline parser tools.test webapps.counter ;
|
||||
IN: furnace.utilities.tests
|
||||
|
||||
<<
|
||||
STRING: dummy-vocab
|
||||
IN: dummy-vocab
|
||||
|
||||
: dummy-word ( -- ) ;
|
||||
;
|
||||
|
||||
dummy-vocab "dummy.factor" temp-file [ utf8 set-file-contents ] keep run-file
|
||||
>>
|
||||
|
||||
{ t } [
|
||||
USE: dummy-vocab
|
||||
{ dummy-word "index" } resolve-template-path "index" temp-file =
|
||||
] unit-test
|
||||
|
||||
{ "resource:extra/webapps/counter/counter" } [
|
||||
{ counter-app "counter" } resolve-template-path
|
||||
] unit-test
|
|
@ -1,9 +1,9 @@
|
|||
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: namespaces make assocs sequences kernel classes splitting
|
||||
USING: definitions namespaces make assocs sequences kernel classes splitting
|
||||
words vocabs.loader accessors strings combinators arrays
|
||||
continuations present fry urls http http.server xml.syntax xml.writer
|
||||
http.server.redirection http.server.remapping ;
|
||||
http.server.redirection http.server.remapping io.pathnames ;
|
||||
IN: furnace.utilities
|
||||
|
||||
: word>string ( word -- string )
|
||||
|
@ -41,13 +41,11 @@ ERROR: no-such-responder responder ;
|
|||
] "" make
|
||||
] when ;
|
||||
|
||||
: vocab-path ( vocab -- path )
|
||||
dup vocab-dir vocab-append-path ;
|
||||
: resolve-word-path ( word -- path/f )
|
||||
where [ first parent-directory but-last ] [ f ] if* ;
|
||||
|
||||
: resolve-template-path ( pair -- path )
|
||||
[
|
||||
first2 [ vocabulary>> vocab-path % ] [ "/" % % ] bi*
|
||||
] "" make ;
|
||||
[ first2 [ resolve-word-path % ] dip "/" % % ] "" make ;
|
||||
|
||||
GENERIC: modify-query ( query responder -- query' )
|
||||
|
||||
|
|
Loading…
Reference in New Issue