Add example
authorJoachim Breitner <mail@joachim-breitner.de>
Tue, 13 Jan 2015 13:27:38 +0000 (14:27 +0100)
committerJoachim Breitner <mail@joachim-breitner.de>
Tue, 13 Jan 2015 13:27:38 +0000 (14:27 +0100)
.gitignore
example/genexample.sh [new file with mode: 0755]
example/genlogs.sh [new file with mode: 0755]
example/log2csv [new file with mode: 0755]
example/settings.yaml [new file with mode: 0644]

index 0bcd42d..04dcf7b 100644 (file)
@@ -1,6 +1,8 @@
 src/*.o
 src/*.hi
 gipeda
+example/site
+example/src
 site/out
 .shake.database
 site/js/Hasheor
diff --git a/example/genexample.sh b/example/genexample.sh
new file mode 100755 (executable)
index 0000000..de398e1
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+ln -sf ../.git repository
+ln -sf ../gipeda gipeda
+ln -sf ../src src
+
+./genlogs.sh
+
+mkdir -p site/js
+../install-jslibs.sh
+
+cp ../site/index.html site/index.html
+cp ../site/js/gipeda.js site/js/gipeda.js
+
+./gipeda
diff --git a/example/genlogs.sh b/example/genlogs.sh
new file mode 100755 (executable)
index 0000000..13e8ca6
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+if [ -e tmp ]
+then
+       echo "Please remove tmp/ first"
+       exit 1
+fi
+
+mkdir -p logs
+
+for hash in $(git -C repository log --format=%H)
+do
+       mkdir tmp/
+       git -C repository archive $hash | tar -x -C tmp/
+       ohcount tmp/ > logs/$hash.log
+       rm -rf tmp
+done
diff --git a/example/log2csv b/example/log2csv
new file mode 100755 (executable)
index 0000000..6ef99fa
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use File::Basename;
+use File::Slurp;
+use IPC::Run qw/run/;
+
+for my $filename (@ARGV) {
+       my $log = read_file($filename);
+
+       for (split /^/, $log) {
+               printf "loc/haskell;$1\n"
+                       if (m/^haskell\s+\d+\s+(\d+)/);
+               printf "loc/JavaScript;$1\n"
+                       if (m/^javascript\s+\d+\s+(\d+)/);
+               printf "loc/HTML;$1\n"
+                       if (m/^html\s+\d+\s+(\d+)/);
+               printf "loc/CSS;$1\n"
+                       if (m/^css\s+\d+\s+(\d+)/);
+               printf "comment-rate;$1\n"
+                       if (m/^Total\s+\d+\s+\d+\s+\d+\s+([\d\.]+)%/);
+       }
+}
diff --git a/example/settings.yaml b/example/settings.yaml
new file mode 100644 (file)
index 0000000..d15fb1b
--- /dev/null
@@ -0,0 +1,18 @@
+title: Gipeda itself
+cgitLink: https://github.com/nomeata/gipeda/commit/
+logLink: https://raw.githubusercontent.com/nomeata/ghc-speed-logs/master/{{rev}}.log
+limitRecent: 20
+start: 65b3eede043ff5d4718724d220a82bbc8adc3280
+
+benchmarks:
+  - match: "*"
+    smallerIsBetter: False
+    threshold: 1
+    type: integral
+    group: (ungrouped)
+  - match: "loc/*"
+    unit: lines of code
+    group: Lines of Code
+  - match: comment-rate
+    unit: percentags
+    group: Code quality