Skip to content

Commit

Permalink
code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Jan 3, 2014
1 parent c3ed674 commit 92c35f4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -9,10 +9,10 @@ env:


install: install:
- "export PATH=$PWD/~build/casperjs/bin:$PATH" - "export PATH=$PWD/~build/casperjs/bin:$PATH"
- pip install coverage python-coveralls py.test - make install-deps


script: script:
- make ci - make init-db ci


before_script: before_script:
- make init-db install-casperjs - make init-db install-casperjs
Expand Down
39 changes: 25 additions & 14 deletions Makefile
@@ -1,36 +1,34 @@
VERSION=2.0.0 VERSION=2.0.0
BUILDDIR=${PWD}/~build BUILDDIR=${PWD}/~build
BINDIR=${PWD}/~build/bin BINDIR=${PWD}/~build/bin
DJANGO_SETTINGS_MODULE:=demoproject.settings
PYTHONPATH := ${PWD}/demo/:${PWD} PYTHONPATH := ${PWD}/demo/:${PWD}
DJANGO_14=django==1.4.10 DJANGO_14=django==1.4.10
DJANGO_15=django==1.5.5 DJANGO_15=django==1.5.5
DJANGO_16=django==1.6 DJANGO_16=django==1.6
DJANGO_DEV=git+git://github.com/django/django.git DJANGO_DEV=git+git://github.com/django/django.git


CASPERJS_DIR=${BUILDDIR}/casperjs CASPERJS_DIR=${BUILDDIR}/casperjs
PHANTOMJS_DIR=${BUILDDIR}/phantomjs PHANTOMJS_DIR=${BUILDDIR}/phantomjs



mkbuilddir: mkbuilddir:
mkdir -p ${BUILDDIR} ${BINDIR} mkdir -p ${BUILDDIR} ${BINDIR}


test:
py.test install-deps:
pip install -q \
-r adminactions/requirements/install.pip \
-r adminactions/requirements/testing.pip \
python-coveralls


install-casperjs: mkbuilddir
@sh -c "if [ -d ${CASPERJS_DIR} ]; then cd ${CASPERJS_DIR} && git pull; else git clone git://github.com/n1k0/casperjs.git ${CASPERJS_DIR}; fi"




locale: locale:
cd adminactions && django-admin.py makemessages -l en cd adminactions && django-admin.py makemessages -l en
export PYTHONPATH=${PYTHONPATH} && cd adminactions && django-admin.py compilemessages --settings=${DJANGO_SETTINGS_MODULE} export PYTHONPATH=${PYTHONPATH} && cd adminactions && django-admin.py compilemessages --settings=${DJANGO_SETTINGS_MODULE}




coverage: mkbuilddir
py.test --cov=adminactions --cov-report=html --cov-config=.coveragerc -vvv

install-casperjs: mkbuilddir
@sh -c "if [ -d ${CASPERJS_DIR} ]; then cd ${CASPERJS_DIR} && git pull; else git clone git://github.com/n1k0/casperjs.git ${CASPERJS_DIR}; fi"

init-db: init-db:
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS adminactions;'; fi" @sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS adminactions;'; fi"
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS adminactions CHARSET=utf-8 COLLATE=utf8_general_ci;'; fi" @sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS adminactions CHARSET=utf-8 COLLATE=utf8_general_ci;'; fi"
Expand All @@ -40,7 +38,16 @@ init-db:
@sh -c "if [ '${DBENGINE}' = 'pg' ]; then psql -c 'CREATE DATABASE adminactions;' -U postgres; fi" @sh -c "if [ '${DBENGINE}' = 'pg' ]; then psql -c 'CREATE DATABASE adminactions;' -U postgres; fi"
@sh -c "if [ '${DBENGINE}' = 'pg' ]; then pip install -q psycopg2; fi" @sh -c "if [ '${DBENGINE}' = 'pg' ]; then pip install -q psycopg2; fi"


ci: init-db
test:
py.test


coverage: mkbuilddir
py.test --cov=adminactions --cov-report=html --cov-config=.coveragerc -vvv


ci: init-db install-deps
@sh -c "if [ '${DJANGO}' = '1.4.x' ]; then pip install ${DJANGO_14}; fi" @sh -c "if [ '${DJANGO}' = '1.4.x' ]; then pip install ${DJANGO_14}; fi"
@sh -c "if [ '${DJANGO}' = '1.5.x' ]; then pip install ${DJANGO_15}; fi" @sh -c "if [ '${DJANGO}' = '1.5.x' ]; then pip install ${DJANGO_15}; fi"
@sh -c "if [ '${DJANGO}' = '1.6.x' ]; then pip install ${DJANGO_16}; fi" @sh -c "if [ '${DJANGO}' = '1.6.x' ]; then pip install ${DJANGO_16}; fi"
Expand All @@ -49,7 +56,6 @@ ci: init-db
@pip install coverage @pip install coverage
@python -c "from __future__ import print_function;import django;print('Django version:', django.get_version())" @python -c "from __future__ import print_function;import django;print('Django version:', django.get_version())"
@echo "Database:" ${DBENGINE} @echo "Database:" ${DBENGINE}
@pip install -qr adminactions/requirements/install.pip -qr adminactions/requirements/testing.pip


export PATH=${CASPERJS_DIR}/bin:$${PATH} && $(MAKE) coverage export PATH=${CASPERJS_DIR}/bin:$${PATH} && $(MAKE) coverage


Expand All @@ -59,6 +65,11 @@ clean:
find . -name __pycache__ -o -name "*.py?" -o -name "*.orig" -prune | xargs rm -rf find . -name __pycache__ -o -name "*.py?" -o -name "*.orig" -prune | xargs rm -rf
find adminactions/locale -name django.mo | xargs rm -f find adminactions/locale -name django.mo | xargs rm -f



clonedigger: mkbuilddir
-clonedigger concurrency -l python -o ${BUILDDIR}/clonedigger.html --fast


docs: mkbuilddir docs: mkbuilddir
mkdir -p ${BUILDDIR}/docs mkdir -p ${BUILDDIR}/docs
sphinx-build -aE docs/source ${BUILDDIR}/docs sphinx-build -aE docs/source ${BUILDDIR}/docs
Expand Down

0 comments on commit 92c35f4

Please sign in to comment.