diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-09-10 23:25:10 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-09-10 23:25:10 +0200 |
| commit | 0afbfaee75e8480e8e0ed0a3bbd3749a4756f727 (patch) | |
| tree | f9e4d91866060661d53c50c66973fcd20600983f /_posts/2009-04-14-git-and-prove.textile | |
| download | lumberjaph-0afbfaee75e8480e8e0ed0a3bbd3749a4756f727.tar.gz | |
initial import
Diffstat (limited to '_posts/2009-04-14-git-and-prove.textile')
| -rw-r--r-- | _posts/2009-04-14-git-and-prove.textile | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/_posts/2009-04-14-git-and-prove.textile b/_posts/2009-04-14-git-and-prove.textile new file mode 100644 index 0000000..fca6329 --- /dev/null +++ b/_posts/2009-04-14-git-and-prove.textile @@ -0,0 +1,31 @@ +--- +layout: post +category: app +title: git and prove +--- + +A little trick to force you to run your tests before a commit: + +in a repositorie, create the following file *.git/hooks/pre-commit* with this content: + +{% highlight bash %} +#!/bin/sh +if [ -d t ]; then + res=`prove t` + if [ $? -gt 0 ]; then + echo "tests fails" + exit 1 + fi +fi +if [ -d xt ]; then + res=`prove xt` + if [ $? -gt 0 ]; then + echo "tests fails" + exit 1 + fi +fi +{% endhighlight %} + +and don't forget to chmod with +x. + +Now, when you will do your next commit, your test suit will be executed. If the tests fails, the commit will be rejected. |
