changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > org > docs / core/app/skel.org

changeset 48: 9f2e9e647333
author: Richard Westhaver <ellis@rwest.io>
date: Sat, 07 Sep 2024 22:34:47 -0400
permissions: -rw-r--r--
description: core documentation and stats
1 #+title: skel
2 #+author: Richard Westhaver
3 #+setupfile: ../../../clean.theme
4 #+OPTIONS: num:nil
5 
6 =skel= is the primary build tool for contributors and serves a
7 similar role to language-agnostic build tools like [[https://www.gnu.org/software/make/][GNU Make]], but with
8 the features and ease-of-use of language-specific build tools like
9 Rust's [[https://github.com/rust-lang/cargo][Cargo]].
10 
11 * features
12 :PROPERTIES:
13 :ID: 90d78420-e6d9-4f18-8222-89c4670633b4
14 :END:
15 ** configuration
16 :PROPERTIES:
17 :ID: 2658a3d1-cfa5-436e-b2b0-9cf42a6f66c6
18 :END:
19 The ~skel~ tool can be configured at runtime using the CLI flags, or
20 via local configuration files. The configuration files are in the
21 ~skelfile~ format and are assigned the following locations by default:
22 - ~*default-user-skelrc*~ :: =$HOME/.skelrc=
23 - ~*default-system-skelrc*~ :: =/etc/skel/skelrc=
24 
25 Both files are optional and the user skelrc takes precedence over
26 system.
27 
28 Example =~/.skelrc=:
29 #+begin_src shell :results output
30 cat ~/.skelrc
31 #+end_src
32 
33 #+RESULTS:
34 #+begin_example
35 ;;; .skelrc @ 2023-10-12.02:58:08 -*- mode: skel; -*-
36 :name "Richard Westhaver"
37 :email "richard.westhaver@gmail.com"
38 :user "ellis"
39 :version "0.1.0"
40 :tags ("auto")
41 :fmt :pretty
42 :vc :hg
43 :auto-insert t
44 :license :mpl2
45 :log-level :info
46 :stash ".stash"
47 ;; :scratch ".stash/scratch"
48 :cache ".stash/cache"
49 :registry ".data/skel/registry"
50 :scripts ("/usr/local/share/stash/scripts" "~/stash/scripts")
51 #+end_example
52 
53 ** projects
54 :PROPERTIES:
55 :ID: 359441da-1b61-4d73-8563-605ea7262b58
56 :END:
57 Projects are the highest-level objects int the ~skel~ system. A project
58 consists of a list of slots which are populated automatically or by
59 the user. Once a project is initialized the slots can be accessed and
60 a set of high-level operations can be performed.
61 
62 The easiest way to initialize a project is with a ~skelfile~. These
63 files are parsed as a simplified Lisp dialect and generate
64 ~sk-project~ objects based on their contents.
65 
66 The simplest project looks like this:
67 
68 #+begin_src skel :noeval t
69 :name hello-world
70 #+end_src
71 
72 Don't worry, this is still lisp - the parentheses are implied. All we
73 actually need is a name to generate an object, and we can fill in the
74 blanks later as the project develops.
75 
76 Here is a more verbose example, still with only metadata:
77 
78 #+begin_src skel :noeval t
79 ;;; skelfile --- core skelfile -*- mode: skel; -*-
80 :name "core"
81 :author "Richard Westhaver <ellis@rwest.io>"
82 :version "0.1.0"
83 :license "MPL"
84 :description "The Compiler Company Core"
85 :vc :hg
86 :tags ("core")
87 :docs ((:org "readme") (:org "install") (:org "tests") (:org "todo"))
88 :import ("lisp/lisp.sk" "rust/rust.sk")
89 #+end_src
90 
91 Another example with rules and components:
92 
93 #+begin_src skel :noeval t
94 ;;; skelfile @ 2023-10-08.02:37:25 -*- mode: skel; -*-
95 :name skel
96 :author "ellis"
97 :version "0.1.0"
98 :description "a hacker's project compiler"
99 :license "MPL"
100 :vc :hg
101 :tags ("lisp")
102 :rules ((build () (print (asdf:make :skel/cli)))
103  (clean () #$rm -rf */*.fasl$#))
104 :docs ((:org "readme"))
105 :components
106 ((:elisp "sk"))
107 :stash "~/dev/comp/stash"
108 #+end_src
109 ** version control
110 :PROPERTIES:
111 :ID: c15f58b5-d55e-425b-acf5-7001ef4591e4
112 :END:
113 =skel= integrates closely with our Version Control System which
114 is built on [[https://www.mercurial-scm.org/][Mercurial]], but we also interact with and host many [[https://git-scm.com/][Git]]
115 repositories.
116 
117 The =skel= tool helps us abstract away the differences between git/hg
118 and make maximum use of their utility. When you run a =skel vc=
119 command the currently active ~sk-project~ and configuration are used
120 to determine the appropriate VC backend to call. New backends can of
121 course be added as extensions.
122 
123 ** TODO compilers
124 :PROPERTIES:
125 :ID: 5ec3ae9d-8846-4374-a42b-5701606ad119
126 :END:
127 - State "TODO" from [2023-12-09 Sat 19:28]
128 One of the most unusual features of =skel= is the compiler set. With
129 the =skel= CLI you can compile the following types of files for your
130 project directly from a ~skelfile~:
131 - Makefile (.mk)
132 - Lisp system defs (.asd)
133 - Cargo.toml
134 - Containerfile
135 - .hgignore/.gitignore
136 
137 We treat skelfiles as the mother of all build formats and consolidate
138 different formats into our own project DSL. This helps reduce
139 complexity while increasing capability and portability.
140 
141 Project compilation occurs on demand with the =sk compile= command.
142 
143 ** TODO virtualization
144 :PROPERTIES:
145 :ID: fea87861-30c2-4739-b964-1ecb87d3ddff
146 :END:
147 - State "TODO" from [2023-12-09 Sat 18:55]
148 
149  =skel= offers a mechanism for generating and running Virtual
150  Machines (VMs) and Containers. Under the hood we depend on [[https://podman.io/][podman]]
151  for our container runtime as well as [[https://www.qemu.org/][QEMU]] for some functionality.
152 
153 ** TODO emacs integration
154 :PROPERTIES:
155 :ID: 3df22a04-3f6b-4738-bd5f-3eb91977d3af
156 :END:
157 - State "TODO" from [2023-12-09 Sat 19:30]
158 =sk.el= is the Emacs support package for skel. It contains a
159 =skel-mode= for working with skelfiles and will soon contain
160 additional built-in integrations for =project.el=, =vc.el=, and more.
161 ** TODO deployment
162 :PROPERTIES:
163 :ID: 7e66bdf6-304e-423e-8db4-783e7f6ccfd7
164 :END:
165 - State "TODO" from [2023-12-09 Sat 19:37]
166 ** TODO visualization
167 :PROPERTIES:
168 :ID: efa22675-70d6-453f-b377-8e76875e5f1f
169 :END:
170 - State "TODO" from [2023-12-09 Sat 19:37]
171 * help
172 :PROPERTIES:
173 :ID: f8e9fab4-67dc-4e7f-b172-7e0fc21047ad
174 :END:
175 #+begin_src shell :results pp replace :exports both
176 skel -h
177 #+end_src
178 
179 #+RESULTS:
180 #+begin_example
181 skel v0.1.1:97dd03beda03+ --- A hacker's project compiler.
182 
183  usage: skel [global] <command> [<arg>]
184 
185 options:
186  -h/--help* : print this message
187  -v/--version* : print version
188  -l/--level* : set log level (warn,info,debug,trace)
189  -c/--config* : set a custom skel user config
190  -i/--input* : input source
191  -o/--output* : output target
192 
193 commands:
194  init : initialize a skelfile in the current directory
195  -n/--name*
196  -n/--name
197  -d/--description*
198  -p/--project name
199  -k/--kind*
200  -s/--string*
201  new : make a new skel project
202  -n/--name : project name
203  describe : describe a skelfile
204  show : show project slots
205  -f/--file : path to skelfile
206  -u/--user : print user configuration
207  -s/--system : print system configuration
208  vc : version control
209  -r/--root : repository path
210  id : print the project id
211  inspect : inspect the project skelfile
212  -f/--file : path to skelfile
213  make : build project targets
214  -t/--target : target to build
215  run : run a script or command
216  compile : compile source code
217  build : build programs and libraries
218  dist : distribute build artifacts
219  install : install stuff
220  pack : pack stuff
221  unpack : unpack stuff
222  bundle : bundle source code
223  unbundle : unbundle source code
224  clean : clean up the project
225  test : run tests
226  bench : run benchmark
227  status : print the vc status
228  push : push the current project upstream
229  pull : pull the current project from remote
230  clone : clone a remote project
231  commit : commit changes to the project vc
232  edit : edit a project file in emacs.
233  shell : open the sk-shell interpreter
234 
235 #+end_example
236