diff options
author | Tristan Williams <tgwil@tgwil.net> | 2024-10-27 22:15:12 -0400 |
---|---|---|
committer | Tristan Williams <tgwil@tgwil.net> | 2024-10-27 22:15:12 -0400 |
commit | 6ad840ed600bebfe4801b045a2bb24abb848b54e (patch) | |
tree | 08c6694fabc0d05b124f8360246400b948ed5e9e | |
download | template.cl-6ad840ed600bebfe4801b045a2bb24abb848b54e.tar.gz template.cl-6ad840ed600bebfe4801b045a2bb24abb848b54e.tar.bz2 template.cl-6ad840ed600bebfe4801b045a2bb24abb848b54e.zip |
Add everything
I've already been working on a CL template. Just add the fucker.
-rw-r--r-- | Makefile | 31 | ||||
-rw-r--r-- | README.md | 27 | ||||
-rw-r--r-- | SYSTEM.asd | 20 | ||||
-rw-r--r-- | src/SYSTEM.lisp | 26 | ||||
-rw-r--r-- | test/SYSTEM-test.lisp | 31 |
5 files changed, 135 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a1fb064 --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,31 @@ | |||
1 | # Makefile for SYSTEM | ||
2 | # AUTHOR: | ||
3 | |||
4 | |||
5 | # Default, run when make recieves no arguments | ||
6 | all: clean test SYSTEM | ||
7 | |||
8 | |||
9 | # Compile the SYSTEM executable | ||
10 | .PHONY: SYSTEM | ||
11 | SYSTEM: | ||
12 | sbcl --no-userinit --no-sysinit --non-interactive \ | ||
13 | --load ~/lisp/quicklisp/setup.lisp \ | ||
14 | --eval '(load "SYSTEM.asd")' \ | ||
15 | --eval '(ql:quickload "SYSTEM")' \ | ||
16 | --eval "(sb-ext:save-lisp-and-die \"SYSTEM\" :executable t :toplevel #'SYSTEM:entrypoint :compression 9)" | ||
17 | |||
18 | |||
19 | # Run test suite | ||
20 | .PHONY: test | ||
21 | test: | ||
22 | sbcl --no-userinit --no-sysinit --non-interactive \ | ||
23 | --load ~/lisp/quicklisp/setup.lisp \ | ||
24 | --eval '(load "SYSTEM.asd")' \ | ||
25 | --eval "(asdf:test-system 'SYSTEM)" | ||
26 | |||
27 | |||
28 | # Clean everything | ||
29 | .PHONY: clean | ||
30 | clean: | ||
31 | @if test -f fash; then rm -f fash && echo "rm: SYSTEM"; fi | ||
diff --git a/README.md b/README.md new file mode 100644 index 0000000..abc797c --- /dev/null +++ b/README.md | |||
@@ -0,0 +1,27 @@ | |||
1 | # Template.CommonLisp | ||
2 | |||
3 | This is a template for Common Lisp systems. | ||
4 | |||
5 | It contains only the basics: | ||
6 | - System/package definitions | ||
7 | - Testing suite (using 5am) | ||
8 | - Makefile for compiling executable | ||
9 | |||
10 | |||
11 | ## Usage | ||
12 | |||
13 | Modify the following files: | ||
14 | - README.md | ||
15 | - Makefile | ||
16 | - SYSTEM.asd | ||
17 | - src/SYSTEM.lisp | ||
18 | - test/SYSTEM-test.lisp | ||
19 | |||
20 | Do the following: | ||
21 | - Replace any instance of the word SYSTEM with the name of the system/project | ||
22 | - Fill out the headers in each file (Filename, description, AUTHOR) | ||
23 | |||
24 | |||
25 | ## Notes | ||
26 | |||
27 | - This template assumes that Quicklisp is installed to `~/lisp/quicklisp/`. | ||
diff --git a/SYSTEM.asd b/SYSTEM.asd new file mode 100644 index 0000000..f9b2754 --- /dev/null +++ b/SYSTEM.asd | |||
@@ -0,0 +1,20 @@ | |||
1 | ;;;; SYSTEM.asd | ||
2 | ;;;; System definitions for SYSTEM | ||
3 | ;;;; AUTHOR: | ||
4 | |||
5 | ;; --------------------------------------------------------------------- | ||
6 | ;;; Main System Definition | ||
7 | ;; --------------------------------------------------------------------- | ||
8 | (asdf:defsystem "SYSTEM" | ||
9 | :build-operation program-op | ||
10 | :components ((:file "src/SYSTEM")) | ||
11 | :in-order-to ((asdf:test-op (asdf:test-op "SYSTEM/test")))) | ||
12 | |||
13 | |||
14 | ;; --------------------------------------------------------------------- | ||
15 | ;;; Test Suite System Definition | ||
16 | ;; --------------------------------------------------------------------- | ||
17 | (asdf:defsystem "SYSTEM/test" | ||
18 | :depends-on ("SYSTEM" "fiveam") | ||
19 | :components ((:file "test/SYSTEM-test")) | ||
20 | :perform (asdf:test-op (o c) (uiop:symbol-call :fiveam '#:run-all-tests))) | ||
diff --git a/src/SYSTEM.lisp b/src/SYSTEM.lisp new file mode 100644 index 0000000..468645a --- /dev/null +++ b/src/SYSTEM.lisp | |||
@@ -0,0 +1,26 @@ | |||
1 | ;;;; SYSTEM.lisp | ||
2 | ;;;; Entrypoint for SYSTEM | ||
3 | ;;;; AUTHOR: | ||
4 | |||
5 | ;; --------------------------------------------------------------------- | ||
6 | ;;; Package Definition | ||
7 | ;; --------------------------------------------------------------------- | ||
8 | (defpackage :SYSTEM | ||
9 | (:use #:common-lisp) | ||
10 | (:export #:entrypoint | ||
11 | #:*version*)) | ||
12 | |||
13 | (in-package :SYSTEM) | ||
14 | |||
15 | (defparameter *version* (with-output-to-string | ||
16 | (*standard-output*) | ||
17 | (uiop:run-program "git rev-parse --short HEAD" :output t))) | ||
18 | |||
19 | |||
20 | ;; --------------------------------------------------------------------- | ||
21 | ;;; Entrypoint | ||
22 | ;; --------------------------------------------------------------------- | ||
23 | (defun entrypoint () | ||
24 | "Entrypoint for SYSTEM." | ||
25 | (format t "SYSTEM Version: ~A" *version*) | ||
26 | "SYSTEM") | ||
diff --git a/test/SYSTEM-test.lisp b/test/SYSTEM-test.lisp new file mode 100644 index 0000000..3de09df --- /dev/null +++ b/test/SYSTEM-test.lisp | |||
@@ -0,0 +1,31 @@ | |||
1 | ;;;; SYSTEM-test.lisp | ||
2 | ;;;; Tests for SYSTEM | ||
3 | |||
4 | |||
5 | ;; --------------------------------------------------------------------- | ||
6 | ;;; Package Definition | ||
7 | ;; --------------------------------------------------------------------- | ||
8 | (defpackage :SYSTEM-test | ||
9 | (:use :common-lisp :SYSTEM :fiveam) | ||
10 | (:export #:SYSTEM-test-all)) | ||
11 | |||
12 | (in-package :SYSTEM-test) | ||
13 | |||
14 | |||
15 | ;; --------------------------------------------------------------------- | ||
16 | ;;; 5AM Test Suite Definition | ||
17 | ;; --------------------------------------------------------------------- | ||
18 | (5am:def-suite SYSTEM-test-suite | ||
19 | :description "Test suite for SYSTEM.") | ||
20 | |||
21 | (5am:in-suite SYSTEM-test-suite) | ||
22 | |||
23 | |||
24 | ;; --------------------------------------------------------------------- | ||
25 | ;;; Tests | ||
26 | ;; --------------------------------------------------------------------- | ||
27 | |||
28 | ;; Bullshit | ||
29 | (5am:test existence | ||
30 | "Bullshit test just for implementing tests." | ||
31 | (is (equal (fash:entrypoint) "SYSTEM"))) | ||