diff options
author | Andy Wingo | 2008-02-12 23:09:55 +0100 |
---|---|---|
committer | Andy Wingo | 2008-02-12 23:09:55 +0100 |
commit | 8c52717d5dab16eb628b823ffad914d44761459b (patch) | |
tree | 519a5823096d5b7164c6f520330173cfe7554f9c /src | |
parent | da58b954769ecfda8c167fe4644d26ce7e974f0b (diff) | |
download | tekuti-8c52717d5dab16eb628b823ffad914d44761459b.tar.gz tekuti-8c52717d5dab16eb628b823ffad914d44761459b.zip |
redo reindexing to be more erlangy
Diffstat (limited to 'src')
-rwxr-xr-x | src/tekuti | 66 |
1 files changed, 38 insertions, 28 deletions
@@ -39,33 +39,43 @@ exec guile $GUILE_FLAGS -l $0 -e main "$@" (tekuti mod-lisp) (tekuti web)) -(define (handle-request headers post-data) - (let ((heads (fetch-heads `(posts . ,reindex-posts) - `(categories . ,reindex-categories)))) - (let-headers - headers ((method "method") (path "url")) - (url-relative-path-case - method path - ((POST admin new-post) - (unimplemented 'new-post)) - ((POST admin modify-post) - (unimplemented 'modify-post)) - ((POST admin new-comment) - (unimplemented 'new-comment)) - ((POST admin delete-comment) - (unimplemented 'delete-comment)) - ((POST admin delete-post) - (unimplemented 'delete-post)) - ((GET) - (unimplemented 'index)) - ((GET archives year? month? day? post?) - (unimplemented 'archives)) - ((GET debug) - (page-debug headers)) - ((POST search) - (unimplemented 'search)) - (else (page-not-found path)))))) - +(define (handle-request headers post-data index) + (let-headers headers ((method "method") (path "url")) + (url-relative-path-case + method path + ((POST admin new-post) + (unimplemented 'new-post)) + ((POST admin modify-post) + (unimplemented 'modify-post)) + ((POST admin new-comment) + (unimplemented 'new-comment)) + ((POST admin delete-comment) + (unimplemented 'delete-comment)) + ((POST admin delete-post) + (unimplemented 'delete-post)) + ((GET) + (unimplemented 'index)) + ((GET archives year? month? day? post?) + (unimplemented 'archives)) + ((GET debug) + (page-debug headers)) + ((POST search) + (unimplemented 'search)) + (else (page-not-found path))))) + +(define (maybe-reindex old-master old-index) + (let ((master (git-rev-parse "master"))) + (values + master + (if (equal? master old-master) + old-index + (acons 'master master + (map (lambda (k reindex) + (cons k (reindex master))) + (list 'posts 'categories) + (list reindex-posts reindex-categories))))))) + (define (main args) (ensure-git-repo) - (event-loop handle-request)) + (event-loop handle-request maybe-reindex)) + |