aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJez Ng2012-07-26 03:53:34 -0700
committerJez Ng2012-07-26 03:56:05 -0700
commit492c920082d31749aec5b201802e47d0e90263e7 (patch)
tree82e144513936d24a6ab76252bb8696386b5ac285
parente124536b675be48937c373bcf602b11e02ab87f8 (diff)
downloadvimium-492c920082d31749aec5b201802e47d0e90263e7.tar.bz2
Git hacking: Set up pre-commit test hook.
Also tweak .gitignore. To activate the hook, symlink .git/hooks to git_hooks.
-rw-r--r--.gitignore4
-rw-r--r--Cakefile2
-rwxr-xr-xgit_hooks/pre-commit18
3 files changed, 24 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index d3d6f4b5..22980f8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,7 @@
+*.un~
+*.swo
+*.swp
+*.crx
background_scripts/completion.js
background_scripts/commands.js
background_scripts/settings.js
diff --git a/Cakefile b/Cakefile
index 5f6a53b9..0a45abac 100644
--- a/Cakefile
+++ b/Cakefile
@@ -47,3 +47,5 @@ task "test", "run all unit tests", ->
test_files = test_files.map((filename) -> "tests/" + filename)
test_files.forEach (file) -> require "./" + file
Tests.run()
+ if Tests.testsFailed > 0
+ process.exit 1
diff --git a/git_hooks/pre-commit b/git_hooks/pre-commit
new file mode 100755
index 00000000..4c618746
--- /dev/null
+++ b/git_hooks/pre-commit
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+TDIR=`mktemp -d -t vimium`
+
+if [ $? -ne 0 ]
+then
+ exit 1
+fi
+
+git checkout-index --prefix=$TDIR/ -af
+
+cake test
+
+TEST_RESULT=$?
+
+rm -rf $TDIR
+
+exit $TEST_RESULT