If Quicklisp is installed you can use the built-in feature Quickproject.
(ql:quickload "quickproject")
(quickproject:make-project "~/src/lisp/swatchblade/"
:depends-on '(vecto hunchentoot))
This creates 4 files:
- package.lisp
- swatchblade.lisp
- swatchblade.asd
- README.txt
package.lisp defines package namespaces:
(defpackage #:swatchblade
(:use #:cl)
(:shadowing-import-from #:vecto
#:with-canvas
#:rounded-rectangle
#:set-rgb-fill
#:save-png-stream))
swatchblade.asd defines the system/project, source code files, dependencies, etc.
(asdf:defsystem #:swatchblade
:serial t
:depends-on (#:vecto
#:hunchentoot
#:cl-colors)
:components ((:file "package")
(:file "swatchblade")))
swatchblade.lisp is where the source code goes.
You can load the the project via Quicklisp's quickload:
* (ql:quickload "swatchblade")
loading output
* (swatchblade:start-web-server :port 8080)
Server started on port 8080.
If you then create another project that depends on the swatchblade system:
quickproject:make-project "~/src/lisp/whimsytron/"
:depends-on '(swatchblade))
Regarding tests, you can add another namespace in package.lisp for your tests:
(defpackage #:swatchblade-tests
(:use #:cl #:swatchblade))
Create a test file, write the code, and add the file to the system definition:
(asdf:defsystem #:swatchblade
:serial t
:depends-on (#:vecto
#:hunchentoot
#:cl-colors)
:components ((:file "package")
(:file "swatchblade")
(:file "swatchglade-tests")))
Load the swatchblade-tests namespace to run the tests.
Sample project with tests here
If you want to avoid Quicklisp installing all dependencies into the system, you'll have to install the dependencies and load the system manually as far as I know.
The author of Quicklisp, Zach Beane, has a more detailed post on using quickproject.