From 68c3e0494da254fb39e6b5d0f4b54343f72dd13c Mon Sep 17 00:00:00 2001 From: paku Date: Mon, 11 Mar 2024 13:15:54 +0900 Subject: [PATCH] Treat package names as string --- qlfile | 1 - qlfile.lock | 4 ---- src/main.lisp | 15 +++++++-------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/qlfile b/qlfile index d62ddb4..087ffa1 100644 --- a/qlfile +++ b/qlfile @@ -1,4 +1,3 @@ ql ningle ql cl-ppcre ql rove -ql alexandria diff --git a/qlfile.lock b/qlfile.lock index 7ee43ac..5634b14 100644 --- a/qlfile.lock +++ b/qlfile.lock @@ -14,7 +14,3 @@ (:class qlot/source/ql:source-ql :initargs (:%version :latest) :version "ql-2023-10-21")) -("alexandria" . - (:class qlot/source/ql:source-ql - :initargs (:%version :latest) - :version "ql-2023-10-21")) diff --git a/src/main.lisp b/src/main.lisp index 603431c..bea9efe 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -1,7 +1,6 @@ (uiop:define-package :ningle-fbr (:nicknames #:ningle-fbr/main) (:use #:cl) - (:local-nicknames (#:alx #:alexandria)) (:local-nicknames (#:re #:cl-ppcre)) (:local-nicknames (#:ng #:ningle)) (:export #:enable-file-based-routing)) @@ -28,11 +27,10 @@ ""))) (defun pathname->package (pathname system-path-namestring system-prefix) - (alx:make-keyword - (string-upcase - (re:regex-replace system-path-namestring - (remove-file-type (namestring pathname)) - system-prefix)))) + (string-upcase + (re:regex-replace system-path-namestring + (remove-file-type (namestring pathname)) + system-prefix))) (defun dir->pathnames (dir) (directory (concatenate 'string @@ -52,7 +50,7 @@ (dir->pathnames dir)))) (defparameter *http-request-methods* - '(:GET :HEAD :POST :PUT :DELETE :CONNECT :OPTIONS :PATCH)) + '(:GET :POST :PUT :DELETE :HEAD :CONNECT :OPTIONS :PATCH)) (defun enable-file-based-routing (app &key directory system) (loop @@ -60,6 +58,7 @@ :do (ql:quickload pkg) (loop :for method :in *http-request-methods* - :do (let ((handler (find-symbol (string (alx:symbolicate 'on- method)) pkg))) + :do (let ((handler (find-symbol (concatenate 'string "ON-" (string method)) + pkg))) (when handler (setf (ng:route app url :method method) handler))))))