2 #+author: Richard Westhaver
3 #+description: Project Skeletons
6 + forge :: [[https://lab.rwest.io/ellis/skel][Heptapod]] 7 + mirror :: [[https://github.com/richardwesthaver/skel][Github]] 9 This system provides functions and macros for building and deploying
10 project skeletons.
/This is not a general purpose templating 11 system/. It is specifically for my software stack.
14 - vaporize boilerplate code and docs
15 - integrate reasonably well with my tools (Emacs/etc)
16 - object-oriented project management
18 - [[https://www.gnu.org/software/emacs/manual/html_node/autotype/Skeleton-Language.html][skeleton-lanaguage (emacs)]] 19 - [[https://github.com/emacs-mirror/emacs/tree/master/lisp/cedet/ede][cedet/ede (emacs)]] 20 - [[https://www.gnu.org/software/make/manual/make.html][GNU make]] 21 - [[https://docs.factorcode.org/content/article-vocabularies.html][Factor (forth) definitions]] 23 Make sure you have sbcl installed:
24 #+begin_src shell :results pp :exports both 31 Then compile the program. This command produces a binary called
=skel= 33 #+begin_src shell :results raw silent 34 sbcl --noinform --non-interactive --eval '(ql:quickload :app/cli/skel)' --eval '(asdf:make :app/cli/skel)'
37 Run the binary without any args, which will print a skeleton of the
38 current project directory (
=*skel-project*=).
40 #+begin_src shell :results output replace :exports both 47 usage: skel [global] <command> [<arg>]
49 A hacker's project compiler and build tool.
51 -h/--help* : print this message
52 -v/--version* : print version
53 -d/--debug* : set log level (debug,info,trace,warn)
54 -c/--config* : set a custom skel user config
55 -i/--input : input source
56 -o/--output : output target
58 init : initialize a skelfile in the current directory
59 -n/--name : project name
61 show : describe the project skelfile
62 -f/--file : path to skelfile
64 inspect : inspect the project skelfile
65 -f/--file : path to skelfile
67 make : build project targets
68 -t/--target : target to build
70 run : run a script or command
72 push : push the current project upstream
74 pull : pull the current project from remote
76 clone : clone a remote project
78 commit : commit changes to the project vc
80 edit : edit a project file
82 shell : open the sk-shell interpreter
86 Here's skel's skelfile:
88 #+begin_src shell :results output replace :wrap src skel :exports results 94 ;;; skelfile @ 2023-10-08.02:37:25 -*- mode: skel; -*-
98 :description "a hacker's project compiler"
102 :rules ((build () (print (asdf:make :skel/cli)))
103 (clean () #$rm -rf */*.fasl$#))
104 :documents ((:org "readme"))
110 :maintainer "ellis <ellis@rwest.io>"
111 :bug-tracker "https://lab.rwest.io/ellis/skel/issues"
112 :class :package-inferred-system
113 :defsystem-depends-on (:asdf-package-system)
114 :depends-on (:uiop :asdf :sb-posix :sb-bsd-sockets :sb-concurrency :cl-ppcre :std :organ :skel/pkg)
115 :in-order-to ((test-op (test-op skel/tests)))
116 :perform (test-op (op c) (uiop:symbol-call '#:rt '#:do-tests))))
117 :stash "~/dev/comp/stash"
118 :shed "~/dev/comp/shed"
121 ((autogen #$sbcl --eval '(ql:quickload :app/cli/skel)' --eval '(asdf:make :app/cli/skel)'$#))
124 This is just a form without the top-level parentheses - you're free to
125 omit them in a skelfile.
128 The
=describe= command can be used to check the currently active
129 skelfile, printing any errors and the parsed object.
131 #+begin_src shell :results output replace :exports both 137 #<SKEL:SK-PROJECT :ID 1e61-38b1-c5fe-7eac>
140 Slots with :INSTANCE allocation:
142 PATH = #P"/home/ellis/dev/skel/skelfile"
146 DESCRIPTION = "a hacker's project compiler"
149 ID = 2189093230060928684
151 RULES = ((BUILD NIL (PRINT (ASDF/OPERATE:MAKE :SKEL/CLI)))..
152 DOCUMENTS = ((:ORG "readme"))
153 COMPONENTS = ((:ELISP "sk")..
155 SNIPPETS = ((AUTOGEN "sbcl --eval '(asdf:make :skel/cli)'"))
163 Skelfiles can be compiled to produce a new project skeleton or update
166 Try compiling skel's skelfile:
168 #+begin_src shell :results output replace :exports code 172 You may also compile individual components of the project structure,
173 for example, to compile the rules into a makefile:
175 #+begin_src shell :results output replace :exports code 179 #+begin_src shell :results output :wrap src makefile :exports both 185 ### SKEL @ 2023-09-14.01:47:59 --- A hacker's project compiler -*- mode:makefile ; -*-
186 LISP=sbcl --noinform --non-interactive --eval "(asdf:load-asd \"skel.asd\")" --eval "(ql:quickload :skel)"
187 .PHONY: compile clean
188 compile:;$(LISP) --eval "(asdf:compile-system :skel)"
189 test:compile;$(LISP) --eval "(ql:quickload :skel/tests)" --eval "(in-package :skel.tests)" --eval "(compile-file \"tests.lisp\")" --eval "(load-file \"tests.lisp\")" --eval "(do-tests :skel)"
191 debug:compile;$(LISP) --eval "(start-repl)"
196 When you run
=skel init= this is the basic skelfile that will be
197 generated in the current directory, depending on the following
199 - default user config
202 With no cli args or user config and an empty directory the output
205 ;;; examples @ 2023-10-09.23:38:23 -*- mode: skel; -*-
211 The unit tests may also be a useful reference:
213 #+begin_src lisp :results output replace :wrap src lisp :exports both :package :skel.tests 214 (ql:quickload :skel/tests)
215 (in-package :skel.tests)
216 (setq *log-level* nil)
217 ;; (setq *catch-test-errors* nil)
218 (setq *compile-tests* t)
219 (list (multiple-value-list (do-tests :skel)) (test-results *test-suite*))
224 To load "skel/tests":
227 ; Loading "skel/tests"
228 ..................................................
229 [package skel.vc].................................
230 [package skel.virt]...............................
231 [package skel.comp.asd]...........................
232 [package skel.make]...............................
233 [package skel.ext.asdf]...........................
234 [package skel.tests].
235 in suite SKEL with 6/6 tests:
237 #<PASS MAKEFILE-TEST787>
238 #<PASS SKELRC-TEST786>
239 #<PASS SKELFILE-TEST785>
240 #<PASS HEADER-COMMENTS-TEST784>
241 #<PASS SANITY-TEST783>
246 - TODO :: CLOS-based core classes
247 - TODO :: EIEIO-based wrapper classes
249 #+begin_src dot :file api.svg :exports results 250 digraph { splines=true; label="CLOS API"; labelloc="t"; node [shape=record];
251 sk [label="(skel :ID :AST)"]
252 methods [label="(sk-compile sk-expand sk-build\nsk-run sk-init sk-new sk-save\nsk-tangle sk-weave sk-call sk-print)"]
253 skmet [label="(sk-meta :NAME :PATH :VERSION :DESCRIPTION)"]
254 skvcs [label="(sk-vc-meta :VC)"]
255 skcmd [label="(sk-command)"]
256 sktar [label="(sk-target)"]
257 sksrc [label="(sk-source)"]
258 skrec [label="(sk-recipe :COMMANDS)"]
259 skrul [label="(sk-rule :TARGET :SOURCE :RECIPE)"]
260 skdoc [label="(sk-document)"]
261 skscr [label="(sk-script)"]
262 skcfg [label="(sk-config)"]
263 sksni [label="(sk-snippet)"]
264 skabb [label="(sk-abbrev)"]
265 skpro [label="(sk-project\l:RULES\l:DOCUMENTS\l:SCRIPTS\l:SNIPPETS\l:ABBREVS)\l"]