dot

packages and services management
Log | Files | Refs | README

commit 417d4e6e76234a164463b29fde7728fa5034500c
parent 8a0894cd9a43fc7688d0a320b525093dd141d6fa
Author: josuah <mail@josuah.net>
Date:   Mon, 20 Feb 2017 02:36:06 +0100

Adding gix

Diffstat:
M.config/git/config | 2+-
M.profile | 1-
MREADME | 12+++++++-----
Mbin/build | 2+-
Abin/gix | 163+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 172 insertions(+), 8 deletions(-)

diff --git a/.config/git/config b/.config/git/config @@ -19,7 +19,7 @@ p = push u = pull s = status -s -b - l = log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n" + l = log --graph --color acp = !git a && git c && git p acpa = !git a && git c --amend && git p --force diff --git a/.profile b/.profile @@ -18,7 +18,6 @@ export MAIL="$HOME/mail/INBOX" # default commands export EDITOR='vis' VISUAL="$EDITOR" FCEDIT="$EDITOR" -export PAGER='iode +RN' MANPAGER='iode +R' # dvtm export DVTM_TERM='screen' diff --git a/README b/README @@ -1,7 +1,7 @@ case "$1" in -( l | link ) # link the dotfiles in this directory +( l | link ) cd "${0%/*}" || exit 1 @@ -15,13 +15,15 @@ case "$1" in ;; -( g | git ) # my other projects +( g | git ) - mkdir -p ~/src && cd ~/src || exit + mkdir -p ~/git && cd ~/git || exit git clone ssh://repo.or.cz/iomenu.git + + git clone http://github.com/josuah/www ~/www & + git clone http://github.com/josuah/iode & - git clone http://github.com/josuah/www & git clone http://github.com/josuah/madown & git clone http://github.com/josuah/cgr & git clone http://github.com/josuah/build & @@ -34,7 +36,7 @@ case "$1" in ;; -( m | mail ) # setup mail credentials +( m | mail ) mkdir -p "$MAIL/cur" "$MAIL/new" "$MAIL/tmp" diff --git a/bin/build b/bin/build @@ -78,7 +78,7 @@ compile() export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 - export CFLAGS="-I $LOCAL/include -L$LOCAL/lib" + export CFLAGS="-I $LOCAL/include -L$LOCAL/lib -static" [ -f "$script" ] || [ -h "$script" ] || error "$name" "no build script" . "$script" diff --git a/bin/gix b/bin/gix @@ -0,0 +1,163 @@ +# 1: path to the root +# 2: title of the page + +head() +{ + printf '<!DOCTYPE html> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>%s</title> +<link rel="icon" type="image/png" href="favicon.png" /> +<link rel="alternate" type="application/atom+xml" title="stagit.git Atom Feed" href="atom.xml" /> +<link rel="stylesheet" type="text/css" href="style.css" /> +</head> + +<body>' +} + + +foot() +{ + printf '</body> +</html> +' +} + + +log() +{ + printf '<table>\n<thead>\n<tr>' + printf '<th>%s</th>' 'Date' 'Hash' 'Commit Message' 'Author' + printf '</tr>\n</thead>\n<tbody>\n' + + git log --pretty=format:"<tr>$( + printf '<td>%s</td>' \ + '%ad' '<a href="commit/%H.html">%h</a>' '%s' '%an' + )</tr>" --date=format:'%y-%m-%d %H:%M' + + printf '\n</tbody>\n</table>\n' +} + + +# 1: long hash of the commit + +commit() +{ + git show -s --pretty=format:'<pre> +<b>commit</b> <a href="%H.html">%H</a> +<b>parent</b> <a href="%P.html">%P</a> +<b>author</b> %an &lt;<a href="mailto:%ae">%ae</a>&gt; +<b>date</b> %aD +</pre>' "$1" + + printf '<hr/>' + printf '<pre>\n' + + git diff "$1" | sed ' + /^diff/ { + s|a/\([^ ]*\)|a/<a href="../files/\1">\1</a>| + s|b/\([^ ]*\)|b/<a href="../files/\1">\1</a>| + s|.*|<b>&</b>| + } + /^+/ s|.*|<span style="color: green;">&</span>| + /^-/ s|.*|<span style="color: red;">&</span>| + ' + + printf '</pre>\n' +} + + +# 1: target base directory + +commits() +{ + git log --pretty=format:'%H' | while IFS='' read -r hash + do + (head; commit "$hash"; foot) > "$1/commit/$hash.html" + done +} + + +# 1: path to the file to process. + +file() +{ + printf '<table><tr><td><pre>\n' + + if grep -qI . "$file" 1>/dev/null + then + seq "$(wc -l "$file")" | sed 's|.*|<a href="#&">&</a>|' + + printf '</td><td>' + + cat "$file" + else + printf 'binary file' + fi + + printf '</pre></td></tr></table>' +} + + +# 1: target base directory + +files() +{ + git ls-files | while IFS='' read -r file + do + [ -z "${file##*/*}" ] && mkdir -p "$1/files/${1%/*}" + (head; file "$file"; foot) > "$1/files/$1/$file" + + printf '<tr>' + printf '<td>%s</td>' \ + "$(stat %A)" "<a href=\"$file\">$file</a>" + printf '</tr>' + done +} + + +# 1: target base directory +# 2: repository to process + +repo() +{ + (head; log; foot) > $1/$2/index.html + (head; files "$1"; foot) > $1/$2/files.html + + mkdir -p commit +} + + +# 1: source git directory + +list() +{ + printf '<table>\n' + + find "$1" -maxdepth 1 -mindepth 1 -type d | sort | + while IFS='' read -r repo + do + set -- "$(pwd)" + + mkdir -p "${repo##*/}" + (cd "$repo" && repo "$1" "${repo##*/}" || exit 1) + + printf '<tr>' + printf '<td>%s</td>' \ + "<a href=\"${repo##*/}\">${repo##*/}</a>" \ + "$(cat "$1/.git/description")" + printf '</tr>\n' + done + + printf '</table>\n' +} + + +main() +{ + list "${1%/}" > index.html +} + + +main "$@"