Skip to content

Development Guide for Panoptes

Campbell Allen edited this page Nov 28, 2017 · 1 revision

This guide will help you set up a local development and testing environment so you can begin contributing to Panoptes. Before beginning here, you should have followed the instructions to get Panoptes running locally (see the README for details).

Helpful Hints

  • Panoptes tries to keep its controllers lean by keeping its business logic in 'operations'. Operations are subclasses of ActiveInteraction::Base provided by ActiveInteraction. Becoming familiar with that gem's DSL will be useful.

  • Panoptes uses a fork of Restpack Serializer to package to be sent as JSON via the API. Specific implementations are located in /serializers.

Running Specs

Contributions to Panoptes must be tested and must not break existing tests. In order to run specs, Panoptes will need a Postgres database running locally. Libraries and adapters need to be installed and configured so that they can talk.

  1. Run bundle install
  2. Install the Postgres client libraries. On OSX, the simplest way is to use Homebrew: brew install postgresql. On Ubuntu/Debian, apt-get install libpq-dev.
  3. A Docker container is used to host Postgres. If you used docker-compose up and the rest of the Panoptes Docker containers are running, it will use the existing Postgres container. If they're not, or if you only need the database (for specs or testing), you can run docker-compose -f docker-compose-db.yml up instead.
  4. Determine the container's IP with docker-machine ip default and update the test section of database.yml to include your Docker IP as the host and to use the database "panoptes_test"
  5. Create the “panoptes_test” database with RAILS_ENV=test bin/rake db:setup
  6. The specs will now run with bundle exec rspec. The whole suite can take a while to run, so you can limit the number run at once by specifying a file or string (-e) or with the ":focus" tag.