Compare commits
9 commits
Author | SHA1 | Date | |
---|---|---|---|
09fc1024b0 | |||
19aae06f7f | |||
cd747e7470 | |||
3c83e74a84 | |||
bc87e5de01 | |||
506bf5d685 | |||
f8699dcc8c | |||
6cdf49965b | |||
|
90ac8ee8f5 |
9 changed files with 102 additions and 23 deletions
70
.forgejo/workflows/ci.yml
Normal file
70
.forgejo/workflows/ci.yml
Normal file
|
@ -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
|
|
@ -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 }}
|
||||
|
2
LICENSE
2
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
|
||||
|
|
|
@ -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**:
|
||||
|
@ -119,4 +121,4 @@ To handle 404 (Not Found) errors, create a special package named `:example/route
|
|||
|
||||
Licensed under the MIT License.
|
||||
|
||||
© 2024, skyizwhite.
|
||||
© 2024 Akira Tempaku
|
|
@ -1,10 +1,10 @@
|
|||
(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"))
|
||||
:author "skyizwhite"
|
||||
:maintainer "skyizwhite <paku@skyizwhite.dev>"
|
||||
:author "Akira Tempaku"
|
||||
:maintainer "Akira Tempaku <paku@skyizwhite.dev>"
|
||||
:license "MIT"
|
||||
:class :package-inferred-system
|
||||
:pathname "src"
|
||||
|
|
6
qlfile
6
qlfile
|
@ -2,5 +2,7 @@ ql ningle
|
|||
ql lack
|
||||
ql cl-ppcre
|
||||
ql alexandria
|
||||
github rove fukamachi/rove
|
||||
github dissect shinmera/dissect
|
||||
ql trivial-system-loader
|
||||
|
||||
git rove https://github.com/fukamachi/rove
|
||||
git dissect https://github.com/shinmera/dissect
|
||||
|
|
16
qlfile.lock
16
qlfile.lock
|
@ -18,11 +18,15 @@
|
|||
(: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)
|
||||
: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"))
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
#:regex-replace
|
||||
#:regex-replace-all)
|
||||
(:import-from #:ningle)
|
||||
(:import-from #:lack/response
|
||||
#:response-status)
|
||||
(:import-from #:trivial-system-loader
|
||||
#:load-system)
|
||||
(:export #:pathname->path
|
||||
#:path->uri
|
||||
#:path-package
|
||||
|
@ -54,10 +58,11 @@
|
|||
: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))
|
||||
(defmethod ningle:not-found ((app (eql app)))
|
||||
(setf (response-status ningle:*response*) 404)
|
||||
(funcall handler))))
|
||||
(loop
|
||||
:for method :in *http-request-methods*
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue