diff options
| author | Franck Cuny <franckcuny@gmail.com> | 2016-07-31 10:16:40 -0700 |
|---|---|---|
| committer | Franck Cuny <franckcuny@gmail.com> | 2016-07-31 13:42:48 -0700 |
| commit | 63f413891d5adc596e4d51dfba4d0d23fdea3ca4 (patch) | |
| tree | c2726b60515057a20f434bd89c596360ef17852b /posts/2009-04-14-git-and-prove.md | |
| parent | Add Google Analytic tracker. (diff) | |
| download | lumberjaph-63f413891d5adc596e4d51dfba4d0d23fdea3ca4.tar.gz | |
Stop generating a static site.
Diffstat (limited to 'posts/2009-04-14-git-and-prove.md')
| -rw-r--r-- | posts/2009-04-14-git-and-prove.md | 25 |
1 files changed, 25 insertions, 0 deletions
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..4688189 --- /dev/null +++ b/posts/2009-04-14-git-and-prove.md @@ -0,0 +1,25 @@ +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: + +```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 +``` + +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. |
