This repository contains the source code for the web app used by the Preventive Financial Control office of the University of Bucharest. It is built using the Ruby on Rails framework.
For development, we recommend using an IDE such as Visual Studio Code (see this guide for enabling Ruby support) or RubyMine.
First, you need to have Ruby installed. Check the .ruby-version
file to determine which version you need. On Windows, you can get it by downloading Ruby Installer. On Mac OS or Linux, we recommend managing your Ruby install through rbenv
.
Check that Ruby got successfully installed by running the following command in a terminal:
ruby --version
You will also need to have Node.js installed for the compression step of the asset pipeline.
Check that Node.js is installed by running the following command:
node --version
You will need to install a few native libraries required by some of the dependencies.
If using RubyInstaller for Windows, run the following command in a terminal running as administrator:
ridk exec sh -c 'pacman -S ${MINGW_PACKAGE_PREFIX}-postgresql'
For Ubuntu or Debian, run:
sudo apt install libpq-dev
Once you have Ruby and Node.js on your machine, you can install the package dependencies by running bundle install
in the project's root directory.
The app relies on Microsoft Entra ID for authentication. You will have to create an app registration on the Microsoft identity platform to be able to sign in.
You can edit the (encrypted) credentials file by running:
rails credentials:edit
then add a section with the following structure:
# Credentials for Microsoft Entra ID
microsoft_identity_platform:
tenant_id: <tenant ID>
client_id: <client ID>
client_secret: <client secret>
The app needs to connect to a PostgreSQL instance to use as a database.
Assuming that you've got Docker and the Docker Compose plugin installed, you can run the following command to start a local Postgres instance:
docker compose up
To create the database structure, you can either run the migrations by using rails db:migrate
(which will not destroy the existing data) or recreate the database from scratch using rails db:schema:load
.
You should then set the ADMIN_EMAIL
environment variable to a Microsoft 365 user e-mail and run rails db:seed
to seed the database. This will create an admin user account corresponding to the ADMIN_EMAIL
variable and load some predefined entities from disk. Example call:
ADMIN_EMAIL='[email protected]' rails db:seed
Start a local development server by running rails server
. The app will be available in your browser at http://localhost:3000/
.
To run the automated tests, use rails test
. To also obtain code coverage data, set the COVERAGE
environment variable to a non-empty/truthy value before running the command.
The code is licensed under the permissive MIT license.