The repository for the Inga Foundation project.
Follow these steps to set up this project for development.
Instructions provided here are for Linux and MacOS users. If you are on Windows, we strongly recommend installing Windows Subsystem for Linux (WSL) to get the best development experience, and to be able to work with the tools mentioned in this guide.
- Ruby 3.4.1 (required)
- We strongly recommend using a Ruby version manager such as
rbenvto manage Ruby versions.
- We strongly recommend using a Ruby version manager such as
watchman(optional but recommended): used to refresh CSS in real time during development with this setup- Can be installed using
brew install watchman(Homebrew required first, see step 1 in next section for doing so)
- Can be installed using
-
Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install rbenv:
brew install rbenv -
Initialize rbenv:
rbenv initIMPORTANT: Follow the instructions to add rbenv to your shell and restart your shell.
-
Install Ruby 3.4.1:
rbenv install 3.4.1 rbenv global 3.4.1 -
Install Bundler:
gem install bundler
-
Install dependencies:
bundle install -
Set up and seed the database (see next section for details on what seeding the database entails):
bundle exec rails db:reset -
Start the development server:
bin/dev -
[Optional] Run the tests:
bundle exec rails test
Seeding the database using bundle exec rails db:seed or bundle exec rails db:reset (as described by the previous section) will populate the database
with four users that you can use to login and test the application. Each one
has a different role; you can use them to test the behaviour of pages from
different perspectives. Below are the credentials:
Can manage users.
Username: admin
Password: a
Can create log entries or journal entries.
Username: reporter
Password: a
Can generate reports for donors.
Username: analyst
Password: a
Has all three of the above roles.
Username: super
Password: a
Note: the above roles are not disjoint; that is, one user may have multiple roles that allow them to use the application for multiple functions.
Note: the above user accounts are created in the user seeds file. There are also seeds for other models (see all seeds here) that will be helpful in testing the application with some realistic data.
Running formatters and linters before making a PR is mandatory for CI checks to pass. This section describes how you can run formatters/linters on the codebase prior to submitting your changes.
The linter/formatter is the same for Ruby: rubocop. You can run rubocop using the following command:
bundle exec rubocop [-a/--autocorrect]
Note: the -a or --autocorrect option is optional, and will write
changes to your files, correcting all offenses it safely can. There is also a
more forceful -A or --autocorrect-all option, which will write changes and
correct both safe and unsafe offenses.
Note: where the formatter and linter disagree, the linter has the final say.
You can run the formatter htmlbeautifier using the following command:
bundle exec htmlbeautifier -b 1 **/*.html.erb
Note: -b is for allowing up to one extra blank line (normally used for
visually separating sections and making code readable). Not including this
condenses all HTML at all times, which is not ideal.
Note: this will write changes to the given files.
You can run the linter erb_lint using the following command:
bundle exec erb_lint --lint-all [--autocorrect]
Note: the --autocorrect option is optional, and will write changes to
your files.
For any issues, please reach out to the project leads so we can help you!