Changeset 18130 in project


Ignore:
Timestamp:
05/21/10 20:44:20 (9 years ago)
Author:
Moritz Heidkamp
Message:

add "hyde init" command for initializing a site in the current directory

Location:
release/4/hyde
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/hyde/hyde-cmd.scm

    r18114 r18130  
    11#!/usr/bin/csi -ns
    22
    3 (use hyde)
     3(use hyde matchable)
    44
    5 (unless (file-exists? "hyde.scm")
    6   (with-output-to-port (current-error-port)
    7     (cut print "no hyde file found!"))
    8   (exit))
    9 
    10 (load "hyde.scm")
    11 (compile-pages)
     5(match (command-line-arguments)
     6  (("init") (initialize-site))
     7  (... (load-hyde-file)
     8       (compile-pages)))
  • release/4/hyde/hyde.scm

    r18127 r18130  
    11(module hyde
    22
    3 (source-dir
     3(load-hyde-file
     4 initialize-site
     5 source-dir
    46 output-dir
    57 layouts-dir
     
    4648  `((inject *preorder* . ,(project 1))
    4749    ,@universal-conversion-rules))
     50
     51(define (print-error error)
     52  (with-output-to-port (current-error-port)
     53    (cut print error)))
     54
     55(define (die error exit-code)
     56  (print-error error)
     57  (exit exit-code))
     58
     59(define (load-hyde-file)
     60  (if (file-exists? "hyde.scm")
     61      (load "hyde.scm")
     62      (die "no hyde.scm found" 1)))
     63
     64(define (initialize-site)
     65  (unless (null? (directory))
     66    (die "unable to initialize site, directory is not empty" 1))
     67 
     68  (print "creating " (layouts-dir))
     69  (create-directory (layouts-dir))
     70  (print "creating " (source-dir))
     71  (create-directory (source-dir))
     72  (print "creating " (output-dir))
     73  (create-directory (output-dir))
     74  (print "creating hyde.scm")
     75  (with-output-to-file "hyde.scm" (cut display "")))
    4876
    4977(define (cmd name . args)
Note: See TracChangeset for help on using the changeset viewer.