Recently Written · git

asdf-registration

Register your asdf projects with the ASDF loader.

git clone https://github.com/equwal/asdf-registration

Log | Files | Refs


commit 6b6015f48708922827272e81a7dccffdac249308
Spenser Truex <web@spensertruex.com>
2019-11-04 21:37:15 -0800

Remove majorly broken code.

 README.md              | 15 +++++++++++++++
 asdf-registration.asd  |  8 ++++++++
 asdf-registration.lisp | 10 ++++++++++
 initfile.lisp          | 10 ++++++++++
 install.sh             | 13 +++++++++++++
 package.lisp           |  3 +++
 6 files changed, 59 insertions(+)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..f30964a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,15 @@
+# asdf-registration
+
+Register you directories in the ASDF subsystem. ASDF probably has a better way
+to do it, but this one works.
+
+# Install
+
+Run the install script. If it complains, set $CL_INIT and $ASDF_REPO.
+```bash
+git clone git@github.com:equwal/asdf-registration.git
+export CL_INIT="$HOME/.sbclrc" # for some SBCLs only.
+export ASDF_REPO="$HOME/common-lisp" # This is where mine is.
+sh asdf-registration/install.sh
+```
+Add as many `asdf-registration:add-repo` lines as you need. The subdirectories will be added to the ASDF registry.
diff --git a/asdf-registration.asd b/asdf-registration.asd
new file mode 100644
index 0000000..28caf28
--- /dev/null
+++ b/asdf-registration.asd
@@ -0,0 +1,8 @@
+(asdf:defsystem #:asdf-registration
+  :description "Describe asdf-registration here"
+  :author "Spenser Truex <web@spensertruex.com>"
+  :license  "GNU GPL v3"
+  :version "0.0.1"
+  :serial t
+  :components ((:file "package")
+               (:file "asdf-registration")))
diff --git a/asdf-registration.lisp b/asdf-registration.lisp
new file mode 100644
index 0000000..d195c9d
--- /dev/null
+++ b/asdf-registration.lisp
@@ -0,0 +1,10 @@
+(in-package #:asdf-registration)
+(defun add-repo (path)
+  "Add a folder which contains ASDF systems. The subdirectories will be added to
+the ASDF registry."
+  (mapc #'add-to-registry
+        (remove-if-not #'uiop:directory-exists-p
+                       (uiop:subdirectories path))))
+
+(defun add-to-registry (dir)
+  (pushnew dir asdf:*central-registry* :test #'uiop:pathname-equal))
diff --git a/initfile.lisp b/initfile.lisp
new file mode 100644
index 0000000..273e16b
--- /dev/null
+++ b/initfile.lisp
@@ -0,0 +1,10 @@
+;;;; This file was inserted here to install asdf-registration.
+
+(defvar *my-directory* (uiop/os:getenv "ASDF_REPO"))
+(defvar *my-repo*      (uiop/os:getenv "CL_INIT"))
+
+
+(pushnew *my-directory* asdf:*central-registry* :test #'uiop:pathname-equal)
+(asdf:load-system :asdf-registration)
+(asdf-registration:add-repo *my-repo*)
+;;;; END asdf-registration code install
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..b6e587e
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+if [ "$CL_INIT" == "" ]
+then
+   if [ "$ASDF_REPO" == "" ]
+   then
+       echo "Need set export CL_INIT='somepath/some/implementation/file' and ASDF_REPO='some path/' for install to work!"
+       exit 1 # rip.
+   fi
+fi
+export ASDF_REGISTRATION_DIR=$(dirname $0)
+echo "
" >> $CL_INIT # literal newline character.
+cat $ASDF_REGISTRATION_DIR/initfile.lisp >> $CL_INIT
+echo "
" >> $CL_INIT # literal newline character.
diff --git a/package.lisp b/package.lisp
new file mode 100644
index 0000000..fbc242e
--- /dev/null
+++ b/package.lisp
@@ -0,0 +1,3 @@
+(defpackage #:asdf-registration
+  (:use #:cl)
+  (:export #:add-repo))