summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hintz <tjhintz@buddy.thintz.com>2013-10-12 17:21:42 -0700
committerThomas Hintz <tjhintz@buddy.thintz.com>2013-10-12 17:21:42 -0700
commitb766f4ae07c004044570b5163394d736f6fe7015 (patch)
tree0cbffdd299703463bd0cb564667b4aee60dd936d
parent10fa6e3c2e2860cf46d8706d2c89c9f277eeaf49 (diff)
downloadalley-cat-b766f4ae07c004044570b5163394d736f6fe7015.tar.gz
First version that works with thintz.com.0.1.0
-rw-r--r--alley-cat.meta2
-rw-r--r--alley-cat.scm35
-rw-r--r--alley-cat.setup4
3 files changed, 26 insertions, 15 deletions
diff --git a/alley-cat.meta b/alley-cat.meta
index ed7e4a8..0322a3a 100644
--- a/alley-cat.meta
+++ b/alley-cat.meta
@@ -1,7 +1,7 @@
(
(category web)
-(needs sxml-transforms srfi-69 scss srfi-13 lowdown doctype)
+(needs sxml-transforms srfi-69 scss srfi-13 lowdown doctype posix)
;(test-depends test)
diff --git a/alley-cat.scm b/alley-cat.scm
index 28d0a32..d40bd16 100644
--- a/alley-cat.scm
+++ b/alley-cat.scm
@@ -15,8 +15,8 @@
compile
)
-(import chicken scheme files srfi-1 extras ports)
-(use sxml-transforms srfi-69 scss srfi-13 lowdown doctype)
+(import chicken scheme files srfi-1 extras ports irregex)
+(use sxml-transforms srfi-69 scss srfi-13 lowdown doctype posix)
(define *pages* (make-hash-table))
(define *stylesheets* (make-hash-table))
@@ -25,7 +25,7 @@
(define src-dir (make-parameter "src"))
(define out-dir (make-parameter "out"))
(define res-dir (make-parameter "res"))
-(define link-root (make-parameter "/home"))
+(define link-root (make-parameter ""))
(define doctype (make-parameter doctype-html))
(define ++ string-append)
@@ -76,31 +76,42 @@
(hash-table-delete! *stylesheets* path))
(define (add-file-resource! path)
- (cons path *file-resources*))
+ (set! *file-resources* (cons path *file-resources*)))
(define (delete-file-resource! path)
- (remove (lambda (p) (equal? p path)) *file-resources*))
+ (set! *file-resources* (remove (lambda (p) (equal? p path)) *file-resources*)))
+
+(define (create-dirs path)
+ (create-directory (pathname-directory path) #t))
(define (output-pages)
(hash-table-for-each
*pages*
(lambda (k v)
- (with-output-to-file (++ (out-dir) "/" k)
- (lambda () (print (doctype) (sxml->html v)))))))
+ (let ((p (++ (out-dir) "/" k)))
+ (create-dirs p)
+ (with-output-to-file p
+ (lambda () (print (doctype) (sxml->html v))))))))
(define (output-stylesheets)
(hash-table-for-each
*stylesheets*
(lambda (k v)
- (with-output-to-file (++ (out-dir) "/" k)
- (lambda () (scss->css v))))))
+ (let ((p (++ (out-dir) "/" k)))
+ (create-dirs p)
+ (with-output-to-file p
+ (lambda () (scss->css v)))))))
(define (copy-file-resources)
- (for-each (lambda (p)
- (file-copy (++ (res-dir) "/" p) (++ (out-dir) "/" p)))
- *file-resources*))
+ (for-each
+ (lambda (p)
+ (let ((path-out (++ (out-dir) "/" p)))
+ (create-dirs path-out)
+ (file-copy (++ (res-dir) "/" p) path-out)))
+ *file-resources*))
(define (compile)
+ (and (directory? (out-dir)) (delete-directory (out-dir) #t))
(output-pages)
(output-stylesheets)
(copy-file-resources))
diff --git a/alley-cat.setup b/alley-cat.setup
index f371beb..73f1baa 100644
--- a/alley-cat.setup
+++ b/alley-cat.setup
@@ -1,5 +1,5 @@
-(compile -s -O2 -d1 alley-cat.scm -j alley-cat)
-(compile -s alley-cat.import.scm -O2 -d0)
+(compile -s -O2 -d2 alley-cat.scm -j alley-cat)
+(compile -s alley-cat.import.scm -O2 -d2)
(install-extension
;; Name of your extension: