: deploy-config ( vocab -- assoc )
dup default-config swap
- dup deploy-config-path vocab-file-contents
+ dup deploy-config-path vocab-file-lines
parse-fresh [ first assoc-union ] unless-empty ;
: set-deploy-config ( assoc vocab -- )
[ [ unparse-use ] without-limits string-lines ] dip
- dup deploy-config-path set-vocab-file-contents ;
+ dup deploy-config-path set-vocab-file-lines ;
: set-deploy-flag ( value key vocab -- )
[ deploy-config [ set-at ] keep ] keep set-deploy-config ;
}
"Getting and setting arbitrary vocabulary metadata:"
{ $subsections
- vocab-file-contents
- set-vocab-file-contents
+ vocab-file-lines
+ set-vocab-file-lines
} ;
ABOUT: "vocabs.metadata"
-HELP: vocab-file-contents
-{ $values { "vocab" "a vocabulary specifier" } { "name" string } { "seq" { $maybe "a sequence of lines" } } }
-{ $description "Outputs the contents of the file named " { $snippet "name" } " from the vocabulary's directory, or " { $link f } " if the file does not exist." } ;
+HELP: vocab-file-lines
+{ $values { "vocab" "a vocabulary specifier" } { "name" string } { "lines" { $maybe { $sequence "lines" } } } }
+{ $description "Outputs the lines of the file named " { $snippet "name" } " from the vocabulary's directory, or " { $link f } " if the file does not exist." } ;
-HELP: set-vocab-file-contents
-{ $values { "seq" "a sequence of lines" } { "vocab" "a vocabulary specifier" } { "name" string } }
+HELP: set-vocab-file-lines
+{ $values { "lines" { $sequence "lines" } } { "vocab" "a vocabulary specifier" } { "name" string } }
{ $description "Stores a sequence of lines to the file named " { $snippet "name" } " from the vocabulary's directory." } ;
HELP: vocab-summary
: check-vocab ( vocab -- vocab )
dup find-vocab-root [ no-vocab ] unless ;
-MEMO: vocab-file-contents ( vocab name -- seq )
+MEMO: vocab-file-lines ( vocab name -- lines/f )
vocab-append-path dup [
dup exists? [
utf8 file-lines harvest
] if
] when ;
-: set-vocab-file-contents ( seq vocab name -- )
+: set-vocab-file-lines ( lines vocab name -- )
dupd vocab-append-path [
swap [ ?delete-file ] [ swap utf8 set-file-lines ] if-empty
- \ vocab-file-contents reset-memoized
+ \ vocab-file-lines reset-memoized
] [ vocab-name no-vocab ] ?if ;
: vocab-resources-path ( vocab -- string )
vocab-dir "resources.txt" append-path ;
: vocab-resources ( vocab -- patterns )
- dup vocab-resources-path vocab-file-contents ;
+ dup vocab-resources-path vocab-file-lines ;
: vocab-summary-path ( vocab -- string )
vocab-dir "summary.txt" append-path ;
: vocab-summary ( vocab -- summary )
- dup dup vocab-summary-path vocab-file-contents
+ dup dup vocab-summary-path vocab-file-lines
[
vocab-name " vocabulary" append
] [
vocab-dir "tags.txt" append-path ;
: vocab-tags ( vocab -- tags )
- dup vocab-tags-path vocab-file-contents ;
+ dup vocab-tags-path vocab-file-lines ;
: vocab-authors-path ( vocab -- string )
vocab-dir "authors.txt" append-path ;
: vocab-authors ( vocab -- authors )
- dup vocab-authors-path vocab-file-contents ;
+ dup vocab-authors-path vocab-file-lines ;
: vocab-platforms-path ( vocab -- string )
vocab-dir "platforms.txt" append-path ;
ERROR: bad-platform name ;
: vocab-platforms ( vocab -- platforms )
- dup vocab-platforms-path vocab-file-contents
+ dup vocab-platforms-path vocab-file-lines
[ dup "system" lookup-word [ ] [ bad-platform ] ?if ] map ;
: supported-platform? ( platforms -- ? )