not manx 4 years ago
parent 77acae992e
commit c8ad02cd2f
Signed by: C-xC-c
GPG Key ID: F52ED472284EF2F4

@ -1,8 +1,8 @@
(asdf:defsystem #:hunchenhelpers (asdf:defsystem #:hunchenhelpers
:description "A helper library for hunchentoot" :description "A helper library for hunchentoot"
:author "Manx (boku@plum.moe)" :author "Manx <boku@plum.moe>"
:license "X11/MIT" :license "GPLv3"
:version "1.0.0" :version "1.1.0"
:serial t :serial t
:depends-on (:hunchentoot) :depends-on (:hunchentoot)
:Components ((:file "package") :Components ((:file "package")

@ -18,6 +18,13 @@
(defun host-dir (uri path &optional content-type) (defun host-dir (uri path &optional content-type)
(hunchenhost tbnl:create-folder-dispatcher-and-handler uri path content-type)) (hunchenhost tbnl:create-folder-dispatcher-and-handler uri path content-type))
(defmacro config-item (thing &aux (item (gensym)))
"Get `thing' from the alist `config', error if it doesn't exist"
`(let ((,item (assoc ,thing (eval (read-from-string "config")))))
(when (atom ,item)
(error "No such config item"))
(cdr ,item)))
;; Stolen from stackoverflow ;; Stolen from stackoverflow
(defmacro method-path (methods path) (defmacro method-path (methods path)
"Expands to a predicate the returns true of the Hunchtoot request "Expands to a predicate the returns true of the Hunchtoot request
@ -60,4 +67,5 @@ handler.
(export '(host-file (export '(host-file
host-dir host-dir
handle handle
acceptor)) acceptor
config-item))

@ -1,3 +1,3 @@
(defpackage #:hunchenhelpers (defpackage #:hunchenhelpers
(:nicknames :henh) (:nicknames #:toot)
(:use #:cl)) (:use #:cl))

Loading…
Cancel
Save