Note: parliament-prototype has been depreciated. This served as an initial incarnation of the new Parliament Beta website (https://beta.parliament.uk/).
This application has been split into three separate applications, plus a number of gems to bring it closer to our digital principles (https://pds.blog.parliament.uk/2017/08/16/a-technology-strategy-for-parliament/):
- https://github.com/ukparliament/parliament.uk-utilities
- https://github.com/ukparliament/parliament.uk-lists
- https://github.com/ukparliament/parliament.uk-things
Also see the below for additional helper repos
Parliament.uk Prototype is a Rails application designed to be the beginnings of a new parliament.uk website and API.
Parliament.uk Prototype requires the following:
- Ruby - for the exact version, click here.
- Docker
Clone the repository:
git clone https://github.com/ukparliament/parliament.uk-prototype.git
cd parliament.uk-prototype
Parliament.uk Prototype is made up of three main components:
- Parliamentary Data API
- Bandiera
- Parliament.uk Prototype Rails Application
There are a number of additional side pieces but for now, these are our main focus.
Behind the prototype is an API that provides our application with all the data it needs to run. This data is served in an RDF format called n-triples.
In production, there is an API application that serves dynamic data to our Rails application. For local development, we use the parliament.uk-static-api application/docker image.
Using the static application allows us to quickly prototype data responses without a reliance on the internal parliament API.
'Bandiera is a simple, stand-alone feature flagging service' which we use to enable and disable certain features within the parliament application.
We use Bandiera to enable and disable time-boxed states such as dissolution within the application. When enabled, banners display on certain pages of the site.
This is the Parliament.uk Prototype application itself, the routes, controllers and views that make up our application.
Running the application locally is done using docker-compose, but there is a one-off set up command needed the first time:
make dev
This command will set up the dependent docker images and databases that the application uses to run.
Once this step has been completed, you can simply run:
docker-compose up
Now the three main applications should be available as follows:
- Prototype Rails Application - http://localhost:3000
- Static API - http://localhost:3030
- Bandiera - http://localhost:5000
We use RSpec as our testing framework, and run our tests inside of Docker. Use the below command to run the full suite.
make test
The downside to running make test
is speed, virtually every time, we will be rebuilding the Docker image just to run our tests.
To get around this, whilst developing we can first connect to the running application and run tests within it. The following commands assume you have the application running via docker-compose up
:
docker-compose exec app /bin/sh
bundle exec rake parallel:spec
This will first open an sh terminal within the running application server, then execute the tests right away without the need to re-build the image.
If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review.
- Fork the repository
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Parliament.uk Prototype is licensed under the Open Parliament Licence.