From 91f3b04beff94d629d9c3a71884d482748a79fcd Mon Sep 17 00:00:00 2001 From: Fermin Date: Mon, 24 Jun 2024 23:06:05 +0200 Subject: [PATCH 1/5] Add lem-extension-manager to Lem main source --- lem.asd | 3 ++- qlfile | 1 + qlfile.lock | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lem.asd b/lem.asd index 5e3533f6c..99de07da7 100644 --- a/lem.asd +++ b/lem.asd @@ -35,7 +35,8 @@ ;; "lem-encodings" #+sbcl sb-concurrency - "lem-mailbox") + "lem-mailbox" + "lem-extension-manager") :pathname "src" :serial t :components ((:module "common" diff --git a/qlfile b/qlfile index a74b85f5d..4ce248b06 100644 --- a/qlfile +++ b/qlfile @@ -8,3 +8,4 @@ git cl-sdl2 https://github.com/lem-project/cl-sdl2.git git cl-sdl2-ttf https://github.com/lem-project/cl-sdl2-ttf.git git cl-sdl2-image https://github.com/lem-project/cl-sdl2-image.git git jsonrpc https://github.com/cxxxr/jsonrpc.git +git lem-extension-manager https://github.com/lem-project/lem-extension-manager.git \ No newline at end of file diff --git a/qlfile.lock b/qlfile.lock index b37a73785..bfdc14216 100644 --- a/qlfile.lock +++ b/qlfile.lock @@ -42,3 +42,7 @@ (:class qlot/source/git:source-git :initargs (:remote-url "https://github.com/cxxxr/jsonrpc.git") :version "git-bb3a536beb22112e544321dc7f3a8822413f9bac")) +("lem-extension-manager" . + (:class qlot/source/git:source-git + :initargs (:remote-url "https://github.com/lem-project/lem-extension-manager.git") + :version "git-34da6ca70ae10511481fae7fe10dc524e0257b37")) From 67b304c1850f5a08cb9ba02e583530b90f7c251c Mon Sep 17 00:00:00 2001 From: Fermin Date: Thu, 27 Jun 2024 18:23:39 +0200 Subject: [PATCH 2/5] Add extension commands to core Lem --- lem.asd | 3 +- src/ext/extension-commands.lisp | 67 +++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/ext/extension-commands.lisp diff --git a/lem.asd b/lem.asd index 99de07da7..c311a5aee 100644 --- a/lem.asd +++ b/lem.asd @@ -202,7 +202,8 @@ (:file "filer") (:file "deepl") (:file "themes") - (:file "detective"))))) + (:file "detective") + (:file "extension-commands"))))) (defsystem "lem/extensions" :depends-on (#+sbcl diff --git a/src/ext/extension-commands.lisp b/src/ext/extension-commands.lisp new file mode 100644 index 000000000..b56e336c0 --- /dev/null +++ b/src/ext/extension-commands.lisp @@ -0,0 +1,67 @@ +(defpackage :lem/extension-commands + (:use :cl :lem-extension-manager + :lem :ql) + #+sbcl + (:lock t) + (:export)) + +(in-package :lem/extension-commands) + +(defun %select-ql-package () + (let* ((packages (mapcar #'ql-dist:short-description + (system-list)))) + (prompt-for-string "Select package: " + :completion-function + (lambda (string) + (completion string packages))))) + +(define-command extension-manager-test-ql-package () () + (alexandria:if-let ((lpackage (%select-ql-package))) + (progn (package-test + (make-instance 'simple-package + :name lpackage + :source (make-quicklisp :name lpackage)))) + (editor-error "There was an error loading ~a!" lpackage))) + +(define-command extension-manager-install-ql-package () () + (let* ((lpackage (%select-ql-package))) + + (lem-use-package lpackage :source '(:type :quicklisp)) + (message "Package ~a installed!" lpackage))) + +(define-command extension-manager-remove-package () () + (if *installed-packages* + (let* ((packages (and *installed-packages* + (mapcar #'simple-package-name + *installed-packages*))) + (rpackage + (prompt-for-string "Select package: " + :completion-function + (lambda (string) + (completion string packages))))) + (package-remove + (find rpackage *installed-packages* + :key #'simple-package-name + :test #'string=)) + (message "Package remove from system!")) + + (message "No packages installed!"))) + + +(define-command extension-manager-purge-packages () () + (let* ((plist (packages-list)) + (extra-packages + (set-difference + (mapcar (lambda (p) + (first (last (pathname-directory p)))) + plist) + (mapcar #'simple-package-name *installed-packages*) + :test #'string=))) + (loop for e in extra-packages + for dir = (find e plist + :key (lambda (p) (first (last (pathname-directory p)))) + :test #'string=) + do (and (uiop:directory-exists-p dir) + (uiop:delete-directory-tree + (uiop:truename* dir) + :validate t))))) From a18232892e8899190782fab84bcd4fe6508f108b Mon Sep 17 00:00:00 2001 From: Fermin Date: Thu, 27 Jun 2024 18:32:32 +0200 Subject: [PATCH 3/5] Fix lock file --- qlfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qlfile.lock b/qlfile.lock index bfdc14216..b0e1cc4ad 100644 --- a/qlfile.lock +++ b/qlfile.lock @@ -45,4 +45,4 @@ ("lem-extension-manager" . (:class qlot/source/git:source-git :initargs (:remote-url "https://github.com/lem-project/lem-extension-manager.git") - :version "git-34da6ca70ae10511481fae7fe10dc524e0257b37")) + :version "git-fcab0e1c6874fb2cab7b9c450a89d25ae70aa0c4")) From 6b3d172d1f344b502848c07ab8ce5ad974fc7dc5 Mon Sep 17 00:00:00 2001 From: Fermin Date: Fri, 28 Jun 2024 21:05:57 +0200 Subject: [PATCH 4/5] Remove the qfile.lock change --- qlfile.lock | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/qlfile.lock b/qlfile.lock index b0e1cc4ad..ecc5faa2d 100644 --- a/qlfile.lock +++ b/qlfile.lock @@ -41,8 +41,4 @@ ("jsonrpc" . (:class qlot/source/git:source-git :initargs (:remote-url "https://github.com/cxxxr/jsonrpc.git") - :version "git-bb3a536beb22112e544321dc7f3a8822413f9bac")) -("lem-extension-manager" . - (:class qlot/source/git:source-git - :initargs (:remote-url "https://github.com/lem-project/lem-extension-manager.git") - :version "git-fcab0e1c6874fb2cab7b9c450a89d25ae70aa0c4")) + :version "git-bb3a536beb22112e544321dc7f3a8822413f9bac")) \ No newline at end of file From 1752dbe0104892afb9eb351eeb7288fffc2f210e Mon Sep 17 00:00:00 2001 From: Fermin Date: Mon, 11 Nov 2024 20:59:15 +0100 Subject: [PATCH 5/5] Fix parenthesis --- lem.asd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lem.asd b/lem.asd index 5a01d25ca..a224b5403 100644 --- a/lem.asd +++ b/lem.asd @@ -206,7 +206,7 @@ (:file "deepl") (:file "themes") (:file "detective") - (:file "extension-commands"))))) + (:file "extension-commands"))) (:module "ui" :serial t