Instructions for using and developing the Kitin web application.
(These instructions work for OS X and Linux. Substitute brew
in cmdline
examples below with the package manager of your OS.)
Install:
$ sudo easy_install pip
$ pip install virtualenvwrapper
Add these to your shell profile:
export WORKON_HOME=$HOME/.virtualenvs
source </path/to/virtualenvwrapper.sh>
Install:
$ brew install node
$ npm install -g grunt-cli
Create a virtualenv for this project:
$ mkvirtualenv kb-kitin
$ workon kb-kitin
$ pip install -r dev-requirements.txt
Make a local copy of the config file.
$ cp config.cfg.in config.cfg
In it, set WHELK_HOST
to point to localhost:
WHELK_HOST = 'http://localhost:8180/whelk'
WHELK_WRITE_HOST
to point to kitin localhost:
WHELK_WRITE_HOST = 'http://localhost:5000/whelk'
Set BIBDB_API
and BIBDB_API_KEY
. (Ask your colleagues..)
Set SESSION_SECRET_KEY
. To generate a key using python:
$ import os
$ print(os.urandom(24).encode('hex'))
After repository checkout, run to download dependencies:
$ npm install . # download tools
Edit requirements.txt for reqular Python libraries, and dev-requirements.txt for development tools. Use pip as per above to install.
To add a grunt task, install it and update package.json by running:
$ npm install --save-dev <package-name>
Then configure it in the Gruntfile.js
These are the third-party client-side (JS and CSS) libraries.
Download and build minified versions:
$ grunt vendor
Results end up in static/vendor
and static/build
.
To add a dependency:
$ bower install --save <package-name>
Edit exportsOverride
in bower.json
to limit what is copied into
static/vendor/
.
Clone librisxl and run its mockserver:
$ git clone git@github.com:libris/librisxl.git
$ cd librisxl
$ JAVA_OPTS="-Dfile.encoding=utf8" gradle jettyRun
Run webapp:
$ ./kitin.py -d
(Use -h for help.)
Run:
$ grunt watch
To compile LESS and CoffeeScript, concatenate and minifiy.
Execute the following command to run all tests.
$ nosetests
If for some reason nose fails to find the tests, tell it where to find them and where to find required modules(.)
$ PYTHONPATH=$PYTHONPATH:. nosetests -w test/python
Run the unit and end2end tests by executing any of these:
$ testacular start test/js/config/testacular.conf.js
$ testacular start test/js/config/testacular-e2e.conf.js
They assume Chrome but can use other browsers as well. Settings and configuration options are located under test/js/config.
Why things are as they are in this application repository.
(See .gitignore for what is not.)
All vendor sources are kept, along with the minified versions, because:
- everything should work out of the box once the server code is in place
- it gives an overview of what's there directly at checkout
- some vendor assets, e.g. fonts, cannot easily be packed together
- source maps can be used for easier debugging
Python-based:
- Flask, webapp framework
- Nose for unit tests
Node-based:
Client-side:
- AngularJS