# INSTALLING NPM/BOWER

The version of npm in apt-get is too old for bower. Instead
install it from http://nodejs.org/download/.

Install bower with:

    $ npm install -g bower

# SYNCING DEPENDENCIES

The makefile will update dependencies, including polymer components and testing libraries:

    $ make update

This just checks for npm and bower, and then runs:

    $ bower update
    $ npm install

# RUNNING SHERIFF-O-MATIC

sheriff-o-matic must be run from a server in order to handle polymer imports correctly.

    $ cd Tools
    $ python -m SimpleHTTPServer

Then load: http://localhost:8000/GardeningServer/sheriff-o-matic.html

# TESTING

## Mocha (new-style) tests

The tests can be run in the browser or from the command line.

In the browser: http://localhost:8000/GardeningServer/test/run-unit-tests.html

From the command line:

    $ cd Tools/GardeningServer
    $ make test

This will launch karma, run the tests and watch the source files for changes. To run once and exit, use:

    $ make single-test

Or, you can start karma manually:

    $ cd Tools/GardeningServer
    $ ./node_modules/karma/bin/karma start

You can shorten this command to 'karma start' if you run 'npm install -g karma-cli'.

## QUnit (old-style) tests

While we still have tests using QUnit, you can run these at: http://localhost:8000/GardeningServer/run-unittests.html.

# PUSHING

In GardeningServer:

1. make update
2. appcfg.py update . --version r$(git svn find-rev HEAD) --oauth2
3. Go to appengine.google.com and select the sheriff-o-matic app.
4. Click on the version tab
5. Make the rXXXX version the default, where XXXX is:
   git svn find-rev HEAD

The versioning is so that we can easily roll back if there's something
wrong with the push and so we can know what we've pushed.

If you're unsure about whether you might have broken things, before
step 4, you can click on the link for that version to see that
version of the server before you make it the default.

# LIBRARIES

sugar: Provides generic syntactic sugar for JavaScript, mostly by extending native object prototypes.

karma: test runner. Runs the unit tests in an instance of Chrome and pipes the results to the command
       line. By default, it watches for changes to files and will automatically re-run the tests. To run
       once and exit, use 'karma start --single-run' or 'make single-test'.

mocha: testing framework. Provides good asynchronous and synchronous test support. Tests run serially,
       so exceptions are reported for the right test case.

chai:  assertion library.
