Repository navigation
Installing for Development
To install PairMatic 2 for development or to run a server from your local host:
# FIRST, if you haven't before install the big binary dependencies:
#### node.js
cd $SOMEWHERE_TEMPORARY
wget http://nodejs.org/dist/v0.10.13/node-v0.10.13.tar.gz
tar -xzf node-v0.10.13.tar.gz
cd node-v0.10.13
./configure
make
make install # possibly with sudo prefix
cd ..
#### MongoDB -- see http://www.mongodb.org/downloads
# for a Mac OS X install:
wget http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.4.5.tgz
tar -xzf mongodb-osx-x86_64-2.4.5.tgz
sudo mv mongodb-osx-x86_64-2.4.5 /usr/local
sudo ln -s /usr/local/mongodb-osx-x86_64-2.4.5 /usr/local/mongodb
sudo mkdir -p /data/db
sudo chown `id -u` /data/db
# setup mongod to auto-start with your system if and as you want, otherwise:
/usr/local/mongodb/bin/mongod
# SECOND, get the PairMatic 2 source
cd $DIRECTORY_YOU_WANT_THE_REPOSITORY_UNDER
git clone git://github.com/gleneivey/pairmatic2.git
cd pairmatic2
git submodule init
git submodule update
# THIRD, install npm packages
npm install
npm install -g grunt-cli
npm install -g node_modules/jasmine-node
# FOURTH, configure your PairMatic server
# your personal server configuration
cp config-example.js config.js
### edit config.js to make it match your local MongoDB setups: custom port assignments, password, etc.
/usr/local/mongodb/bin/mongo localhost/pairmatic --eval 'db.configurations.insert({apiToken: "your Tracker token"})'
# initialize configuration for running PairMatic integration tests
scripts/setIntegrationTestToken
Start the PairMatic 2 server by going to the directory where you installed it and executing:
### with mongod already running, setup matching your config.js
cd $DIRECTORY_YOU_WANT_THE_REPOSITORY_UNDER/pairmatic2
grunt build # needs to be run after any template or stylesheet change; automatic at start of integration tests
npm start # possibly with sudo prefix
Executing the command 'grunt' without any other arguments in the PairMatic repository will execute all automated checks and tests, including the integration tests. The individual grunt arguments (commands) that are available are:
- 'grunt jshint' -- run syntax and style checks on all the JavaScript sources, report any problems.
- 'grunt server-unit' -- run unit tests (via jasmine-node) on PairMatic's server code. Tests are under /spec/server and code is under /server.
- 'grunt integration' -- start a fresh instance of the PairMatic server and run integration tests. Tests are under /integration.
Running the client-side unit tests is accomplished by opening the file
$DIRECTORY_YOU_WANT_THE_REPOSITORY_UNDER/pairmatic2/spec/client/jasmine-runner.html
in your web browser of choice. This will load and execute the Jasmine environment and unit tests (/spec/client) for the client-side code (/client).
The integration tests are divided into two sets under the 'integration' directory of the repository. The server integration tests interact with only the server via HTTP to verify that it provides the desired behavior to client requests. The client integration tests open and control a web browser, it loads the PairMatic client and interacts with it in the same way a user would.
The integration test grunt task starts its own server instance, but it depends on other processes having already been started. The Mongo DB server (mongod) must already be running, as is the case for starting a non-test server. In addition, the Selenium Webdriver server process must be running to provide a browser environment for the client tests. The environment interfaces with Selenium using 'webdriverjs' and the appropriate version of the Webdriver server is installed as part of that node pacakage. It can be started from within the PairMatic repository by the command:
java -jar node_modules/webdriverjs/bin/selenium-server-standalone-*
The integration tests interact with a set of test data on the live Pivotal Tracker web site. This is obviously not ideal, but PairMatic's complexity doesn't justify interposing a fake service for testing purposes. There is a "fake" Tracker login that is used by the server during integration testing. The API token for this login is is contained in the script scripts/setIntegrationTestToken, which was executed above in the setup instructions. This created a separate database within your MongoDB installation that has the same name as your database with "_test" appended. This is the database that the server connects to while running integration tests.
The postfix appended to the database name by PairMatic is from the environment variable PAIRMATIC_DB_EXTENSION. You can start up PairMatic using an alternative database (presumably with an alternative API token in its 'configurations' collection), using a command-line like:
PAIRMATIC_DB_EXTENSION=_alt npm start