dot

packages and services management
Log | Files | Refs | README

commit f1473dd5f3e13ec1c2a6cfc10a7cb74147596d61
parent 7d41d9392d583d217e569183369ba617893a29cf
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Sun, 30 Jul 2017 16:32:39 +0200

Merge branch 'master' of http://github.com/josuah/etc

Diffstat:
Mmonitor/bin/monitor | 2++
Mscripts/bin/www-git | 36+++++++++++++++++++++++++-----------
2 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/monitor/bin/monitor b/monitor/bin/monitor @@ -87,6 +87,8 @@ o() { printf '\n\n[ %s ]\n\n' "$*"; } o storage printf %s "$storv" | plot -h 30 + printf '\n\n\t' + date } > "$VAR/stat/graph" exec "$0" "$@" diff --git a/scripts/bin/www-git b/scripts/bin/www-git @@ -1,6 +1,19 @@ NAME="${1##*/}" -HEADER='<!doctype html><html><head><meta charset="utf-8"/></head><body><pre>' -FOOTER='</pre></body></html>' +HEADER='<!doctype html><html> +<head> +<meta charset="utf-8"/> +<style> pre { float: left; margin: 4em; } </style> +</head> +<body> +<pre> +<h1><a href="..">&lt;</a> '"$NAME"'</h1> + +' + +FOOTER=' +</pre> +</body> +</html>' mkdir -p "git/$NAME/commit" "git/$NAME/file" cd "git/$NAME" || exit 1 @@ -9,7 +22,7 @@ cd "git/$NAME" || exit 1 # --- ./index.html --------------------------------------------------------------- { - printf '%s <h1><a href="..">&lt;</a> %s</h1>' "$HEADER" "$NAME" + printf '%s\n' "$HEADER" git -C "$1" ls-files | sort | awk -F '\0' '{ gsub(/&/, "&amp;", $0) @@ -20,26 +33,27 @@ cd "git/$NAME" || exit 1 count = split($0, line, "/") for (i = 1; i <= count; i++) { if (line[i] != prev[i] || subtree) { - subtree - printf "%s`-- <a href=\"%s\">%s</a>\n", margin, line[i], line[i] + printf "%s`-- <a href=\"file/%s\">%s</a>\n", \ + margin, $0, line[i] + subtree = 1 } margin = margin "| " prev[i] = line[i] } - }' "$@" + }' - printf '<hr/>\n' + printf '</pre><pre>' git -C "$1" log --graph --date=short \ - --format='{%% %H %%} %cd%d%n%cn <%ce>%n%n %s' | + --format='%H %cd%d %cn <%ce>%n%n%s%n%n' | sed -r ' s|&|\&amp;|g s|<|\&lt;|g - s|\{% ([0-9a-f]+) %\}|<a href="commit/\1.html">\1</a>| + s|([0-9a-f]{8})([0-9a-f]{32})|<a href="commit/\1\2.html">\1</a>| ' - printf '%s\n' "$FOOTER" + printf %s "$FOOTER" } > index.html @@ -55,7 +69,7 @@ do done -# --- ./commits/ ------------------------------------------------------------------ +# --- ./commit/ ------------------------------------------------------------------- for commit in $(git -C "$1" log --format='%H') do