From 90ac8ee8f5258d18d2a02eb672bc4e9090dc44cc Mon Sep 17 00:00:00 2001 From: Anthony Green <green@moxielogic.com> Date: Sat, 28 Dec 2024 07:41:05 -0700 Subject: [PATCH 1/9] Remove dependency on quicklisp (#5) --- src/router.lisp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/router.lisp b/src/router.lisp index 9f974c3..fc780a9 100644 --- a/src/router.lisp +++ b/src/router.lisp @@ -7,6 +7,7 @@ #:regex-replace #:regex-replace-all) (:import-from #:ningle) + (:import-from #:trivial-system-loader) (:export #:pathname->path #:path->uri #:path-package @@ -54,7 +55,7 @@ :for path :in (detect-paths system target-dir-path) :for uri := (path->uri path) :for pkg := (path->package path system target-dir-path) - :do (ql:quickload pkg) + :do (load-system pkg) (if (string= uri "/not-found") (let ((handler (find-symbol "HANDLE-NOT-FOUND" pkg))) (defmethod ningle:not-found ((app ningle:app)) From 6cdf49965b2857e08454d29381cd96650e8f2614 Mon Sep 17 00:00:00 2001 From: paku <paku@skyizwhite.dev> Date: Sat, 28 Dec 2024 23:44:37 +0900 Subject: [PATCH 2/9] Add trivial-system-loader to qlot deps --- qlfile | 1 + qlfile.lock | 4 ++++ src/router.lisp | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qlfile b/qlfile index 548652c..88e3eca 100644 --- a/qlfile +++ b/qlfile @@ -2,5 +2,6 @@ ql ningle ql lack ql cl-ppcre ql alexandria +ql trivial-system-loader github rove fukamachi/rove github dissect shinmera/dissect diff --git a/qlfile.lock b/qlfile.lock index 003a88d..251711d 100644 --- a/qlfile.lock +++ b/qlfile.lock @@ -18,6 +18,10 @@ (:class qlot/source/ql:source-ql :initargs (:%version :latest) :version "ql-2024-10-12")) +("trivial-system-loader" . + (:class qlot/source/ql:source-ql + :initargs (:%version :latest) + :version "ql-2024-10-12")) ("rove" . (:class qlot/source/github:source-github :initargs (:repos "fukamachi/rove" :ref nil :branch nil :tag nil) diff --git a/src/router.lisp b/src/router.lisp index fc780a9..de26076 100644 --- a/src/router.lisp +++ b/src/router.lisp @@ -7,7 +7,8 @@ #:regex-replace #:regex-replace-all) (:import-from #:ningle) - (:import-from #:trivial-system-loader) + (:import-from #:trivial-system-loader + #:load-system) (:export #:pathname->path #:path->uri #:path-package From f8699dcc8c95347aecf8390ab41389e6c0db1684 Mon Sep 17 00:00:00 2001 From: paku <paku@skyizwhite.dev> Date: Sat, 11 Jan 2025 22:26:36 +0900 Subject: [PATCH 3/9] Update deps --- qlfile | 5 +++-- qlfile.lock | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qlfile b/qlfile index 88e3eca..b44b6df 100644 --- a/qlfile +++ b/qlfile @@ -3,5 +3,6 @@ ql lack ql cl-ppcre ql alexandria ql trivial-system-loader -github rove fukamachi/rove -github dissect shinmera/dissect + +git rove https://github.com/fukamachi/rove +git dissect https://github.com/shinmera/dissect diff --git a/qlfile.lock b/qlfile.lock index 251711d..a25f779 100644 --- a/qlfile.lock +++ b/qlfile.lock @@ -23,10 +23,10 @@ :initargs (:%version :latest) :version "ql-2024-10-12")) ("rove" . - (:class qlot/source/github:source-github - :initargs (:repos "fukamachi/rove" :ref nil :branch nil :tag nil) - :version "github-cacea7331c10fe9d8398d104b2dfd579bf7ea353")) + (:class qlot/source/git:source-git + :initargs (:remote-url "https://github.com/fukamachi/rove") + :version "git-cacea7331c10fe9d8398d104b2dfd579bf7ea353")) ("dissect" . - (:class qlot/source/github:source-github - :initargs (:repos "shinmera/dissect" :ref nil :branch nil :tag nil) - :version "github-a70cabcd748cf7c041196efd711e2dcca2bbbb2c")) + (:class qlot/source/git:source-git + :initargs (:remote-url "https://github.com/shinmera/dissect") + :version "git-a70cabcd748cf7c041196efd711e2dcca2bbbb2c")) From 506bf5d685721e4e92a31f883b636aad68b678ff Mon Sep 17 00:00:00 2001 From: paku <paku@skyizwhite.dev> Date: Sat, 11 Jan 2025 22:29:42 +0900 Subject: [PATCH 4/9] Add workflow for Forgejo actions --- .forgejo/workflows/ci.yml | 70 ++++++++++++++++++++++++++ .github/workflows/{test.yml => ci.yml} | 8 +-- 2 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 .forgejo/workflows/ci.yml rename .github/workflows/{test.yml => ci.yml} (91%) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..c7557e3 --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -0,0 +1,70 @@ +name: 'CI' + +on: + push: + branches: + - 'main' + pull_request: + +jobs: + test: + runs-on: docker + + strategy: + matrix: + lisp: + - sbcl-bin + + steps: + - uses: actions/checkout@v4 + + - name: Restore cache + id: restore-cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.roswell + /usr/local/bin/ros + /usr/local/etc/roswell/ + qlfile + qlfile.lock + .qlot + ~/.cache/common-lisp/ + key: roswell-${{ runner.os }}-${{ matrix.lisp }}-${{ hashFiles('qlfile', 'qlfile.lock', '*.asd') }} + + - name: Install Roswell + if: steps.restore-cache.outputs.cache-hit != 'true' + env: + LISP: ${{ matrix.lisp }} + run: | + curl -L https://raw.githubusercontent.com/roswell/roswell/master/scripts/install-for-ci.sh | sh + + - name: Install Qlot + if: steps.restore-cache.outputs.cache-hit != 'true' + run: | + ros install fukamachi/qlot + + - name: Install dependencies + if: steps.restore-cache.outputs.cache-hit != 'true' + run: | + PATH="~/.roswell/bin:$PATH" + qlot install + qlot exec ros install ningle-fbr + + - name: Save cache + id: save-cache + uses: actions/cache/save@v4 + if: steps.restore-cache.outputs.cache-hit != 'true' + with: + path: | + ~/.roswell + /usr/local/bin/ros + /usr/local/etc/roswell/ + qlfile + qlfile.lock + .qlot + ~/.cache/common-lisp/ + key: ${{ steps.restore-cache.outputs.cache-primary-key }} + + - name: Run tests + run: .qlot/bin/rove ningle-fbr.asd diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 91% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml index 2c2a54a..a3a8ce0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: 'test' +name: 'CI' on: push: @@ -7,15 +7,15 @@ on: pull_request: jobs: - tests: + test: runs-on: ubuntu-latest - + strategy: matrix: lisp: - sbcl-bin - ccl-bin - + env: LISP: ${{ matrix.lisp }} From bc87e5de01959cd99364bc14ad3eaf88e52e4478 Mon Sep 17 00:00:00 2001 From: paku <paku@skyizwhite.dev> Date: Sun, 23 Feb 2025 14:24:18 +0900 Subject: [PATCH 5/9] Update author --- LICENSE | 2 +- README.md | 2 +- ningle-fbr.asd | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LICENSE b/LICENSE index 454f5aa..3fa96da 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 skyizwhite +Copyright (c) 2024 Akira Tempaku Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 0b2d284..e7d6be3 100644 --- a/README.md +++ b/README.md @@ -119,4 +119,4 @@ To handle 404 (Not Found) errors, create a special package named `:example/route Licensed under the MIT License. -© 2024, skyizwhite. \ No newline at end of file +© 2024 Akira Tempaku \ No newline at end of file diff --git a/ningle-fbr.asd b/ningle-fbr.asd index a567398..6d4d3ec 100644 --- a/ningle-fbr.asd +++ b/ningle-fbr.asd @@ -3,8 +3,8 @@ :description "File-based router for Ningle" :long-description #.(uiop:read-file-string (uiop:subpathname *load-pathname* "README.md")) - :author "skyizwhite" - :maintainer "skyizwhite <paku@skyizwhite.dev>" + :author "Akira Tempaku" + :maintainer "Akira Tempaku <paku@skyizwhite.dev>" :license "MIT" :class :package-inferred-system :pathname "src" From 3c83e74a84e57f8ee2a9e98c4045d9b3e7a937f5 Mon Sep 17 00:00:00 2001 From: Akira Tempaku <paku@skyizwhite.dev> Date: Tue, 1 Apr 2025 01:15:02 +0900 Subject: [PATCH 6/9] Set 404 status to not-found response --- src/router.lisp | 3 +++ tests/routes/not-found.lisp | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/router.lisp b/src/router.lisp index de26076..6a2b150 100644 --- a/src/router.lisp +++ b/src/router.lisp @@ -7,6 +7,8 @@ #:regex-replace #:regex-replace-all) (:import-from #:ningle) + (:import-from #:lack/response + #:response-status) (:import-from #:trivial-system-loader #:load-system) (:export #:pathname->path @@ -60,6 +62,7 @@ (if (string= uri "/not-found") (let ((handler (find-symbol "HANDLE-NOT-FOUND" pkg))) (defmethod ningle:not-found ((app ningle:app)) + (setf (response-status ningle:*response*) 404) (funcall handler)))) (loop :for method :in *http-request-methods* diff --git a/tests/routes/not-found.lisp b/tests/routes/not-found.lisp index 5392fd8..a1b259d 100644 --- a/tests/routes/not-found.lisp +++ b/tests/routes/not-found.lisp @@ -1,11 +1,7 @@ (defpackage #:ningle-fbr-test/routes/not-found (:use #:cl) - (:import-from #:lack/response) - (:import-from #:ningle) (:export #:handle-not-found)) (in-package #:ningle-fbr-test/routes/not-found) (defun handle-not-found () - (setf (lack/response:response-status ningle:*response*) - 404) "Not Found") From cd747e7470f258b4388a846082d82d66cad9f037 Mon Sep 17 00:00:00 2001 From: Akira Tempaku <paku@skyizwhite.dev> Date: Sun, 18 May 2025 19:16:57 +0900 Subject: [PATCH 7/9] Add link to usage example --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e7d6be3..7e5f4c6 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ File-based routing automatically creates URL routes based on a project’s file ## Usage +[Practical usage example](https://github.com/skyizwhite/website) + To use ningle-fbr, set up your project using the [package-inferred-system](https://asdf.common-lisp.dev/asdf/The-package_002dinferred_002dsystem-extension.html) style. **Example directory structure**: From 19aae06f7ff17f16f008133a3bf234b89ab7de1e Mon Sep 17 00:00:00 2001 From: Akira Tempaku <paku@skyizwhite.dev> Date: Sat, 21 Jun 2025 02:28:25 +0900 Subject: [PATCH 8/9] Use instance specialization for not-found handler --- src/router.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router.lisp b/src/router.lisp index 6a2b150..e6ab39a 100644 --- a/src/router.lisp +++ b/src/router.lisp @@ -61,7 +61,7 @@ :do (load-system pkg) (if (string= uri "/not-found") (let ((handler (find-symbol "HANDLE-NOT-FOUND" pkg))) - (defmethod ningle:not-found ((app ningle:app)) + (defmethod ningle:not-found ((app (eql app))) (setf (response-status ningle:*response*) 404) (funcall handler)))) (loop From 09fc1024b035ce5aa65e369e2df9b9a380ba00fa Mon Sep 17 00:00:00 2001 From: Akira Tempaku <paku@skyizwhite.dev> Date: Sat, 21 Jun 2025 02:50:55 +0900 Subject: [PATCH 9/9] Update version --- ningle-fbr.asd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ningle-fbr.asd b/ningle-fbr.asd index 6d4d3ec..adda2ba 100644 --- a/ningle-fbr.asd +++ b/ningle-fbr.asd @@ -1,5 +1,5 @@ (defsystem "ningle-fbr" - :version "0.1.0" + :version "0.1.2" :description "File-based router for Ningle" :long-description #.(uiop:read-file-string (uiop:subpathname *load-pathname* "README.md"))