Development
.env file
To get started, you need a .env
file with secrets. A script is provided to generate this file with new secrets:
If the script succeeds, it will print ".env file generation complete."
Development mode
To use development mode, activate the docker-compose override file:
Booting up
If you have Docker on your machine, run:
It can then be accessed at http://localhost:3001/
API Documentation
The Swagger docs are generated from the RSpec tests in spec/controllers/api
To rebuild the swagger docs:
Licenses
You can check the licenses of unaccepted dependencies using:
To add accepted licenses:
ETL and Kiba
This project uses the Kiba gem for scalable and maintainable data processing.
This talk contains a short, clear explanation of how Kiba works.
Tips
- Don't insert rows one by one - use bulk insert.
- Skip activerecord validations because they are too slow, find other ways to validate data.
- Fail fast; raise an exception and stop on failure rather than trying to carry on and creating bad data.
Specs
To run Rubocop, and listen for file changes:
Just press enter to run the whole test suite straight away.
Code Coverage
After running the test suite, open the coverage/index.html file in a web browser to check what code is covered by the tests.
Debugging
To access a 'binding.pry' debugging point, run with:
Model Annotation
To annotate rails models with schema run
Accessing the database console
To access the MySQL database console:
Emails
The application does not currently send any emails.
Stop
Stop containers but do not remove them:
Stop containers and remove them:
Testing an import
If you need to compare 2 files, e.g. an export from ESR and an export form another system, you can compare the 2 files like this:
This will print out any lines which appear in spec/fixtures/left_hand_file
and not in spec/fixtures/right_hand_file
.
Versioning
After a bug is fixed (0.0.x), a new feature is added (0.x.0), or a breaking change is introduced(x.0.0), please:
- Bump the relevant version number in
config/initializers/version.rb
- Add brief notes about the changes to
CHANGELOG.md
. - Add a git tag to the merge commit in the format
v0.1.0
:git checkout mastergit pullgit tag v0.1.0 && git push --tags - Add a release on Github using the tag number (for example)
v0.1.0
as the title and the changelog info as the description.