From 9ee2abe0548805555bd5056c3ed1db940802bfa2 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 5 Apr 2023 20:12:45 -0700 Subject: Hmm... I thoguth I committed some of this already --- fussy.lisp | 66 +++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 18 deletions(-) (limited to 'fussy.lisp') diff --git a/fussy.lisp b/fussy.lisp index 2b419ee..def6d46 100644 --- a/fussy.lisp +++ b/fussy.lisp @@ -21,7 +21,8 @@ the emacs' reader readtable." ;; TODO: HANDLE HTTP ERRORS, HANDLE TIMEOUT, HANDLE READ ERRORS (multiple-value-bind (stream status) (dexador:get archive :want-stream t) (when (= 200 status) - (let ((*readtable* (emacs-reader-readtable))) + (let* ((*package* (find-package :fussy)) + (*readtable* (emacs-reader-readtable))) (read stream))))) (defclass/std theme-pkg (db:store-object) @@ -123,8 +124,15 @@ differs from the theme-pkg instance already in the data store." ;; restart-case with some restarts or something later, or will ;; just catch the error in the caller of update-theme-packages (when themes-to-update + ;; delete the temporary .emacs.d + (uiop:delete-directory-tree + (uiop:merge-pathnames* ".emacs.d/" (full-theme-image-directory)) + :validate t + :if-does-not-exist :ignore) + (generate-images-for-packages (mapcar #'archive-theme-name themes-to-update)) + ;; if we didn't error: update the db (dolist (archive-theme themes-to-update) (process-archive-theme archive-theme))))) @@ -183,7 +191,10 @@ returns a list of those names." store-directory fussy-el :std "" - :documentation "These paths are by default equal to the config directory."))) + :documentation "These paths are by default equal to the config directory.") + (port :std 8888) + (domain :std "localhost") + (address :std "0.0.0.0"))) (defvar *config* nil) @@ -215,17 +226,7 @@ are treated as such.") :directory (full-store-directory) :subsystems (list (make-instance 'db:store-object-subsystem))))) -(defun start (&key config-file) - (unless config-file - (setf config-file - (or (uiop:getenv "FUSSY_CONFIG") - (asdf:system-relative-pathname :fussy "config.sexp")))) - (setf *config* - (load-config-from-file config-file) - *config-directory* - (uiop:pathname-directory-pathname config-file)) - (create-db) - (update-theme-packages)) + (defparameter +standard-themes+ @@ -261,8 +262,37 @@ that they are not loaded during image gen.") (defun generate-images-for-packages (package-names) (when package-names (uiop:run-program - (format-emacs-evocation-script package-names)) - ;; we delete the custom location .emacs.d directory after each run. - ;; I'm doing this so that - (uiop:delete-directory-tree - (emacs-dot-d-directory) :validate t))) + (format-emacs-evocation-script package-names)))) + +(defvar *server* + (lzb:create-server)) + + + +(lzb:defendpoint* :get "/hello" () () + "what in the fuck? is fucking hjappening?") + + (lzb:provision-app () + :title "Emacs Themes Library" + :content-type "text/html") + + + +(defun start (&key config-file) + (unless config-file + (setf config-file + (or (uiop:getenv "FUSSY_CONFIG") + (asdf:system-relative-pathname :fussy "config.sexp")))) + (setf *config* + (load-config-from-file config-file) + *config-directory* + (uiop:pathname-directory-pathname config-file)) + (setf *server* + (lzb:create-server + :port (port *config*) + :address (address *config*) + :domain (domain *config*))) + (create-db) + (update-theme-packages) + (lzb:install-app *server* (lzb:app)) + (lzb:start-server *server*)) -- cgit v1.2.3