diff options
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | fussy.asd | 2 | ||||
-rw-r--r-- | fussy.el | 5 | ||||
-rw-r--r-- | fussy.lisp | 66 | ||||
-rw-r--r-- | package.lisp | 3 |
5 files changed, 60 insertions, 22 deletions
@@ -1,2 +1,6 @@ *~ -files/*
\ No newline at end of file +*svg +files/* +files/*/* +files/*/*/* +files/*/*/*/*
\ No newline at end of file @@ -8,7 +8,7 @@ :serial t :depends-on (#:hyperquirks #:bknr.datastore - #:lazybones + #:lazybones-hunchentoot #:dexador #:spinneret #:lass @@ -9,7 +9,7 @@ (string= suffix (cl-subseq str (- (length str) (length suffix)))))) -(defun fussy-is-theme-p (pkg-entry) + (defun fussy-is-theme-p (pkg-entry) (let ((name (symbol-name (cl-first pkg-entry)))) (and (or (fussy-string-ends-with name "-theme") (fussy-string-ends-with name "-themes")) @@ -52,6 +52,9 @@ called filename." (error (push package-name failed-to-install))))) failed-to-install)) +(defun remove-all-themes () + ()) + (defun locate-theme-package (theme) "Given a symbol naming a theme, find the name of the package that the theme came from." @@ -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*)) diff --git a/package.lisp b/package.lisp index 61fb793..4c4d387 100644 --- a/package.lisp +++ b/package.lisp @@ -3,5 +3,6 @@ (defpackage #:fussy (:use #:cl) (:local-nicknames (#:db #:bknr.datastore) - (#:a #:alexandria-2)) + (#:a #:alexandria-2) + (#:lzb #:lazybones)) (:import-from #:defclass-std #:defclass/std)) |