The mark of quality and trust for open data
Ruby HTML CSS XSLT JavaScript Gherkin
Switch branches/tags
staging-2014-03-06_14-30-11 staging-2014-02-21_18-19-03 staging-2014-02-12_11-45-00 staging-2014-02-11_17-09-22 staging-2014-02-03_10-07-30 staging-2014-01-21_12-39-10 staging-2014-01-21_12-29-10 staging-2013-11-28_10-55-44 staging-2013-11-27_11-00-52 staging-2013-11-26_14-48-14 staging-2013-11-21_17-36-37 staging-2013-11-21_17-25-07 staging-2013-11-21_12-56-56 staging-2013-11-18_11-53-17 staging-2013-11-07_18-08-11 staging-2013-11-06_15-36-37 staging-2013-11-06_11-35-47 staging-2013-11-06_01-06-16 staging-2013-11-05_18-59-35 staging-2013-11-05_10-30-27 staging-2013-11-05_09-58-32 staging-2013-11-04_14-40-18 staging-2013-11-04_13-48-14 staging-2013-11-04_13-42-13 staging-2013-11-04_10-40-36 staging-2013-11-01_10-25-52 staging-2013-11-01_09-27-01 staging-2013-10-31_15-46-22 staging-2013-10-31_14-55-35 staging-2013-10-28_14-29-29 staging-2013-10-28_12-00-29 staging-2013-10-28_11-19-15 staging-2013-10-25_13-45-14 staging-2013-10-25_11-41-53 staging-2013-10-25_10-37-41 staging-2013-10-24_15-44-40 staging-2013-10-24_15-19-23 staging-2013-10-24_14-57-24 staging-2013-10-24_14-09-16 staging-2013-10-24_13-22-58 staging-2013-10-24_09-30-53 staging-2013-10-23_15-28-32 staging-2013-10-17_09-20-07 staging-2013-10-16_14-59-57 staging-2013-10-16_13-03-22 staging-2013-10-14_11-09-16 staging-2013-10-12_13-30-42 staging-2013-10-10_15-13-30 staging-2013-10-04_14-35-08 staging-2013-10-04_10-35-04 staging-2013-10-04_10-01-59 staging-2013-10-02_10-22-38 staging-2013-10-01_18-48-45 staging-2013-09-30_16-03-49 staging-2013-09-30_15-00-26 staging-2013-09-12_19-56-28 staging-2013-09-12_19-38-03 staging-2013-09-12_17-23-40 staging-2013-09-12_17-06-43 staging-2013-09-12_16-24-00 staging-2013-09-05_16-48-48 staging-2013-09-05_16-36-19 staging-2013-09-04_12-15-48 staging-2013-09-03_14-49-37 staging-2013-09-02_16-15-43 staging-2013-08-30_16-15-31 staging-2013-08-30_13-47-12 staging-2013-08-30_11-33-13 staging-2013-08-29_11-52-25 staging-2013-08-29_09-11-18 staging-2013-08-27_18-47-00 staging-2013-08-20_10-51-32 staging-2013-08-20_09-57-19 staging-2013-08-19_13-32-59 staging-2013-08-18_20-12-48 staging-2013-08-18_19-59-42 staging-2013-08-16_17-04-14 staging-2013-08-15_20-25-59 staging-2013-08-15_19-52-30 staging-2013-08-15_19-06-32 staging-2013-08-12_14-42-31 staging-2013-08-09_16-29-51 staging-2013-08-01_10-42-03 staging-2013-07-31_21-43-13 staging-2013-07-31_21-40-20 staging-2013-07-31_21-32-32 staging-2013-07-31_20-53-28 staging-2013-07-30_13-19-50 staging-2013-07-24_17-28-53 staging-2013-07-24_11-53-28 staging-2013-07-23_15-56-13 staging-2013-07-23_11-49-13 staging-2013-07-23_11-25-21 staging-2013-07-19_15-39-21 staging-2013-07-16_11-57-44 staging-2013-07-15_12-38-24 staging-2013-07-15_12-25-57 staging-2013-07-15_12-14-09 staging-2013-07-15_12-01-49 staging-2013-07-15_11-48-26
Nothing to show
Latest commit e76e406 Aug 23, 2016 @Floppy Floppy replace arrow function
Permalink
Failed to load latest commit information.
.tx Combine jurisdiction translation before push to Transifex Nov 12, 2015
app replace arrow function Aug 23, 2016
bin Clean up after running setup tasks Apr 7, 2016
config adds progress js to precompile list Aug 16, 2016
db make harvest option persist Aug 19, 2016
doc Improve README and docker instructions Jul 19, 2016
docker Set up scripts for docker Apr 7, 2016
features kill feature test as it doesnt get js polling updates Aug 19, 2016
fixtures Merge no longer adds surveyor namespace Nov 12, 2015
lib refactors prebuild and make sure to pass on harvest_include option Aug 19, 2016
log added initial rails install Apr 22, 2013
prototype Merge pull request #1369 from Motejl/czech-localization-updates Feb 17, 2016
public Rescue from NotAuthorised with a 403 Oct 3, 2014
script Add Cucumber Sep 12, 2014
spec Add UserExport class Jan 12, 2016
surveys Change help text for dataTitle Apr 4, 2016
test refactors prebuild and make sure to pass on harvest_include option Aug 19, 2016
vendor Merge pull request #1344 from theodi/homepage-content-update Jan 14, 2016
.dockerignore Reduce context sent to Docker for image building Apr 7, 2016
.gitignore ignore my notes Jul 7, 2016
.gitmodules re-added odi bootstrap as a submodule in the prototype directory Apr 22, 2013
.powrc Add pow/rvm config May 12, 2014
.rspec Get surveyor controller spec working again Oct 19, 2015
.ruby-gemset locked down ruby and gem versions May 13, 2013
.ruby-version Use ruby 2.1.8 Apr 6, 2016
.travis.yml Remove rvm key from travis.yml Apr 6, 2016
Dockerfile Add a Dockerfile Apr 7, 2016
Gemfile Use ruby 2.1.8 Apr 6, 2016
Gemfile.lock Use ruby 2.1.8 Apr 6, 2016
Guardfile removed spring guard Nov 6, 2013
HOW_TO_FIX_IT.md Update HOW_TO_FIX_IT.md Jun 14, 2013
LICENSE.md Add license details Jul 21, 2014
Procfile Reduce sidekiq worker thread count Sep 15, 2015
README.md Fix title Jul 19, 2016
Rakefile Run tests before specs Oct 16, 2015
Vagrantfile New, much cleaner infrastructure Sep 1, 2015
config.ru added initial rails install Apr 22, 2013
docker-compose.yml make sure containers are linked Jul 7, 2016
env.example Rename hostname envar in documentation Jul 28, 2015

README.md

Build Status Dependency Status Coverage Status Code Climate License Badges

Open Data Certificates

This source code is for the ODI's Open Data Certificates app at certificates.theodi.org.

License

This code is open source under the MIT license. See LICENSE.md file for full details.

Development

The simplest way to get a certificates app up and running is under Docker.

With Docker

OSX

  1. Install Docker Toolbox
  • Set up a Docker host with docker-machine start default or run the Kitematic GUI.
  • Make sure your terminal can talk to Docker
    • either by opening the 'Docker Quikstart Terminal'
    • or adding eval $(docker-machine env default) to your .bashrc
  1. Run bin/dockerize
  2. Make tea
  3. Everything should be set up and be open in your browser.
  4. Run docker-compose run web bin/setup

Linux

  1. Install docker-engine, docker-compose, and then docker-machine
  2. Set up a Docker host with docker-machine create -d virtualbox default
  3. Run bin/dockerize
  4. Make tea
  5. Everything should be ready and the script will try to open the browser
  • If it doesn't, hit ctrl-c and check all 4 containers are up with docker-compose ps
  • Then point your browser to the address:port for the opendatacertificate_web_1 container (likely 0.0.0.0:3000)
  1. Run docker-compose run web bin/setup

Without Docker

  1. Install Ruby 2.1.8, and bundler.
  2. Install and run Redis and MySQL servers.
  3. Run bin/setup
  4. Run bundle exec rails s

If you're not using docker, ignore the docker-compose run web prefix on the commands below.

Default Admin User

Both of the above methods should set up your local app with a default admin user:

  • Username: test@example.com
  • Password: testtest

Testing

To run tests:

docker-compose run web bundle exec rake test

You can also run tests continuously whenever a file is changed:

docker-compose run web bundle exec guard

Internationalisation

By default, only the UK survey is built in development, as building more can take a while.

To build a specific country survey (AU used as an example):

docker-compose run web bundle exec rake surveyor:build_changed_survey FILE=surveys/generated/surveyor/odc_questionnaire.AU.rb

To build a few surveys:

docker-compose run web bundle exec rake surveyor:build_changed_surveys LIMIT=5

To build all the other surveys (remember, this can take a while):

docker-compose run web bundle exec rake surveyor:build_changed_surveys

For information on how to translate and localise surveys, see below.

API

Certificates can be created and updated using a JSON API. See the API documentation for details.

Environment variables

Some extra environment variables are required for the certificates site; these can be set in a .env file in the root of the project. The docker setup will create this file if it doesn't already exist.

Required

# A hostname to create links in emails
CERTIFICATE_HOSTNAME="localhost:3000"

# Redis server URL
ODC_REDIS_SERVER_URL="redis://redis:6379"

Optional

The following extra are needed in production or for optional features:

# Rackspace credentials for saving certificate dumps
RACKSPACE_USERNAME
RACKSPACE_API_KEY
RACKSPACE_CERTIFICATE_DUMP_CONTAINER

# Juvia details to allow commenting
JUVIA_BASE_URL
CERTIFICATE_JUVIA_SITE_KEY

# Sending error reports to airbrake
AIRBRAKE_CERTIFICATE_KEY

# Enable footnotes for debugging info
ENABLE_FOOTNOTES=true

Admin functions

To mark a user as being an admin use the rails console to set the admin field to true. The easiest way to find the ID is to look on the URL of their account page.

User.find(<id>).update_attributes(admin: true)

Admins are able to block a dataset from displaying on the public /datasets page by visiting the dataset and toggling the visibility at the top of the page.

Removed datasets are listed at /datasets/admin (only accessible by admin users).

Autocompletion

The survey attempts to fetch answers from the documentation URL and fill them into the questionnaire. These answers are marked as autocompleted.

Surveys can be autocompleted if the pages machine-readable metadata in the following formats:

  • DCAT
  • Datapackage
  • CKAN

Some examples of URLS that can be autocompleted:

Additional documentation

App approach document

The original prototype has been moved to /prototype.