Skip to content
João Pereira edited this page Jul 10, 2019 · 38 revisions

Note: The following assumes you have a ruby development environment setup on your local machine.

Project Requirements

  • GitHub Account
  • Git
  • Ruby v2.3.3
  • Rails 4.2.3
  • Docker compose (Optional)

Step 1: Fork the repository

Forking the project creates a copy of the code base which you can modify without affecting the main code base. Once you are satisfied with your changes, you can make a pull request to the main repository.

Visit the project homepage on GitHub https://github.com/AgileVentures/MetPlus_PETS Fork the project by clicking the Fork button on the top-right hand corner. Wait while the repository is being forked. All done!

Now that you have a fork of the project, copy the URL for the repository (just below the sidebar on the right) and clone the project using Git:

$ cd to/some/directory
$ git clone https://github.com/<your-github-username>/MetPlus_PETS.git

You also need to configure remote to point to the main project repository in order to get latest updates. (This will be required at a later stage when submitting your features)

$ cd MetPlus_PETS
$ git remote add upstream https://github.com/AgileVentures/MetPlus_PETS.git

Step 2: Install Project dependencies

$ bundle install --without production

Step 3: Get "super secret" data

Sensitive or secret information (e.g. email server credentials) are maintained in this file:

config/application.yml

That file will not be present in the environment because it is not maintained in git and thus is not pulled down from github. Contact one of the project members to get the contents of that file (for example via private message in Slack).

Step 4: Create and update the database

You should execute the following command to create the Development database:

$ createdb metplus_pets_development

You should execute the following command to create the Test database:

$ createdb metplus_pets_test

Run the database migration scripts

$ bundle exec rake db:create
$ bundle exec rake db:migrate
$ bundle exec rake db:seed

See "Note" below regarding subsequent updates to the database.

For the Test environment the migrations scripts need to be run as well:

$ bundle exec rake db:create RAILS_ENV=test
$ bundle exec rake db:migrate RAILS_ENV=test

Step 5: Run the tests

$ bundle exec rspec
$ bundle exec rake cucumber

Discuss any errors with the team.

NOTE REGARDING TESTING JAVASCRIPT: You will need to install chromedriver so that cucumber tests that use the selenium driver can run successfully.

Step 6. Start the server

$ bundle exec rails s

Step 6.1. Start local cruncher

To enable easier development if you need to interact with the cruncher or want to run cucumber tests locally, a docker compose cruncher can be found in /cruncher folder

$ docker-compose -f cruncher/docker-compose.yml up -d

The prior command will start 2 containers in the background one with the cruncher and another with a mongo db. The cruncher will be listenning at http://localhost:8081/ and the mongo db at port 27018. To use it in the application add the following to config/application.yml

CRUNCHER_SERVICE_URL: 'http://localhost:8080/api/v99999'
CRUNCHER_SERVICE_USERNAME: 'cruncher_user'
CRUNCHER_SERVICE_PASSWORD: 'cruncher_password'

v99999 is the testing version of the api, change it to v2 for the real API

Step 7. Start the DelayedJob process

$ bundle exec rake jobs:work

(we use delayed_job gem for processing certain actions asynchronously - such as sending emails. This process scans the associated DB table for jobs periodically and processes those jobs)

Step 8. Get access to Waffle

We use waffle (from Github) for issues and story tracking. To be added as a collaborator to waffle (so you can take ownership of a story, for example), please provide your Github user name to João Pereira on slack (joaopereira) and ask to be added as a collaborator.

Notes

  1. Updating the database - updates to the development DB (after the first described above) should be performed with this command:
rake db:drop db:migrate db:seed

This is because some of the migration files actually add records to the DB. These need to be present for the seeding to work. (that is, rake db:reset will not work because it does not actually run the migration files, but simply reloads the DB schema from db/schema.rb).

Troubleshooting

You can find some solutions on this page

Clone this wiki locally