Merge git://factorcode.org/git/factor
commit
f06aeece1f
|
@ -120,10 +120,6 @@ HELP: vocab-tests-path
|
|||
{ $values { "vocab" "a vocabulary specifier" } { "path/f" "a pathname string or " { $link f } } }
|
||||
{ $description "Outputs a pathname where the unit tests for " { $snippet "vocab" } " might be found. Outputs " { $link f } " if the vocabulary does not have a directory on disk." } ;
|
||||
|
||||
HELP: (refresh)
|
||||
{ $values { "prefix" string } { "seq" "a sequence of strings" } }
|
||||
{ $description "Reloads source files and documentation belonging to loaded vocabularies whose names are prefixed by " { $snippet "prefix" } " which have been modified on disk. Also outputs a sequence of reloaded vocabularies." } ;
|
||||
|
||||
HELP: refresh
|
||||
{ $values { "prefix" string } }
|
||||
{ $description "Reloads source files and documentation belonging to loaded vocabularies whose names are prefixed by " { $snippet "prefix" } " which have been modified on disk." } ;
|
||||
|
@ -131,7 +127,7 @@ HELP: refresh
|
|||
HELP: refresh-all
|
||||
{ $description "Reloads source files and documentation for all loaded vocabularies which have been modified on disk." } ;
|
||||
|
||||
{ refresh (refresh) refresh-all } related-words
|
||||
{ refresh refresh-all } related-words
|
||||
|
||||
HELP: vocab-file-contents
|
||||
{ $values { "vocab" "a vocabulary specifier" } { "name" string } { "seq" "a sequence of lines, or " { $link f } } }
|
||||
|
|
|
@ -119,9 +119,10 @@ SYMBOL: load-help?
|
|||
"To define one, refer to \\ MAIN: help" print
|
||||
] ?if ;
|
||||
|
||||
: modified ( assoc -- seq )
|
||||
[ nip dup [ source-modified? ] when ] assoc-subset
|
||||
keys ;
|
||||
: modified ( seq quot -- seq )
|
||||
[ dup ] swap compose { } map>assoc
|
||||
[ nip ] assoc-subset
|
||||
[ nip source-modified? ] assoc-subset keys ; inline
|
||||
|
||||
: vocab-path+ ( vocab path -- newpath )
|
||||
swap vocab-root dup [ swap path+ ] [ 2drop f ] if ;
|
||||
|
@ -136,19 +137,26 @@ SYMBOL: load-help?
|
|||
dup vocab-docs vocab-path+ ;
|
||||
|
||||
: modified-sources ( vocabs -- seq )
|
||||
[ dup vocab-source-path ] { } map>assoc modified ;
|
||||
[ vocab-source-path ] modified ;
|
||||
|
||||
: modified-docs ( vocabs -- seq )
|
||||
[ dup vocab-docs-path ] { } map>assoc modified ;
|
||||
[ vocab-docs-path ] modified ;
|
||||
|
||||
: (refresh) ( prefix -- seq )
|
||||
: update-roots ( vocabs -- )
|
||||
[ dup find-vocab-root swap vocab set-vocab-root ] each ;
|
||||
|
||||
: to-refresh ( prefix -- seq )
|
||||
child-vocabs
|
||||
dup modified-sources swap modified-docs 2dup
|
||||
dup update-roots
|
||||
dup modified-sources swap modified-docs ;
|
||||
|
||||
: do-refresh ( modified-sources modified-docs -- )
|
||||
2dup
|
||||
[ f swap set-vocab-docs-loaded? ] each
|
||||
[ f swap set-vocab-source-loaded? ] each
|
||||
append prune dup [ [ require ] each ] no-parse-hook ;
|
||||
append prune [ [ require ] each ] no-parse-hook ;
|
||||
|
||||
: refresh ( prefix -- ) (refresh) drop ;
|
||||
: refresh ( prefix -- ) to-refresh do-refresh ;
|
||||
|
||||
: refresh-all ( -- ) "" refresh ;
|
||||
|
||||
|
|
|
@ -76,4 +76,5 @@ TUPLE: expected-error ;
|
|||
|
||||
: test-all ( -- ) "" test ;
|
||||
|
||||
: test-changes ( -- ) "" (refresh) run-vocab-tests ;
|
||||
: test-changes ( -- )
|
||||
"" to-refresh dupd do-refresh run-vocab-tests ;
|
||||
|
|
Loading…
Reference in New Issue