Skip to content

Get started

theonlydude edited this page Apr 30, 2013 · 23 revisions

Table of Contents

Steps to have the app running

INSTALL

  • create github account and upload ssh public key
  • send me an email with github account to be added as a contributor to the project
  • checkout git repo:
https://help.github.com/articles/fork-a-repo

Checkout it to ~/eclipsebb

  • install pyramid under ubuntu:
http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/install.html
 cd ~
 sudo apt-get install python3.2 python3-setuptools
 sudo easy_install3 virtualenv
 # create a virtual python environment used to launch our project
 virtualenv-3.2 --no-site-packages eclipsebb_env
 cd eclipsebb_env
 ./bin/easy_install pyramid
  • create pyramid project
 # create empty project
 cd ~/eclipsebb_env
 ./bin/pcreate -s starter web_backend
  • install it
 # install pyramid other prerequisites
 cd ~/eclipsebb_env/web_backend
 ../bin/python3.2 setup.py develop
 # add beaker to handle sessions
 ~/eclipsebb_env/bin/easy_install pyramid_beaker
 # unit tests coverage
 ~/eclipsebb_env/bin/easy_install nose coverage
 # application testing
 ~/eclipsebb_env/bin/easy_install WebTest
 # code validation
 ~/eclipsebb_env/bin/easy_install pylint
 # email validation
 ~/eclipsebb_env/bin/easy_install validate_email
  • deploy app in pyramid
 # make the engine package available
 cd ~/eclipsebb_env/lib/python3.2/site-packages
 ln -s ~/eclipsebb/engine engine
 # make the web_backend available
 cd ~/eclipsebb_env
 rm -rf web_backend
 ln -s ~/eclipsebb/web_backend web_backend

RUN

  • launch server
 # default server listen on http://localhost:6543/
 cd ~/eclipsebb_env/web_backend
 mkdir -p ~/.local/share/eclipsebb
 ~/eclipsebb_env/bin/pserve development.ini  --reload

TESTS

  • launch unit tests
 cd ~/eclipsebb/web_backend
 ~/eclipsebb_env/bin/python3.2 setup.py test
  • launch unit tests with coverage
 (cd ~/eclipsebb/web_backend; ~/eclipsebb_env/bin/nosetests --cover-erase --with-coverage --cover-package=web_backend)
 (cd ~/eclipsebb/engine; ~/eclipsebb_env/bin/nosetests --cover-erase --with-coverage --cover-package=engine)
  • launch unit tests with coverage and debugger on error/failure
 cd ~/eclipsebb/web_backend
 ~/eclipsebb_env/bin/nosetests --cover-erase --with-coverage --cover-package=web_backend --pdb --pdb-failures
  • check code (no pychecker for python3 yet)
 # display note
 ~/eclipsebb_env/bin/pylint util.py 2>&1 | grep rated
 # display C/W/E
 ~/eclipsebb_env/bin/pylint --report=n --include-ids=y util.py

COMMIT

 # first time conf (cf https://help.github.com/articles/keeping-your-email-address-private for fake mail)
 git config --global user.email your.name@server.fake
 git config --global user.name "your name"
 # check modified files
 cd ~/eclipsebb
 git status
 # check diff in modified files (check that there's no debug stuffs remaining)
 git diff
 # local commit of modified files
 git commit -m "commit message" -a
 # push commit to github
 git push origin master

MISC

  • useful bash alias (in .bash_aliases)
 function nose {
     (cd ~/eclipsebb/"$1"; ~/eclipsebb_env/bin/nosetests --cover-erase --with-coverage --cover-package="$1")
 }
 alias bnose='nose web_backend'
 alias enose='nose engine'
 alias push='git push origin master'
 function git_commit {
     msg="$1"
     [ -n "$msg" ] || msg="WIP"
     git commit -m "$msg" -a
 }
 alias commit='git_commit'
 function eclipse_grep {
     grep "$1" ~/eclipsebb/engine/*.py ~/eclipsebb/web_backend/web_backend/*.py
 }
 alias ecgrep=eclipse_grep
 function rated_lynt {
     ~/eclipsebb_env/bin/pylint "$1" 2>&1 | grep rated
 }
 alias rlynt='rated_lynt'
 alias elynt='~/eclipsebb_env/bin/pylint --report=n --include-ids=y'
 alias pserv='~/eclipsebb_env/bin/pserve ~/eclipsebb_env/web_backend/development.ini --reload'

Clone this wiki locally