Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
LIBRIS cataloguing client
JavaScript HTML CSS Python
Failed to load latest commit information.
examples/templates Electronic and MediaObject now have cataloguersNote and copyNote
resource URI -> URL
static Moved timeAgo into a direcitve and added automatic update every 20 se…
templates Moved timeAgo into a direcitve and added automatic update every 20 se…
test Added user configuration to fix problem with karma tests
.bowerrc Use Grunt and Bower to manage JS and CSS. Adapt structure accordingly.
.gitignore Remove python-based webdriver web tests in favour of karma/protractor…
.jshintrc Use Grunt and Bower to manage JS and CSS. Adapt structure accordingly.
Gruntfile.js Moved holdings into separate test suite and fixed broken grunt protra…
README.md Changing paths to work togheter with lbrisxl dev branch
bower.json Merge branch 'develop' into feature/labels_from_terms
config.cfg.in Move messages to JSON file and select using ENVIRONMENT flag in config
dev-requirements.txt Removed Fabric from dev-requirements
kitin.py Move MESSAGES to global_view_variables to prevent view errors
kitin.wsgi.in Remove marcmap-overlay remnants
messages.json Add dev environment in messages
oauth.py Merged devlop into karma and updated karma tests to a working state
oauth2.py Merged devlop into karma and updated karma tests to a working state
package.json e2e tests
requirements.txt Moved from flask-oauthlib to requests_oauthlib. Since flask-oauthlib …
set-version-info.sh Compact argument test in set-version-info.sh
storage.py Temporary fix to support whelk datetime format in draft save.
user.py Adding a first check for xlreg authorzation to enable/disable holdings

README.md

Kitin - README

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.)

Prerequisites

Python and Friends

Install:

$ sudo easy_install pip
$ pip install virtualenvwrapper

Add these to your shell profile:

export WORKON_HOME=$HOME/.virtualenvs
source </path/to/virtualenvwrapper.sh>

Node and Friends

Install:

$ brew install node
$ npm install -g grunt-cli

Initial Configuration

Virtualenv and Flask Settings

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'))

Install Grunt Tasks

After repository checkout, run to download dependencies:

$ npm install . # download tools

Managing Dependencies

Python Dependencies

Edit requirements.txt for reqular Python libraries, and dev-requirements.txt for development tools. Use pip as per above to install.

Updating Grunt Tasks

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

Static Vendor Dependencies

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/.

During Development

Run Local Test Backend

Clone librisxl and run its mockserver:

$ git clone git@github.com:libris/librisxl.git
$ cd librisxl
$ JAVA_OPTS="-Dfile.encoding=utf8" gradle jettyRun

Run the Flask Webapp

Run webapp:

$ ./kitin.py -d

(Use -h for help.)

Automatic CSS and JS Compilation

Run:

$ grunt watch

To compile LESS and CoffeeScript, concatenate and minifiy.

Running Python unit tests

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

Running JS tests

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.

Design Principles

Why things are as they are in this application repository.

What is actually under version control?

(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

The Tools Used

Python-based:

  • Flask, webapp framework
  • Nose for unit tests

Node-based:

Client-side:

  • AngularJS
Something went wrong with that request. Please try again.