code/save.lisp (976 bytes)
1 (in-package #:clapt) 2 3 (defvar *quicklisp-packages* nil) 4 (defvar *asdf-packages* nil) 5 (defvar *init-file* nil) 6 7 (defun install-ql (packages) 8 (mapcar #'ql:quickload (mapcar #'symbol-name packages))) 9 (defun install-asdf (packages) 10 (mapcar #'asdf:load-system packages)) 11 12 13 (defun update (&optional (core *core-path*)) 14 (install-ql *quicklisp-packages*) 15 (install-asdf *asdf-packages*) 16 (save core)) 17 18 (defun save (&optional (core *core-path*)) 19 ;; Should ensure that this is friendly. ~ is not allowed, does it actually 20 ;; exist, etc. 21 (sb-ext:save-lisp-and-die 22 (asdf/pathname:ensure-absolute-pathname 23 core))) 24 25 (defun add (manager &rest packages) 26 (with-open-file (s *init-file*) 27 (prin1 28 `(progn 29 ,@(loop for p in packages 30 collect `(pushnew ,p 31 (manager-packages-variable ,manager)))) 32 s))) 33 34 ;;; Would be nice to have an interface here with continuations, friendly output 35 ;;; and warnings, etc.