aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile24
-rwxr-xr-xscripts/docker.bash32
2 files changed, 51 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 0845f14..7f72a5f 100644
--- a/Makefile
+++ b/Makefile
@@ -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"