#!/bin/bash # # Generates an RSS feed from Git commit messages # # Copyright (C) 2012 Mike Gerwitz # # This file is part of repo2html. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # repotype="${1?Missing repository type}" url="${2?Missing URL}" count=10 # rss header cat < Mike Gerwitz's Thoughts and Ramblings $url The miscellaneous thoughts and ramblings of a free software hacker EOH # output recent commits as entries (assuming no funny business in the output) while read hash commit ts id subject; do # ignore commits that begin with ':' [[ "$subject" == :* ]] && { echo "[RSS] Ignoring $commit: $subject" >&2 continue } echo "[RSS] Found $commit: $subject" >&2 # TODO: avoid HTML entities where browsers may decide not to render them (e.g. # the title) cat < <![CDATA[$( ./msgfmt < <( echo "$subject"; echo ) )]]> $( printf "%s/%s/%s.html" \ "${url/%\/}" "$( ./tsdate "$ts" %Y/%m )" "$id" ) $( ./tsdate "$ts" %Y-%m-%d ) EOE done # footer cat < EOF