]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://github.com/slavapestov/factor
authorErik Charlebois <erikcharlebois@gmail.com>
Sun, 21 Feb 2010 11:36:54 +0000 (03:36 -0800)
committerErik Charlebois <erikcharlebois@gmail.com>
Sun, 21 Feb 2010 11:36:54 +0000 (03:36 -0800)
1  2 
basis/tools/scaffold/scaffold.factor

index 151d98a1346be75683da6ea19e3890293687ceb3,a8565fccf9358b7f1cccfbff51d9f6b2999fd120..fee37496c8ffd20c8f6a6451996fb7c441c4c711
@@@ -2,11 -2,11 +2,11 @@@
  ! See http://factorcode.org/license.txt for BSD license.
  USING: assocs io.files io.pathnames io.directories
  io.encodings.utf8 hashtables kernel namespaces sequences
- 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 summary ;
+ vocabs.loader vocabs.metadata 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 summary ;
  IN: tools.scaffold
  
  SYMBOL: developer-name
@@@ -15,7 -15,6 +15,6 @@@ SYMBOL: usin
  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
@@@ -40,9 -39,6 +39,6 @@@
  : check-root ( string -- string )
      dup vocab-root? [ not-a-vocab-root ] unless ;
  
- : check-vocab ( vocab -- vocab )
-     dup find-vocab-root [ no-vocab ] unless ;
  : check-vocab-root/vocab ( vocab-root string -- vocab-root string )
      [ check-root ] [ check-vocab-name ] bi* ;
  
@@@ -63,9 -59,6 +59,9 @@@
  : vocab-root/vocab/suffix>path ( vocab-root vocab suffix -- path )
      [ vocab-root/vocab>path dup file-name append-path ] dip append ;
  
 +: vocab/file>path ( vocab file -- path )
 +    [ vocab>path ] dip append-path ;
 +
  : vocab/suffix>path ( vocab suffix -- path )
      [ vocab>path dup file-name append-path ] dip append ;
  
          2drop
      ] if ;
  
 -: scaffold-authors ( vocab-root vocab -- )
 -    developer-name get [
 -        "authors.txt" vocab-root/vocab/file>path scaffolding? [
 -            developer-name get swap utf8 set-file-contents
 +: scaffold-metadata ( vocab file contents -- )
 +    [ ensure-vocab-exists ] 2dip
 +    [
 +        [ vocab/file>path ] dip swap scaffolding? [
 +            utf8 set-file-contents
          ] [
 -            drop
 +            2drop
          ] if
      ] [
          2drop
 -    ] if ;
 +    ] if* ;
  
  : lookup-type ( string -- object/string ? )
      "new" ?head drop [ { [ CHAR: ' = ] [ digit? ] } 1|| ] trim-tail
@@@ -262,21 -254,12 +258,21 @@@ PRIVATE
  : scaffold-undocumented ( string -- )
      [ interesting-words. ] [ link-vocab ] bi ;
  
 +: scaffold-authors ( vocab -- )
 +    "authors.txt" developer-name get scaffold-metadata ;
 +
 +: scaffold-tags ( vocab tags -- )
 +    [ "tags.txt" ] dip scaffold-metadata ;
 +
 +: scaffold-summary ( vocab summary -- )
 +    [ "summary.txt" ] dip scaffold-metadata ;
 +
  : scaffold-vocab ( vocab-root string -- )
      {
          [ scaffold-directory ]
          [ scaffold-main ]
 -        [ scaffold-authors ]
          [ nip require ]
 +        [ nip scaffold-authors ]
      } 2cleave ;
  
  : scaffold-core ( string -- ) "resource:core" swap scaffold-vocab ;