dot

packages and services management
Log | Files | Refs | README

commit dd7964a5a8dcefcf9c38816d9f37e6463f663dde
parent 72b3ea4a82ecdc50b1ba71ca4ff0dfaffa440e74
Author: Josuah Demangeon <mail@josuah.net>
Date:   Tue, 28 Nov 2017 00:29:40 +0100

moving scripts to srv/

Diffstat:
Dbin/git-gph | 24------------------------
Dbin/git-html | 44--------------------------------------------
Dbin/gph-html | 79-------------------------------------------------------------------------------
Mpackage/quark/config.h | 6+++---
4 files changed, 3 insertions(+), 150 deletions(-)

diff --git a/bin/git-gph b/bin/git-gph @@ -1,24 +0,0 @@ -#!/bin/sh -# add index.gph and commit/%H inside of a git bare repository - -export LC_COLLATE=C - -NAME=$(cd "$1" && pwd | sed -e 's|.*/||') - -{ - printf '\n [ %s ]\n\n' "$NAME" - git -C "$1" ls-tree -r --name-only master | sort | sed -e 's|^| |' - printf '\n\n' - git -C "$1" log --graph --date=short --decorate --tags --stat \ - --branches --remotes | - sed -r -e '/[0-9a-f]{40}/ s/\|/\\&/g' \ - -e 's/.*([0-9a-f]{40}).*/[0|&|\/commit\/\1|server|port]/' -} > "$1/index.gph" - -mkdir -p "$1/commit" -for commit in $(git -C "$1" log --format='%H') -do - [ -f "$1/commit/$commit" ] && continue - printf '%s\n' "$commit" - git -C "$1" show -U3 "$commit" > "$1/commit/$commit" -done diff --git a/bin/git-html b/bin/git-html @@ -1,44 +0,0 @@ -#!/bin/sh -# add index.html and commit/%H.html inside of a git bare repository - -export LC_COLLATE=C - -NAME=$(cd "$1" && pwd | sed 's|.*/||') -HEADER="<!doctype html> -<title>$NAME</title> -<meta charset=\"utf-8\"/> -<style> pre { width: 80ch; margin: 4em auto 4em auto; } </style> -<pre> -<h1><a href=\"..\">..</a>/$NAME</h1> -<b>GIT_SMART_HTTP=0 git clone http://git.josuah.net/$NAME</b> -" - -{ - printf '%s\n\n' "$HEADER" - git -C "$1" ls-tree -r --name-only master | sort | sed 's|^| |' - printf '\n\n' - git -C "$1" log --graph --date=short --decorate --tags --stat \ - --branches --remotes | - sed -r -e 's|&|\&amp;|g' \ - -e 's|<|\&lt;|g' \ - -e 's|[0-9a-f]{40}|<a href="commit/&.html">&</a>|' - printf '</pre>\n' -} > "$1/index.html" - -mkdir -p "$1/commit" -for commit in $(git -C "$1" log --format='%H') -do - [ -f "$1/commit/$commit.html" ] && continue - printf '%s\n' "$commit" - printf '%s\n' "$HEADER" > "$1/commit/$commit.html" - git -C "$1" show -U3 "$commit" | sed >> "$1/commit/$commit.html" \ - -e ' s|&|\&amp;|g' \ - -e ' s|<|\&lt;|g' \ - -e ' s|^[A-Z][a-z]*:|<b>&</b>|' \ - -e '/^commit/ s|.*|<b>&</b>|' \ - -e '/^diff/ s|.*|<b>&</b>|' \ - -e '/^+/ s|.*|<span style="color: #0e0;">&</span>|' \ - -e '/^-/ s|.*|<span style="color: #e00;">&</span>|' \ - -e '/^@/ s|.*|<span style="color: #00e;">&</span>|' - printf '</pre>\n' >> "$1/commit/$commit.html" -done diff --git a/bin/gph-html b/bin/gph-html @@ -1,79 +0,0 @@ -#!/bin/sh -# convert all *.gph in current directory to html - -FILENAME="$(cd "${1%/*}" && pwd)/${1##*/}" - -cat << 'EOF' > "${FILENAME%.gph}.html" -<!doctype html> -<link rel="stylesheet" href="/style.css" type="text/css"/> -<link rel="icon" href="/favicon.png" type="image/png"/> -<meta charset="utf-8"> -EOF - -awk ' - -function esc(str) -{ - gsub("&", "\\&amp;", str); - gsub("<", "\\&lt;", str); - gsub(">", "\\&gt;", str); - gsub("\"", "\\&quote;", str); - return str; -} - -function url(f) -{ - if (f[4] == "server" || f[4] == "") - f[4] = ""; - else if (f[1] == "0" || f[1] == "1") - f[4] = "http://" f[4]; - if (f[5] == "port" || f[5] == "") - f[5] = ""; - else - f[5] = ":" f[5]; - return sprintf("%s%s%s", f[4], f[5], f[3]); -} - -function link(type, f) -{ - return sprintf("<a href=\"%s\">[%s]</a> %s", url(f), type, esc(f[2])); -} - -FNR == 1 { - sub("/[^/]*$", "", FILENAME); - sub(".*/", "", FILENAME); - print("<pre>"); - printf("<h1>%s</h1>\n", FILENAME); -} - -/^[^[]/ { - sub("^t", ""); - printf(" %s\n", esc($0)); - next; -} - -{ - sub("^\\[", "", $0); - sub("\\]$", "", $0); - split($0, f, "|"); -} - -f[1] == "i" { - printf(" %s\n", esc(f[2])); - next; -} - -f[1] == "0" { print(link("file", f)); next; } -f[1] == "1" { print(link("dir/", f)); next; } -f[1] == "8" { print(link("tnet", f)); next; } -f[1] == "h" { print(link("link", f)); next; } - -f[1] == "g" || f[1] == "I" { - printf("<img alt=\"%s\" src=\"%s\"/>", esc(f[2]), url(f)); - next; -} - -END { - print("</pre>"); -} -' "$FILENAME" >> "${FILENAME%.gph}.html" diff --git a/package/quark/config.h b/package/quark/config.h @@ -19,10 +19,10 @@ static struct { const char *dir; regex_t re; } vhost[] = { - /* canonical host host regex directory */ - { "josuah.net", "^josuah\\.net$", "josuah.net" }, + /* canonical host host regex directory */ + { "josuah.net", "^josuah\\.net$", "." }, { "git.josuah.net", "^git\\.josuah\\.net$", "git" }, - { "cyberia.systems", "^cyberia\\.systems", "cyberia.systems" }, + { "cyberia.systems", "^cyberia\\.systems", "cyb" }, }; /* mime-types */