From faa53855fc708b4bffbdcca0e61506ec1b852d75 Mon Sep 17 00:00:00 2001 From: shoshin Date: Sun, 19 Mar 2023 18:15:38 -0500 Subject: Add: initial lazybones / bknr setup --- .gitignore | 2 ++ README.org | 3 +++ arclade.asd | 11 +++++++++++ arclade.lisp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ package.lisp | 19 +++++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 .gitignore create mode 100644 README.org create mode 100644 arclade.asd create mode 100644 arclade.lisp create mode 100644 package.lisp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e02b6c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +/store/ diff --git a/README.org b/README.org new file mode 100644 index 0000000..f1fbf2a --- /dev/null +++ b/README.org @@ -0,0 +1,3 @@ +* Arclade + +A stupid web app video game trophy case. diff --git a/arclade.asd b/arclade.asd new file mode 100644 index 0000000..ea8ce77 --- /dev/null +++ b/arclade.asd @@ -0,0 +1,11 @@ +;;;; arclade.asd + +(asdf:defsystem #:arclade + :description "Arclade is a dumb personal score board / achivements / trophy case web app." + :author "Shoshin " + :license "AGPL" + :version "0.0.1" + :serial t + :depends-on (#:lazybones #:bknr.datastore #:derrida #:jonathan #:spinneret #:swank #:testiere #:lazybones-hunchentoot #:ironclad #:defclass-std) + :components ((:file "package") + (:file "arclade"))) diff --git a/arclade.lisp b/arclade.lisp new file mode 100644 index 0000000..f87772a --- /dev/null +++ b/arclade.lisp @@ -0,0 +1,49 @@ +;;;; arclade.lisp + +(in-package #:arclade) + +;;; CONFIGURATION + +(defvar *config* nil) + +(defclass/std config () + ((datastore-directory :ir :std (local-store-path)) + (swank-port :std nil :doc "If set, swank is started on this port.") + (host :std "0.0.0.0") + (port :ir :std 8888))) + +(defun config-from-file (path) + "PATH should be a path to a file containing a PLIST suitable for + passing as the keyword arguments to (MAKE-INSTANCE 'CONFIG ...)" + (apply #'make-instance 'config (read-from-file path))) + +;;; DATASTORE + +(defun local-store-path () + (merge-pathnames "store/" (asdf:system-source-directory :arclade))) + +(defun init-db (config) + "Initializes the data store with values from the CONFIG." + (ensure-directories-exist (datastore-directory config)) + (unless (boundp 'db:*store*) + (make-instance + 'db:mp-store + :directory (datastore-directory config) + :subsystems (list (make-instance 'db:store-object-subsystem))))) + +;;; WEB SERVER + +(defvar *server* nil + "The instance of the HTTP server") + +(lzb:provision-app () + :title "Arclade" + :version "0.1.0" + :content-type "text/html") + +(defun start () + (setf *config* (make-instance 'config)) + (init-db *config*) + (setf *server* (lzb:create-server)) + (lzb:install-app *server* (lzb:app 'arclade)) + (lzb:start-server *server*)) diff --git a/package.lisp b/package.lisp new file mode 100644 index 0000000..5f45b84 --- /dev/null +++ b/package.lisp @@ -0,0 +1,19 @@ +;;;; package.lisp + +(defpackage #:arclade + (:use #:cl) + (:local-nicknames (#:db #:bknr.datastore) + (#:idx #:bknr.indices) + (#:lzb #:lazybones) + (#:json #:jonathan)) + (:import-from #:lazybones + #:defendpoint*) + (:import-from #:derrida + #:with-plist) + (:import-from #:spinneret + #:with-html + #:with-html-string) + (:import-from #:testiere + #:defun/t) + (:import-from #:defclass-std + #:defclass/std)) -- cgit v1.2.3