Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
add dev.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
whtsky committed May 25, 2013
1 parent fdbec16 commit 79aa7d0
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 3 deletions.
3 changes: 3 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nose
nose-cov
flake8
16 changes: 16 additions & 0 deletions dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

echo 'Installing git hooks..'
mkdir .git/hooks > /dev/null
cp githooks/* .git/hooks > /dev/null
chmod +x .git/hooks > /dev/null
echo 'Done.'

echo 'Creating virtualenv..'
virtualenv .
source bin/activate

echo 'Install requirements..'
pip install -r dev-requirements.txt

python setup.py develop
34 changes: 34 additions & 0 deletions githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

function failCommit() {
tput setaf 1
echo "----------------------------------------"
echo "FATAL ERROR: $1"
echo "----------------------------------------"
tput sgr0
exit 1
}

echo 'Running flake8...'
result=$(flake8 parguments)
if [ $? != 0 ]; then
echo "$result"
echo ''
echo 'lint fail'
lintFailed=1
failCommit "Lint Errors"
fi

echo 'Running Tests...'
result=$(nosetests)
if [ $? != 0 ]; then
echo "$result"
echo ''
echo 'Tests fail'
testsFailed=1
failCommit "Test Errors"
fi

if [[ $testsFailed || $lintFailed ]]; then
failCommit "Unable To Commit"
fi
1 change: 0 additions & 1 deletion parguments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import sys
from docopt import docopt
from .cli import *
from .utils import remove_indentation


Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from io import StringIO

from parguments import Parguments
from parguments.cli import *
from parguments.cli import prompt, prompt_choices, prompt_bool


class Catcher(object):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from parguments import Parguments
from parguments.utils import *
from parguments.utils import remove_indentation, count_indentation


def test_utils():
Expand Down

0 comments on commit 79aa7d0

Please sign in to comment.