From 8ddf2e94df70707b458528a437759b96046d3e01 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 26 Nov 2013 10:36:10 -0800 Subject: Huge update. Moved all posts from textile to markdown. Updated all the CSS and styles. Added a new page for the resume. --- _posts/2009-04-14-git-and-prove.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 _posts/2009-04-14-git-and-prove.md (limited to '_posts/2009-04-14-git-and-prove.md') diff --git a/_posts/2009-04-14-git-and-prove.md b/_posts/2009-04-14-git-and-prove.md new file mode 100644 index 0000000..60c8740 --- /dev/null +++ b/_posts/2009-04-14-git-and-prove.md @@ -0,0 +1,31 @@ +--- +layout: post +summary: In which I add a hook to git to run my tests. +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 sh %} +#!/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. -- cgit v1.2.3