Commit 44a29295 authored by Eric Timmons's avatar Eric Timmons
Browse files

Add client source-registry.d CLI

parent bf74b33d
......@@ -28,6 +28,8 @@
and output translations of the current image.
+ Add =bundle init= CLI and =bundle-init= in client to easily create a new
clpmfile.
+ =client source-registry.d= CLI added to generate source registry config so
ASDF can find the client.
* v0.2.1 - 2020-04-05
......
......@@ -105,6 +105,16 @@ files.
See [[file:docs/sources.org][sources]] for more details on configuring sources.
Then, configure ASDF to find the CLPM client. Assuming you haven't modified
your [[https://common-lisp.net/project/asdf/asdf.html#Controlling-where-ASDF-searches-for-systems][ASDF source registry]] too much, place the output of the following command
at =~/.config/common-lisp/source-registry.conf.d/20-clpm-client.conf=. If
you've modified your source registry a lot, you probably know what to do with
the output.
#+begin_src shell
clpm client source-registry.d
#+end_src
Next, configure your favorite Lisp to load the client by placing the output
of the following command in your Lisp's init file (such as =~/.sbclrc=).
......@@ -112,8 +122,8 @@ files.
clpm client rc
#+end_src
Then you can start your favorite Common Lisp implementation and enter into
the default CLPM context.
Now you can start your favorite Common Lisp implementation and enter into the
default CLPM context.
#+begin_src common-lisp
(clpm-client:activate-context "default" :activate-asdf-integration t)
......@@ -121,7 +131,7 @@ files.
When using Quicklisp metadata directly, you need to sync in order to get all
the metadata locally (other types of sources are able to lazily sync). This
step may take a while the first time as it downloads and processes every
step will take a while the first time as it downloads and processes every
version of the distribution.
#+begin_src common-lisp
......
......@@ -7,6 +7,7 @@
(:use #:cl
#:clpm-cli/commands/client/common
#:clpm-cli/commands/client/rc
#:clpm-cli/commands/client/repl))
#:clpm-cli/commands/client/repl
#:clpm-cli/commands/client/source-registry.d))
(in-package #:clpm-cli/commands/client)
......@@ -37,29 +37,42 @@
(defun quicklisp-alternative-rc ()
#?";;; Use CLPM as a quicklisp alternative (missing systems are silently installed
;;; on demand and not extra steps need to be taken to turn it on).
;;;
;;; Generated by CLPM ${(clpm:clpm-version)}
(require \"asdf\")
#-clpm-client
(let ((client-asd-pathname #p\"${(clpm:client-asd-pathname)}\"))
(when (probe-file client-asd-pathname)
(asdf:load-asd client-asd-pathname)
(asdf:load-system \"clpm-client\")
(setf (symbol-value (uiop:find-symbol* :*asdf-system-not-found-behavior* :clpm-client)) :install)
(setf (symbol-value (uiop:find-symbol* :*context-diff-approval-method* :clpm-client)) t)
(if (uiop:symbol-call :clpm-client :active-context)
(uiop:symbol-call :clpm-client :activate-asdf-integration)
(uiop:symbol-call :clpm-client :activate-context \"default\" :activate-asdf-integration t))))")
(when (asdf:find-system \"clpm-client\" nil)
;; Load the CLPM client if we can find it.
(asdf:load-system \"clpm-client\")
(flet ((maybe-set-symbol-value (sym value)
(uiop:if-let ((sym (uiop:find-symbol* sym :clpm-client nil)))
(setf (symbol-value sym) value))))
;; Do not prompt before attempting to install a missing system.
(maybe-set-symbol-value '#:*asdf-system-not-found-behavior* :install)
;; Accept any diffs without prompting.
(maybe-set-symbol-value '#:*context-diff-approval-method* t))
(if (uiop:symbol-call :clpm-client '#:active-context)
;; If started inside a context (i.e., with `clpm exec` or `clpm bundle exec`),
;; activate ASDF integration
(uiop:symbol-call :clpm-client '#:activate-asdf-integration)
;; Otherwise, activate the default context and ASDF integration.
(uiop:symbol-call :clpm-client '#:activate-context \"default\" :activate-asdf-integration t)))")
(defun default-rc ()
#?";;; Use CLPM with default configuration to install systems on demand.
#?";;; Use CLPM with default configuration.
;;;
;;; Generated by CLPM ${(clpm:clpm-version)}
(require \"asdf\")
#-clpm-client
(let ((client-asd-pathname #p\"${(clpm:client-asd-pathname)}\"))
(when (probe-file client-asd-pathname)
(asdf:load-asd client-asd-pathname)
(asdf:load-system \"clpm-client\")
(when (uiop:symbol-call :clpm-client :active-context)
(uiop:symbol-call :clpm-client :activate-asdf-integration))))")
(when (asdf:find-system \"clpm-client\" nil)
;; Load the CLPM client if we can find it.
(asdf:load-system \"clpm-client\")
(when (uiop:symbol-call :clpm-client '#:active-context)
;; If started inside a context (i.e., with `clpm exec` or `clpm bundle exec`),
;; activate ASDF integration
(uiop:symbol-call :clpm-client '#:activate-asdf-integration)))")
(define-cli-command (("client" "rc") *client-rc-ui*) (args options)
(declare (ignore args))
......
;;;; clpm client source-registry.d
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-cli/commands/client/source-registry.d
(:use #:cl
#:clpm-cli/common-args
#:clpm-cli/commands/client/common
#:clpm-cli/interface-defs
#:named-readtables)
(:import-from #:uiop
#:*stdout*)
(:import-from #:cl-interpol)
(:import-from #:clpm))
(in-package #:clpm-cli/commands/client/source-registry.d)
(in-readtable :interpol-syntax)
(define-string *help-text*
"Print a form suitable for including in a file in ASDF's
source-registry.conf.d folder. This form will tell ASDF where to find the
client.
Place the outputs of this command in a file such as
~~~~/.config/common-lisp/source-registry.conf.d/20-clpm-client.conf")
(defparameter *client-source-registry.d-ui*
(adopt:make-interface
:name "clpm client source-registry.d"
:summary "Common Lisp Package Manager"
:usage "client source-registry.d [options]"
:help *help-text*
:contents (list *group-common*)))
(define-cli-command (("client" "source-registry.d") *client-source-registry.d-ui*) (args options)
(declare (ignore args options))
(write-string #?";; -*- mode: common-lisp; -*-
;; Auto generated by CLPM version ${(clpm:clpm-version)}
(:directory #P\"${(uiop:pathname-directory-pathname (clpm:client-asd-pathname))}\")
"
*stdout*)
t)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment