If you happened to come across a bug or want to suggest a feature, feel free to say something!
If you'd like to contribute code, the steps below will help you get up and running.
Resource
or @resource
is an instantiated Avo::Resource
object.
resource_name
: Pluralized, machine name, snake cased version of a resource. Ex: resource_name
for /avo/resources/team_memberships
path is going to be TeamMemberships
.
Model
or @model
: Active Record Model
object.
Please fork Avo and create a descriptive branch for your feature or fix.
NOTE: We're using docker-compose
to run Postgres. While we find this incredibly helpful, it's not a requirement, but you'll have to BYOD (Bring Your Own Database).
Once you pull the code down to your machine, running bin/init
will get you up-and-running.
If you chose to continue with Docker, you'd be able to run it with one of the following commands:
- Run in the foreground:
docker-compose up
- Run in the background:
docker-compose up -d
If you chose to run your own database, if need be, you'll be able to set the following environment variables:
- Host:
POSTGRES_HOST
(Default:localhost
) - Port:
POSTGRES_PORT
(Default:5433
) - Username:
POSTGRES_USERNAME
(Default:postgres
) - Password:
POSTGRES_PASSWORD
(Default:nil
)
Make sure you setup the database by running RAILS_ENV=test bin/rails db:setup
and have the latest migrations on the database layer too by running RAILS_ENV=test bin/rails db:migrate
. This creates the database and applies the migrations to the docker container that holds the database.
We've set up a few helpers to get you going:
- Run all tests (slow):
bin/test
- Run unit tests (fast):
bin/test unit
- Run system tests (slow):
bin/test system
- Run a particular spec file/test (fast):
bin/test ./spec/features/hq_spec.rb
You may want to run the tests on your local database (not on your docker container). To do that, update your .env.test
file with valid credentials for your local installation.
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=
You'll probably need to update your POSTGRES_PORT
to 5432
(5433
is used for the docker container), but check your local credentials.
Run AVO_ADMIN_PASSWORD=secret bin/rails db:seed
to seed the database with dummy data and create a user for yourself with the email admin@avohq.io
and password secret
.
We use appraisal to run tests against multiple versions of rails. When the gemfile gets updated you must also run bundle exec appraisal install
to update the versioned ones and commit them to the repo.