A Ruby on Rails application delivering the Flood risk activity exemptions service.
This is a thin, host application which merely mounts and provides styling for the flood_risk_engine rails engine. The engine is responsible for the service implementation.
Please make sure the following are installed:
- Ruby 2.3.1 installed for example via RVM or Rbenv
- Bundler
- git
- Postgresql
- Phantomjs
Clone the repository and install its gem dependencies:
git clone https://github.com/DEFRA/flood-risk-front-office.git
cd flood-risk-front-office
bundle
The project uses the dotenv gem to load environment variables when the app starts. Dotenv expects to find a .env
file in the project root.
Duplicate .env.example
and rename the copy as .env
Open it and update SECRET_KEY_BASE
and the settings for database, email etc.
If Google analytics is required, uncomment the line GOOGLE_ANALYTICS_ID=ABC-DEFGHI
and replace ABC-DEFGHI with the required Google tag.
The usual rails commands can be used to manage the databases for example
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:seed
Add RAILS_ENV=test
to the commands when preparing the test database.
The engine uses PostGIS rgeo for geospatial queries. The activerecord-postgis-adapter gem adds geospatial datatypes to PotgreSQL and supports geospatial queries. The adapter is enabled for this application by defining the database adapter as postgis
instead of postgresql
in database.yml
:
adapter: postgis
Note that postgis is also required when running automated unit tests within GitHub CI. To support this, ci.yml
specifies the use of a docker image which runs PostgreSQL
with the postgis
adapter:
image: postgis/postgis:10-2.5
To start the service locally run
bundle exec rails s
You can then access the web site at http://localhost:3000
We use RSpec and focus on feature tests in this project that go through the journey for each organisation type (unit testing is done in flood _risk_engine and acceptance tests in Flood risk acceptance tests).
To run Rubocop and the test suite
bundle exec rake
To run just the tests
bundle exec rake spec
The project is linked to Travis CI and all pushes to the GitHub are automatically checked.
The checks include running all tests plus Rubocop, but also tools like HTLMHint and i18n-tasks. Check the .travis.yml
for full details, specifically the before_script:
section.
It is left to each developer to setup their environment such that these checks all pass before presenting their code for review and merging.
If you have an idea you'd like to contribute please log an issue.
All contributions should be submitted via a pull request.
THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:
http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
The following attribution statement MUST be cited in your products and applications when using this information.
Contains public sector information licensed under the Open Government license v3
The Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.
It is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.