diff --git a/core/vocabs/loader/loader-docs.factor b/core/vocabs/loader/loader-docs.factor index 160177cdf6..d4ef697a15 100644 --- a/core/vocabs/loader/loader-docs.factor +++ b/core/vocabs/loader/loader-docs.factor @@ -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 } } } diff --git a/core/vocabs/loader/loader.factor b/core/vocabs/loader/loader.factor index 48ff041b6c..e9dc4f3e55 100644 --- a/core/vocabs/loader/loader.factor +++ b/core/vocabs/loader/loader.factor @@ -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 ; diff --git a/core/bootstrap/help/authors.txt b/extra/bootstrap/help/authors.txt similarity index 100% rename from core/bootstrap/help/authors.txt rename to extra/bootstrap/help/authors.txt diff --git a/core/bootstrap/help/help.factor b/extra/bootstrap/help/help.factor similarity index 100% rename from core/bootstrap/help/help.factor rename to extra/bootstrap/help/help.factor diff --git a/core/bootstrap/help/summary.txt b/extra/bootstrap/help/summary.txt similarity index 100% rename from core/bootstrap/help/summary.txt rename to extra/bootstrap/help/summary.txt diff --git a/core/bootstrap/io/authors.txt b/extra/bootstrap/io/authors.txt similarity index 100% rename from core/bootstrap/io/authors.txt rename to extra/bootstrap/io/authors.txt diff --git a/core/bootstrap/io/io.factor b/extra/bootstrap/io/io.factor similarity index 100% rename from core/bootstrap/io/io.factor rename to extra/bootstrap/io/io.factor diff --git a/core/bootstrap/io/summary.txt b/extra/bootstrap/io/summary.txt similarity index 100% rename from core/bootstrap/io/summary.txt rename to extra/bootstrap/io/summary.txt diff --git a/core/bootstrap/math/math.factor b/extra/bootstrap/math/math.factor similarity index 100% rename from core/bootstrap/math/math.factor rename to extra/bootstrap/math/math.factor diff --git a/core/bootstrap/math/summary.txt b/extra/bootstrap/math/summary.txt similarity index 100% rename from core/bootstrap/math/summary.txt rename to extra/bootstrap/math/summary.txt diff --git a/core/bootstrap/tools/authors.txt b/extra/bootstrap/tools/authors.txt similarity index 100% rename from core/bootstrap/tools/authors.txt rename to extra/bootstrap/tools/authors.txt diff --git a/core/bootstrap/tools/summary.txt b/extra/bootstrap/tools/summary.txt similarity index 100% rename from core/bootstrap/tools/summary.txt rename to extra/bootstrap/tools/summary.txt diff --git a/core/bootstrap/tools/tools.factor b/extra/bootstrap/tools/tools.factor similarity index 100% rename from core/bootstrap/tools/tools.factor rename to extra/bootstrap/tools/tools.factor diff --git a/core/bootstrap/ui/authors.txt b/extra/bootstrap/ui/authors.txt similarity index 100% rename from core/bootstrap/ui/authors.txt rename to extra/bootstrap/ui/authors.txt diff --git a/core/bootstrap/ui/summary.txt b/extra/bootstrap/ui/summary.txt similarity index 100% rename from core/bootstrap/ui/summary.txt rename to extra/bootstrap/ui/summary.txt diff --git a/core/bootstrap/ui/tools/authors.txt b/extra/bootstrap/ui/tools/authors.txt similarity index 100% rename from core/bootstrap/ui/tools/authors.txt rename to extra/bootstrap/ui/tools/authors.txt diff --git a/core/bootstrap/ui/tools/summary.txt b/extra/bootstrap/ui/tools/summary.txt similarity index 100% rename from core/bootstrap/ui/tools/summary.txt rename to extra/bootstrap/ui/tools/summary.txt diff --git a/core/bootstrap/ui/tools/tools.factor b/extra/bootstrap/ui/tools/tools.factor similarity index 100% rename from core/bootstrap/ui/tools/tools.factor rename to extra/bootstrap/ui/tools/tools.factor diff --git a/core/bootstrap/ui/ui.factor b/extra/bootstrap/ui/ui.factor similarity index 100% rename from core/bootstrap/ui/ui.factor rename to extra/bootstrap/ui/ui.factor diff --git a/extra/tools/test/test.factor b/extra/tools/test/test.factor index bc9dd0ffeb..88f94a7fd6 100644 --- a/extra/tools/test/test.factor +++ b/extra/tools/test/test.factor @@ -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 ;