-USING: help.markup help.syntax strings ;
+USING: help.markup help.syntax sequences strings ;
IN: vocabs.metadata
ARTICLE: "vocabs.metadata" "Vocabulary metadata"
{ { $snippet "summary.txt" } " - a one-line description." }
{ { $snippet "tags.txt" } " - a series of lines, with one tag per line. Tags help classify the vocabulary. Consult " { $link "vocab-tags" } " for a list of existing tags you can reuse." }
}
-"Words for reading and writing " { $snippet "summary.txt" } ":"
+"Words for reading " { $snippet "summary.txt" } ":"
{ $subsections
vocab-summary
- set-vocab-summary
}
-"Words for reading and writing " { $snippet "authors.txt" } ":"
+"Words for reading " { $snippet "authors.txt" } ":"
{ $subsections
vocab-authors
- set-vocab-authors
}
-"Words for reading and writing " { $snippet "tags.txt" } ":"
+"Words for reading " { $snippet "tags.txt" } ":"
{ $subsections
vocab-tags
- set-vocab-tags
- add-vocab-tags
}
-"Words for reading and writing " { $snippet "platforms.txt" } ":"
+"Words for reading " { $snippet "platforms.txt" } ":"
{ $subsections
vocab-platforms
- set-vocab-platforms
}
-"Words for reading and writing " { $snippet "resources.txt" } ":"
+"Words for reading " { $snippet "resources.txt" } ":"
{ $subsections
vocab-resources
- set-vocab-resources
}
"Getting and setting arbitrary vocabulary metadata:"
{ $subsections
{ $values { "vocab" "a vocabulary specifier" } { "summary" { $maybe string } } }
{ $description "Outputs a one-line string description of the vocabulary's intended purpose from the " { $snippet "summary.txt" } " file in the vocabulary's directory. Outputs " { $link f } " if the file does not exist." } ;
-HELP: set-vocab-summary
-{ $values { "string" { $maybe string } } { "vocab" "a vocabulary specifier" } }
-{ $description "Stores a one-line string description of the vocabulary to the " { $snippet "summary.txt" } " file in the vocabulary's directory." } ;
-
HELP: vocab-tags
{ $values { "vocab" "a vocabulary specifier" } { "tags" "a sequence of strings" } }
{ $description "Outputs a list of short tags classifying the vocabulary from the " { $snippet "tags.txt" } " file in the vocabulary's directory. Outputs " { $link f } " if the file does not exist." } ;
-HELP: set-vocab-tags
-{ $values { "tags" "a sequence of strings" } { "vocab" "a vocabulary specifier" } }
-{ $description "Stores a list of short tags classifying the vocabulary to the " { $snippet "tags.txt" } " file in the vocabulary's directory." } ;
-
HELP: vocab-platforms
{ $values { "vocab" "a vocabulary specifier" } { "platforms" "a sequence of operating system symbols" } }
{ $description "Outputs a list of operating systems supported by " { $snippet "vocab" } ", as specified by the " { $snippet "platforms.txt" } " file in the vocabulary's directory. Outputs an empty array if the file doesn't exist." }
{ $notes "Operating system symbols are defined in the " { $vocab-link "system" } " vocabulary." } ;
-HELP: set-vocab-platforms
-{ $values { "platforms" "a sequence of operating system symbols" } { "vocab" "a vocabulary specifier" } }
-{ $description "Stores a list of operating systems supported by " { $snippet "vocab" } " to the " { $snippet "platforms.txt" } " file in the vocabulary's directory." }
-{ $notes "Operating system symbols are defined in the " { $vocab-link "system" } " vocabulary." } ;
-
HELP: vocab-resources
{ $values { "vocab" "a vocabulary specifier" } { "patterns" "a sequence of glob patterns" } }
{ $description "Outputs a list of glob patterns matching files that will be deployed with an application that includes " { $snippet "vocab" } ", as specified by the " { $snippet "resources.txt" } " file in the vocabulary's directory. Outputs an empty array if the file doesn't exist." }
{ $notes "The " { $vocab-link "vocabs.metadata.resources" } " vocabulary contains words that will expand the glob patterns and directory names in " { $snippet "patterns" } " and return all the matching files." } ;
-
-HELP: set-vocab-resources
-{ $values { "patterns" "a sequence of glob patterns" } { "vocab" "a vocabulary specifier" } }
-{ $description "Stores a list of glob patterns matching files that will be deployed with an application that includes " { $snippet "vocab" } " to the " { $snippet "resources.txt" } " file in the vocabulary's directory." } ;
: vocab-resources ( vocab -- patterns )
dup vocab-resources-path vocab-file-contents ;
-: set-vocab-resources ( patterns vocab -- )
- dup vocab-resources-path set-vocab-file-contents ;
-
: vocab-summary-path ( vocab -- string )
vocab-dir "summary.txt" append-path ;
M: vocab-link summary vocab-summary ;
-: set-vocab-summary ( string vocab -- )
- [ 1array ] dip
- dup vocab-summary-path
- set-vocab-file-contents ;
-
: vocab-tags-path ( vocab -- string )
vocab-dir "tags.txt" append-path ;
: vocab-tags ( vocab -- tags )
dup vocab-tags-path vocab-file-contents ;
-: set-vocab-tags ( tags vocab -- )
- dup vocab-tags-path set-vocab-file-contents ;
-
-: add-vocab-tags ( tags vocab -- )
- [ vocab-tags append members ] keep set-vocab-tags ;
-
-: remove-vocab-tags ( tags vocab -- )
- [ vocab-tags swap diff ] keep set-vocab-tags ;
-
: vocab-authors-path ( vocab -- string )
vocab-dir "authors.txt" append-path ;
: vocab-authors ( vocab -- authors )
dup vocab-authors-path vocab-file-contents ;
-: set-vocab-authors ( authors vocab -- )
- dup vocab-authors-path set-vocab-file-contents ;
-
: vocab-platforms-path ( vocab -- string )
vocab-dir "platforms.txt" append-path ;
dup vocab-platforms-path vocab-file-contents
[ dup "system" lookup-word [ ] [ bad-platform ] ?if ] map ;
-: set-vocab-platforms ( platforms vocab -- )
- [ [ name>> ] map ] dip
- dup vocab-platforms-path set-vocab-file-contents ;
-
: supported-platform? ( platforms -- ? )
[ t ] [ [ os swap class<= ] any? ] if-empty ;
[ vocab-platforms supported-platform? not ]
} 1|| ;
-: filter-don't-load ( vocabs -- vocabs' )
- [ vocab-name don't-load? ] reject ;
-
: don't-test? ( vocab -- ? )
vocab-tags "not tested" swap member? ;