summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshoshin <shoshin@cicadas.surf>2023-03-19 18:15:38 -0500
committershoshin <shoshin@cicadas.surf>2023-03-19 18:15:38 -0500
commitfaa53855fc708b4bffbdcca0e61506ec1b852d75 (patch)
treee0ba5d1ffef067aaeb04eadfbb82a580663a719a
Add: initial lazybones / bknr setup
-rw-r--r--.gitignore2
-rw-r--r--README.org3
-rw-r--r--arclade.asd11
-rw-r--r--arclade.lisp49
-rw-r--r--package.lisp19
5 files changed, 84 insertions, 0 deletions
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 <shoshin@cicadas.surf>"
+ :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))