diff options
| author | Radon Rosborough <radon.neon@gmail.com> | 2019-07-10 22:06:18 -0700 |
|---|---|---|
| committer | Radon Rosborough <radon.neon@gmail.com> | 2019-07-10 22:06:18 -0700 |
| commit | 9ed9d2760d9a564eb4d7d96beb83d0840c690adf (patch) | |
| tree | a18e3486d685037d135cedc7253dd975440e22be | |
| parent | 99e24051b857393e513cd1c1b38d38af176e8891 (diff) | |
Add Docker and improve Makefile
| -rw-r--r-- | Makefile | 24 | ||||
| -rwxr-xr-x | scripts/docker.bash | 32 |
2 files changed, 51 insertions, 5 deletions
@@ -1,4 +1,5 @@ EMACS ?= emacs +VERSION ?= latest # The order is important for compilation. for_compile := *.el @@ -6,10 +7,10 @@ for_checkdoc := *.el for_longlines := $(wildcard *.el *.md *.yml) Makefile .PHONY: all -all: compile checkdoc longlines +all: compile checkdoc longlines ## Build project and run all linters .PHONY: compile -compile: +compile: ## Check for byte-compiler errors @for file in $(for_compile); do \ echo "[compile] $$file" ;\ $(EMACS) -Q --batch -L . -f batch-byte-compile $$file 2>&1 \ @@ -18,7 +19,7 @@ compile: done .PHONY: checkdoc -checkdoc: +checkdoc: ## Check for missing or poorly formatted docstrings @for file in $(for_checkdoc); do \ echo "[checkdoc] $$file" ;\ $(EMACS) -Q --batch \ @@ -29,7 +30,7 @@ checkdoc: done .PHONY: longlines -longlines: +longlines: ## Check for lines longer than 79 characters @echo "[longlines] $(for_longlines)" @for file in $(for_longlines); do \ cat "$$file" \ @@ -41,6 +42,19 @@ longlines: done .PHONY: clean -clean: +clean: ## Remove build artifacts @echo "[clean]" *.elc @rm -f *.elc + +.PHONY: docker +docker: ## Start a Docker shell with source code and given Emacs VERSION + @scripts/docker.bash $(VERSION) + +.PHONY: help +help: ## Show this message + @echo "usage:" >&2 + @grep -h "[#]# " $(MAKEFILE_LIST) | \ + sed 's/^/ make /' | \ + sed 's/:[^#]*[#]# /|/' | \ + sed 's/%/LANG/' | \ + column -t -s'|' >&2 diff --git a/scripts/docker.bash b/scripts/docker.bash new file mode 100755 index 0000000..d9000b2 --- /dev/null +++ b/scripts/docker.bash @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +if [[ -z "$1" ]]; then + echo "docker.sh: no tag provided" 1>&2 + exit 1 +else + tag="$1" +fi + +docker() { + if [[ "$OSTYPE" != darwin* ]] && [[ "$EUID" != 0 ]]; then + command sudo docker "$@" + else + command docker "$@" + fi +} + +script="$(cat <<"EOF" + +apt-get update +apt-get install -y bsdmainutils make +cd /src +make help +exec bash + +EOF +)" + +docker run -it --rm -v "$PWD:/src" silex/emacs:"$tag" bash -c "$script" |
