don't scaffold an authors file if the developer-name is not set

db4
Doug Coleman 2009-04-29 19:06:06 -05:00
parent 939c2fa64e
commit 7fe22b14f8
1 changed files with 14 additions and 5 deletions

View File

@ -6,7 +6,7 @@ vocabs.loader io combinators calendar accessors math.parser
io.streams.string ui.tools.operations quotations strings arrays io.streams.string ui.tools.operations quotations strings arrays
prettyprint words vocabs sorting sets classes math alien urls prettyprint words vocabs sorting sets classes math alien urls
splitting ascii combinators.short-circuit alarms words.symbol splitting ascii combinators.short-circuit alarms words.symbol
system ; system summary ;
IN: tools.scaffold IN: tools.scaffold
SYMBOL: developer-name SYMBOL: developer-name
@ -16,6 +16,10 @@ ERROR: not-a-vocab-root string ;
ERROR: vocab-name-contains-separator path ; ERROR: vocab-name-contains-separator path ;
ERROR: vocab-name-contains-dot path ; ERROR: vocab-name-contains-dot path ;
ERROR: no-vocab vocab ; ERROR: no-vocab vocab ;
ERROR: bad-developer-name name ;
M: bad-developer-name summary
drop "Developer name must be a string." ;
<PRIVATE <PRIVATE
@ -101,11 +105,16 @@ ERROR: no-vocab vocab ;
] if ; ] if ;
: scaffold-authors ( vocab-root vocab -- ) : scaffold-authors ( vocab-root vocab -- )
"authors.txt" vocab-root/vocab/file>path scaffolding? [ developer-name get [
[ developer-name get ] dip utf8 set-file-contents dup string? [ bad-developer-name ] unless
"authors.txt" vocab-root/vocab/file>path scaffolding? [
utf8 set-file-contents
] [
2drop
] if
] [ ] [
drop 2drop
] if ; ] if* ;
: lookup-type ( string -- object/string ? ) : lookup-type ( string -- object/string ? )
"new" ?head drop [ { [ CHAR: ' = ] [ digit? ] } 1|| ] trim-tail "new" ?head drop [ { [ CHAR: ' = ] [ digit? ] } 1|| ] trim-tail