Skip to content

Implementation Details and Implementation Workflow

Eugen Kuksa edited this page Sep 19, 2016 · 5 revisions

Ontohub-Backend

Models

All models of Ontohub are defined in the ontohub-models Rails engine. The corresponding specs, fixtures and factories are located in the spec directory of that repository.

When Models Change

Every time the models gem changes, we need to update the reference to the desired commit in the Gemfile of ontohub-backend and bundle update ontohub_models.

Migrations

This Rails engine enables sharing of the database migrations, such that they don't have to be copied to the app that uses the engine. To run the migrations for the host app, execute rails db:migrate as usual.

Creating a new model

To create a new model with a generator, you can just run, for example,

rails g model Repository name:string slug:string description:text created_at:datetime updated_at:datetime

which creates a Sequel model (without any plugins), a factory and a spec file.

Workflow

Sometimes, we need to add temporary code that must be included in a near-production or production state but removed some time later. In this case, add a code-comment leading with the keyword TEMPORARY with an optional short description of when this is supposed to be removed. Right after merging the pull request, add an issue to delete the temporary code referencing the temporary lines of code (at the merge commit).