Buildapp scaffold
This commit is contained in:
parent
6ab3081beb
commit
cfbd8a6288
7 changed files with 136 additions and 6 deletions
81
Makefile
Normal file
81
Makefile
Normal file
|
@ -0,0 +1,81 @@
|
|||
APP_NAME = coleslaw
|
||||
VERSION_FILE := version.lisp-expr
|
||||
VERSION := $(shell cat ${VERSION_FILE})
|
||||
|
||||
# use either sbcl or ccl
|
||||
CL = sbcl
|
||||
|
||||
# default to 4096 MB of RAM size in the image
|
||||
DYNSIZE = 4096
|
||||
|
||||
LISP_SRC = $(wildcard src/*lisp) \
|
||||
coleslaw-cli.asd \
|
||||
coleslaw.asd
|
||||
|
||||
BUILDDIR = build
|
||||
LIBS = $(BUILDDIR)/libs.stamp
|
||||
QLDIR = $(BUILDDIR)/quicklisp
|
||||
MANIFEST = $(BUILDDIR)/manifest.ql
|
||||
|
||||
BUILDAPP = $(BUILDDIR)/bin/buildapp.sbcl
|
||||
CL_OPTS = --no-sysinit --no-userinit
|
||||
|
||||
BUILDAPP_OPTS = --require sb-posix \
|
||||
--require sb-bsd-sockets \
|
||||
--require sb-rotate-byte
|
||||
|
||||
COLESLAW = $(BUILDDIR)/bin/$(APP_NAME)
|
||||
|
||||
clean:
|
||||
rm -rf $(LIBS) $(QLDIR) $(MANIFEST) $(BUILDAPP) $(COLESLAW)
|
||||
|
||||
$(QLDIR)/setup.lisp:
|
||||
mkdir -p $(BUILDDIR)
|
||||
curl -o $(BUILDDIR)/quicklisp.lisp https://beta.quicklisp.org/quicklisp.lisp
|
||||
$(CL) $(CL_OPTS) --load $(BUILDDIR)/quicklisp.lisp \
|
||||
--eval '(quicklisp-quickstart:install :path "$(BUILDDIR)/quicklisp")' \
|
||||
--eval '(quit)'
|
||||
|
||||
quicklisp: $(QLDIR)/setup.lisp ;
|
||||
|
||||
$(LIBS): $(QLDIR)/setup.lisp
|
||||
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
|
||||
--eval '(push "$(PWD)/" asdf:*central-registry*)' \
|
||||
--eval '(ql:quickload "coleslaw-cli")' \
|
||||
--eval '(quit)'
|
||||
touch $@
|
||||
|
||||
libs: $(LIBS) ;
|
||||
|
||||
$(MANIFEST): $(LIBS)
|
||||
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
|
||||
--eval '(ql:write-asdf-manifest-file "$(MANIFEST)")' \
|
||||
--eval '(quit)'
|
||||
|
||||
manifest: $(MANIFEST) ;
|
||||
|
||||
$(BUILDAPP): $(QLDIR)/setup.lisp
|
||||
mkdir -p $(BUILDDIR)/bin
|
||||
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
|
||||
--eval '(ql:quickload "buildapp")' \
|
||||
--eval '(buildapp:build-buildapp "$@")' \
|
||||
--eval '(quit)'
|
||||
|
||||
buildapp: $(BUILDAPP) ;
|
||||
|
||||
$(COLESLAW): $(MANIFEST) $(BUILDAPP) $(LISP_SRC)
|
||||
mkdir -p $(BUILDDIR)/bin
|
||||
$(BUILDAPP) --logfile /tmp/build.log \
|
||||
$(BUILDAPP_OPTS) \
|
||||
--sbcl $(CL) \
|
||||
--asdf-path . \
|
||||
--manifest-file $(MANIFEST) \
|
||||
--asdf-tree $(QLDIR)/dists \
|
||||
--asdf-path . \
|
||||
--load-system $(APP_NAME) \
|
||||
--load-system coleslaw-cli \
|
||||
--entry coleslaw-cli:main \
|
||||
--output $@
|
||||
|
||||
|
||||
coleslaw: $(COLESLAW) ;
|
5
build/.gitignore
vendored
Normal file
5
build/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!bin
|
||||
!.gitignore
|
4
build/bin/.gitignore
vendored
Normal file
4
build/bin/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
10
coleslaw-cli.asd
Normal file
10
coleslaw-cli.asd
Normal file
|
@ -0,0 +1,10 @@
|
|||
(defsystem #:coleslaw-cli
|
||||
:name "coleslaw-cli"
|
||||
:description "CLI tools for Coleslaw"
|
||||
:version (:read-file-from "version.lisp-expr")
|
||||
:license "BSD"
|
||||
:author "Javier Olaechea <pirata@gmail.com"
|
||||
:pathname "src/"
|
||||
:serial t
|
||||
:depends-on (#:coleslaw)
|
||||
:components ((:file "cli")))
|
|
@ -1,7 +1,7 @@
|
|||
(defsystem #:coleslaw
|
||||
:name "coleslaw"
|
||||
:description "Flexible Lisp Blogware"
|
||||
:version "0.9.7"
|
||||
:version (:read-file-form "version.lisp-expr")
|
||||
:license "BSD"
|
||||
:author "Brit Butler <redline6561@gmail.com>"
|
||||
:pathname "src/"
|
||||
|
@ -25,13 +25,13 @@
|
|||
(:file "posts")
|
||||
(:file "indexes")
|
||||
(:file "feeds")
|
||||
(:file "coleslaw")
|
||||
(:file "cli"))
|
||||
(:file "coleslaw"))
|
||||
:in-order-to ((test-op (load-op coleslaw-tests)))
|
||||
:perform (test-op :after (op c)
|
||||
(funcall (intern "RUN!" :coleslaw-tests)
|
||||
(intern "COLESLAW-TESTS" :coleslaw-tests))))
|
||||
|
||||
|
||||
(defsystem #:coleslaw-tests
|
||||
:description "A test suite for coleslaw."
|
||||
:license "BSD"
|
||||
|
|
35
src/cli.lisp
35
src/cli.lisp
|
@ -1,10 +1,11 @@
|
|||
(defpackage #:coleslaw-cli
|
||||
(:use :cl)
|
||||
(:use #:cl)
|
||||
(:documentation "CLI processing tools.")
|
||||
(:export
|
||||
#:process-parameters))
|
||||
#:process-parameters
|
||||
#:main))
|
||||
|
||||
(in-package :coleslaw-cli)
|
||||
(in-package #:coleslaw-cli)
|
||||
|
||||
(defun process-parameters (argv)
|
||||
"Return an alist where the key is the option name and the value the
|
||||
|
@ -21,3 +22,31 @@
|
|||
(second argv)
|
||||
alist))))))
|
||||
(%iter argv nil)))
|
||||
|
||||
(defparameter *usage*
|
||||
"Usage: coleslaw <command> [--config <path-to-config>]
|
||||
|
||||
OPTIONS
|
||||
|
||||
--config
|
||||
The coleslaw configuration file to use.
|
||||
|
||||
|
||||
COMMANDS
|
||||
|
||||
build
|
||||
build the site
|
||||
|
||||
clean
|
||||
remove all the generated files.
|
||||
|
||||
rebuild
|
||||
The equivalent of calling clean and build.
|
||||
|
||||
serve
|
||||
Start a web server
|
||||
")
|
||||
|
||||
(defun main (argv)
|
||||
"The CLI entry point."
|
||||
(format t "~A~%" *usage*))
|
||||
|
|
1
version.lisp-expr
Normal file
1
version.lisp-expr
Normal file
|
@ -0,0 +1 @@
|
|||
"0.9.7"
|
Loading…
Add table
Reference in a new issue