Install bundled gems
$ bundle install
Start up postgres (if not already running)
$ postgres -D /usr/local/var/postgres/
Setup the database
$ createuser --superuser postgres
$ rails db:setup
Populate database with sample data
$ rails db:populate
Start up rails!
$ rails server
Make sure you have Docker and Docker-Compose setup and running.
Build the project
$ docker-compose build
Spin up the containers
$ docker-compose up
Setup the database
$ docker-compose run app rails db:setup
Populate database with sample data
$ docker-compose run app rails db:populate
Restart the server
$ docker-compose stop
$ docker-compose up
To run the server as an interactive shell (to use e.g. byebug or pry)
$ docker-compose run --service-ports app
Set up the following environment variables:
- DATABASE_URL
- SMTP_EMAIL_ADDRESS
- SMTP_EMAIL_PASSWORD
- FQDN
- SECRET_KEY_BASE
- RAILS_ENV
- RAILS_SERVE_STATIC_FILE
Travis CI is set up to automatically deploy to Heroku:
-
the
masterbranch is automatically deployed to the staging environment: https://where2help.herokuapp.com/ -
the more stable
fswbranch deployed by FSW by hand
If you want to skip continuous integration for your commit, add this to your commit message:
[ci skip]
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
- Fork the project.
- Start a feature/bugfix branch,
mastershould always be stable. - Commit and push until you are happy with your contribution.
- Make sure to add tests for it, if possible.
- If you're interested in working on an issue that has been assigned to somebody, we encourage you to get in touch with them first!
- for Rails, follow the best practices of the Rails Style Guide
- for Ruby code in general, follow the best practices of the Ruby Style Guide
- the application is bilingual: English & German
- everything visible to end users needs to be translated
- views
- ActiveRecord model-names and -attributes
- error messages
- translation strings are kept in
/config/locales - please stick to the naming conventions:
- model-names and model-attributes go into
active_record.<locale>.yml - view-specific translations go into
views.<locale>.yml - human language defaults go into
defaults.<locale>.yml - if a gem needs a certain amount of translation strings, these go into
<gem_name>.<locale>.yml - anything else (helpers, etc.) goes into
<locale>.yml
- model-names and model-attributes go into
- use the .scss syntax
- use
@importover to import styles inapplication.css.scss - keep to the conventions of the
application.css.scssmanifest: - the granularity of rules increases top to bottom (general styles on top, more specific ones last)
- global rules go into
base/ - page specific styles into
pages/ - site-wide used component rules go into
base/components.scss(extract a components/ directory if it gets to big)
- global rules go into
To set up a development environment, you can run this command:
Warning, this will drop your database 😱
bundle exec rake db:drop db:setup db:populate
This will:
- drop your database
- re-create it
- load the schema (like running migrations but better)
- run seeds
- run the
lib/tasks/db/populate.taskcommand to load your database with fake data
On top of a bunch of other Event data and users, you will get:
- A volunteer with the email address
[email protected]and password ofpassword - An NGO with the email address
[email protected]and password ofpassword - An admin user with the email address
[email protected]and password ofpassword
You can use the gem letter_opener which opens your emails in a browser tab instead of just printing emails to the logs by running the app like this:
ENABLE_LETTER_OPENER=1 bundle exec rails server
If you run it without the ENABLE_LETTER_OPENER it will run as you would normally expect.