Skip to content

Commit

Permalink
Synta checking, unit testing and autocompiling when commiting the js …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
johngeorgewright committed Jun 11, 2013
1 parent 08e52e1 commit cba68cd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
22 changes: 20 additions & 2 deletions git-hooks/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
#!/usr/bin/env sh
grunt
exit $?

command()
{
$@
code=$?
if [ $code -gt 0 ]
then
exit $code
fi
}

changed=`git diff --name-only | grep angular-xml.js`

if [ $changed ]
then
command npm run-script jshint
command npm run-script karma
command npm run-script compile
git add angular-xml.min.js
fi

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
"grunt-contrib-jshint": "~0.6.0"
},
"scripts": {
"test": "karma start test/karma.js"
"test": "npm run-script jshint; npm run-script karma",
"karma": "karma start test/karma.js --no-auto-watch --single-run",
"jshint": "grunt jshint",
"compile": "grunt http",
"prepublish": "npm test; npm run-script compile"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit cba68cd

Please sign in to comment.