summaryrefslogtreecommitdiff
path: root/summary.sh
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2010-10-23 23:53:06 +0100
committerNick White <git@njw.me.uk>2010-10-23 23:53:06 +0100
commit75645602dd70f079ccf550bb5e90dffc21693429 (patch)
tree82131524085a56fc9b8ba340c98696c80e062eae /summary.sh
parentb5fdff68dec57116a092b08a99f1f4504da8881c (diff)
Update to run in a function, lots of doc additions
- Updated readable to run from one function, so returns work nicely now, and things are generally cleaner. - Added a readme - Added a doap rdf file - Added webpage generation to the makefile
Diffstat (limited to 'summary.sh')
-rw-r--r--summary.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/summary.sh b/summary.sh
new file mode 100644
index 0000000..453b25f
--- /dev/null
+++ b/summary.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+test $# -ne 1 && echo "usage: $0 doap" && exit 1
+
+rdf="$1"
+
+q="PREFIX doap: <http://usefulinc.com/ns/doap#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+SELECT ?home ?repo ?license ?maintainer ?maintainerhome ?lang
+WHERE {
+?p a doap:Project;
+ doap:homepage ?home;
+ doap:repository ?r;
+ doap:license ?license;
+ doap:programming-language ?lang;
+ doap:maintainer ?m.
+?r doap:location ?repo.
+?m foaf:name ?maintainer;
+ foaf:homepage ?maintainerhome.
+}"
+
+roqet -q -r csv -e "$q" -D /dev/stdin < $rdf | sed '/^Result/d' \
+| while read r; do
+ home=`echo $r | awk -F , '{print $2}'| sed -e 's/uri(\(.*\))/\1/'`
+ repo=`echo $r | awk -F , '{print $3}'| sed -e 's/uri(\(.*\))/\1/'`
+ licenseuri=`echo $r | awk -F , '{print $4}'| sed -e 's/uri(\(.*\))/\1/'`
+ maint=`echo $r | awk -F , '{print $5}'| sed -e 's/"\(.*\)"/\1/'`
+ mainthome=`echo $r | awk -F , '{print $6}'| sed -e 's/uri(\(.*\))/\1/'`
+ lang=`echo $r | awk -F , '{print $7}'| sed -e 's/"\(.*\)"/\1/'`
+ test "$licenseuri" = "http://www.gnu.org/licenses/gpl.html" && license="GPL"
+ test "$licenseuri" = "http://www.gnu.org/licenses/agpl.html" && license="AGPL"
+ test "$licenseuri" = "http://creativecommons.org/licenses/MIT/" && license="MIT"
+
+ cat <<- _EOF_
+- Project homepage: [$home]($home)
+- Code repository: [$repo]($repo)
+- Maintainer: [$maint]($mainthome)
+- Language: $lang
+- License: [$license]($licenseuri)
+_EOF_
+done