# - mkdir -p htmldir && cd htmldir
# - sh example.sh
-set -e
-
-reposdir="/var/www/domains/git.codemadness.nl/home/src/"
+# path must be absolute.
+reposdir="/var/www/domains/git.codemadness.nl/home/src"
curdir=$(pwd)
# make index.
-cd "${reposdir}"
-find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs stagit-index > "${curdir}/index.html"
+stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
# make files per repo.
-find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
- cd "${reposdir}"
- d=$(basename "${dir}")
-
- printf "%s..." "${d}"
- cd "${curdir}"
-
- test -d "${d}" || mkdir -p "${d}"
- cd "${d}"
- stagit "${reposdir}${d}"
+for dir in "${reposdir}/"*/; do
+ # strip .git suffix.
+ r=$(basename "${dir}")
+ d=$(basename "${dir}" ".git")
+ printf "%s... " "${d}"
- printf " done\n"
+ mkdir -p "${curdir}/${d}"
+ cd "${curdir}/${d}"
+ stagit -c ".cache" "${reposdir}/${r}"
# symlinks
ln -sf log.html index.html
ln -sf ../style.css style.css
ln -sf ../logo.png logo.png
ln -sf ../favicon.png favicon.png
+
+ printf "done\n"
done