~kingcons/rascal

76d68e00e0f997d3f6acdf7056db2d52fc54f37c — Brit Butler 1 year, 2 months ago
Initial commit
10 files changed, 179 insertions(+), 0 deletions(-)

A .build.yml
A .gitignore
A COPYING
A JOURNAL.md
A Makefile
A TODO.org
A rascal.asd
A src/docs.lisp
A src/rascal.lisp
A test/tests.lisp
A  => .build.yml +19 -0
@@ 1,19 @@
image: alpine/latest
packages:
  - sbcl
sources:
  - https://git.sr.ht/~kingcons/rascal
tasks:
  - install-quicklisp: |
      curl -O https://beta.quicklisp.org/quicklisp.lisp
      sbcl --non-interactive \
           --eval "(load \"~/quicklisp.lisp\")" \
           --eval "(quicklisp-quickstart:install)"
      mkdir -p ~/quicklisp/local-projects/
  - test: |
      ln -sf ~/rascal ~/quicklisp/local-projects/rascal
      sbcl --non-interactive \
           --eval "(load (merge-pathnames \"quicklisp/setup.lisp\" (user-homedir-pathname)))" \
           --eval "(ql:quickload '(:rascal :rascal/test))" \
           --eval "(funcall 'rascal.test:test-ci)" \
           --quit

A  => .gitignore +5 -0
@@ 1,5 @@
bin/*
site/*
*.fasl
*~
.#*

A  => COPYING +22 -0
@@ 1,22 @@
Copyright (c) Brit Butler

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

A  => JOURNAL.md +5 -0
@@ 1,5 @@
### Dev Log

#### 2023/01/01 - Writing Code

...

A  => Makefile +29 -0
@@ 1,29 @@
.PHONY: all app docs test clean

all: app docs

app:
	sbcl --eval "(ql:quickload :rascal)" \
	     --eval "(asdf:make :rascal)" \
	     --quit

docs:
	sbcl --non-interactive \
	     --eval "(ql:quickload :rascal)" \
	     --eval "(funcall 'rascal.docs:build-docs)" \
	     --quit

site:
	sbcl --non-interactive \
	     --eval "(ql:quickload :rascal)" \
	     --eval "(funcall 'rascal.docs:build-site)" \
         --quit

test:
	sbcl --non-interactive \
	     --eval "(ql:quickload :rascal/test)" \
	     --eval "(funcall 'rascal.test:test-ci)" \
	     --quit

clean:
	rm -rf bin/rascal site

A  => TODO.org +2 -0
@@ 1,2 @@
* rascal Tasks
** TODO - Define some tasks...

A  => rascal.asd +36 -0
@@ 1,36 @@
(defpackage :rascal
  (:use :cl :asdf))
(in-package :rascal)

(defsystem "rascal"
  :version "0.1"
  :author "Brit Butler"
  :license "MIT"
  :description "Describe rascal here"
  :source-control (:git "https://git.sr.ht/~kingcons/rascal")
  :depends-on (#:alexandria #:serapeum #:mgl-pax)
  :build-operation "program-op"
  :build-pathname "bin/rascal"
  :entry-point "rascal:main"
  :components ((:module "src"
                :serial t
                :components
                ((:file "rascal")
                 (:file "docs"))))
  :in-order-to ((test-op (test-op rascal/test))))

#+sb-core-compression
(defmethod asdf:perform ((o asdf:image-op) (c asdf:system))
  (uiop:dump-image (asdf:output-file o c) :executable t :compression t))

(defsystem "rascal/test"
  :author "Brit Butler"
  :license "MIT"
  :description "Tests for rascal"
  :depends-on (#:rascal #:try)
  :components ((:module "test"
                :serial t
                :components
                ((:file "tests"))))
  :perform (test-op (o s)
                    (uiop:symbol-call '#:rascal.test '#:test)))

A  => src/docs.lisp +32 -0
@@ 1,32 @@
(mgl-pax:define-package :rascal.docs
  (:use :cl :alexandria :mgl-pax)
  (:export #:build-docs
           #:build-site))

(in-package :rascal.docs)

(defsection @rascal (:title "rascal")
  (@links section)
  (@overview section))

(defsection @links (:title "Links")
  "[repo]: https://git.sr.ht/~kingcons/rascal
   [builds]: https://builds.sr.ht/~kingcons/rascal

  Here are links to the current [CI builds][builds] and [git repo][repo].")

(defsection @overview (:title "Overview")
  "I should probably write something here.")

(defun build-docs ()
  (let ((*document-normalize-packages* nil))
    (update-asdf-system-readmes @rascal :rascal)))

(defun build-site ()
  (update-asdf-system-html-docs
   @rascal :rascal
   :target-dir (asdf:system-relative-pathname :rascal "site/")
   :pages `((:objects (,rascal.docs:@rascal)
             :source-uri-fn ,(make-git-source-uri-fn
                              :rascal "https://git.sr.ht/~kingcons/rascal"
                              :uri-format-string "~A/tree/~A/item/~A#L~D")))))

A  => src/rascal.lisp +10 -0
@@ 1,10 @@
(mgl-pax:define-package :rascal
  (:use :cl :alexandria :mgl-pax)
  (:export #:main))

(in-package :rascal)

;;; Lisp isn't a language, it's a building material.

(defun main ()
  (format t "Hello, world!~%"))

A  => test/tests.lisp +19 -0
@@ 1,19 @@
(defpackage :rascal.test
  (:use :cl :rascal :try)
  (:export #:test-ci))

(in-package :rascal.test)

(deftest test-all ()
  (is (= (+ 2 2) 4)))

(defun test (&key (debug nil) (print 'unexpected) (describe 'unexpected))
  (warn-on-tests-not-run ((find-package :rascal-test))
    (print (try 'test-all :debug debug :print print :describe describe))))

(defun test-ci ()
  (unless (try:passedp (try:try 'test-all))
    (uiop:quit 1)))

#+nil
(test)