From 6ad840ed600bebfe4801b045a2bb24abb848b54e Mon Sep 17 00:00:00 2001 From: Tristan Williams Date: Sun, 27 Oct 2024 22:15:12 -0400 Subject: Add everything I've already been working on a CL template. Just add the fucker. --- Makefile | 31 +++++++++++++++++++++++++++++++ README.md | 27 +++++++++++++++++++++++++++ SYSTEM.asd | 20 ++++++++++++++++++++ src/SYSTEM.lisp | 26 ++++++++++++++++++++++++++ test/SYSTEM-test.lisp | 31 +++++++++++++++++++++++++++++++ 5 files changed, 135 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100644 SYSTEM.asd create mode 100644 src/SYSTEM.lisp create mode 100644 test/SYSTEM-test.lisp diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a1fb064 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +# Makefile for SYSTEM +# AUTHOR: + + +# Default, run when make recieves no arguments +all: clean test SYSTEM + + +# Compile the SYSTEM executable +.PHONY: SYSTEM +SYSTEM: + sbcl --no-userinit --no-sysinit --non-interactive \ + --load ~/lisp/quicklisp/setup.lisp \ + --eval '(load "SYSTEM.asd")' \ + --eval '(ql:quickload "SYSTEM")' \ + --eval "(sb-ext:save-lisp-and-die \"SYSTEM\" :executable t :toplevel #'SYSTEM:entrypoint :compression 9)" + + +# Run test suite +.PHONY: test +test: + sbcl --no-userinit --no-sysinit --non-interactive \ + --load ~/lisp/quicklisp/setup.lisp \ + --eval '(load "SYSTEM.asd")' \ + --eval "(asdf:test-system 'SYSTEM)" + + +# Clean everything +.PHONY: clean +clean: + @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 @@ +# Template.CommonLisp + +This is a template for Common Lisp systems. + +It contains only the basics: +- System/package definitions +- Testing suite (using 5am) +- Makefile for compiling executable + + +## Usage + +Modify the following files: +- README.md +- Makefile +- SYSTEM.asd +- src/SYSTEM.lisp +- test/SYSTEM-test.lisp + +Do the following: +- Replace any instance of the word SYSTEM with the name of the system/project +- Fill out the headers in each file (Filename, description, AUTHOR) + + +## Notes + +- 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 @@ +;;;; SYSTEM.asd +;;;; System definitions for SYSTEM +;;;; AUTHOR: + +;; --------------------------------------------------------------------- +;;; Main System Definition +;; --------------------------------------------------------------------- +(asdf:defsystem "SYSTEM" + :build-operation program-op + :components ((:file "src/SYSTEM")) + :in-order-to ((asdf:test-op (asdf:test-op "SYSTEM/test")))) + + +;; --------------------------------------------------------------------- +;;; Test Suite System Definition +;; --------------------------------------------------------------------- +(asdf:defsystem "SYSTEM/test" + :depends-on ("SYSTEM" "fiveam") + :components ((:file "test/SYSTEM-test")) + :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 @@ +;;;; SYSTEM.lisp +;;;; Entrypoint for SYSTEM +;;;; AUTHOR: + +;; --------------------------------------------------------------------- +;;; Package Definition +;; --------------------------------------------------------------------- +(defpackage :SYSTEM + (:use #:common-lisp) + (:export #:entrypoint + #:*version*)) + +(in-package :SYSTEM) + +(defparameter *version* (with-output-to-string + (*standard-output*) + (uiop:run-program "git rev-parse --short HEAD" :output t))) + + +;; --------------------------------------------------------------------- +;;; Entrypoint +;; --------------------------------------------------------------------- +(defun entrypoint () + "Entrypoint for SYSTEM." + (format t "SYSTEM Version: ~A" *version*) + "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 @@ +;;;; SYSTEM-test.lisp +;;;; Tests for SYSTEM + + +;; --------------------------------------------------------------------- +;;; Package Definition +;; --------------------------------------------------------------------- +(defpackage :SYSTEM-test + (:use :common-lisp :SYSTEM :fiveam) + (:export #:SYSTEM-test-all)) + +(in-package :SYSTEM-test) + + +;; --------------------------------------------------------------------- +;;; 5AM Test Suite Definition +;; --------------------------------------------------------------------- +(5am:def-suite SYSTEM-test-suite + :description "Test suite for SYSTEM.") + +(5am:in-suite SYSTEM-test-suite) + + +;; --------------------------------------------------------------------- +;;; Tests +;; --------------------------------------------------------------------- + +;; Bullshit +(5am:test existence + "Bullshit test just for implementing tests." + (is (equal (fash:entrypoint) "SYSTEM"))) -- cgit v1.2.3