]> gitweb.factorcode.org Git - factor.git/commitdiff
don't scaffold an authors file if the developer-name is not set
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 30 Apr 2009 00:06:06 +0000 (19:06 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 30 Apr 2009 00:06:06 +0000 (19:06 -0500)
basis/tools/scaffold/scaffold.factor

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