Workflow

The source code of the project is hosted on TPF GitLab. In order to make changes to the code a user account needs to be created. Request a GitLab account by contacting a TPF member.

Version Control with Git

If you are not familiar with version control of source code with git please refer to the git homepage. The interface with git can easily be done via command line. If this is not your cup of tea, several GUI Clients are available.

Extending/Changing the Source Code

Changes to the code should not be made on the server as only deploy rights are given and the changes cannot be pushed to GitLab. Instead a development environment on a local machine should be created where the source code is changed (In the following the name __experiment_name__ denotes the name of the project):

  1. To set up a local development environment. Refer to https://demo-selfhelp.psy.unibe.ch/configs for some guidance on this topic.

  2. Clone the project from the TPF server.

    git clone gh@tpf.fluido.as:SLP/SLP-sleep_coach.git __experiment_name__
  3. Create a feature branch where the changes will be implemented.

    git branch app-__experiment_name__
  4. Implement the extensions. Try to avoid making changes to the existing code. When adding new styles or components, no changes to the existing code need to be made as everything new should be kept in the folder named after the new style or component. It is highly recommened to use git while developing and regularly committing changes to the local tree and pushing the changes to TPF GitLab. Refer to Getting Started for help on how to use git. Note that changes to the database should be included in the source code as well. It is good practice to provide an sql script including the necessary changes.

  5. Once the changes are ready and tested the new version can be deployed on the server (assuming the local changes wre pushed to TPF GitLab). On the webserver this can be done with the following commands (in the project directory)

    git pull
    git co app-__experiment_name__

    Remember to also apply the database update script if changes to the database were made. Make sure to test the script on a local copy of the life database before deploying it on the server.

Merging to the Master Branch

If the changes seem to be a valid addon for other projects as well, it might make sense to merge the work into the master branch. This can be requested by creating a Merge Request in GitLab. A member of the TPF team will then perform a code review and accept or reject the merge request. It is likely that a new style or component will be accepted. However, it is less likely that extensive changes to the existing code might be considered.