Development - adammitha/infant_passport GitHub Wiki

##Getting Started# Ensure that you've installed all the dependencies necessary for basic Ruby on Rails development; see http://installrails.com for more info. After you've installed all the necessary software, download GitHub for Windows in order to access the source code. Once you've installed the software and logged into your GitHub account, clone the infant-passport repository to your local machine.

You will also need to install the Heroku toolbelt in order to interact with the production and staging servers. Once you've done this, open the command line and cd into the directory where you've cloned the app. Run the commands heroku git:remote -a production-infant-passport and heroku git:remote -a staging-infant-passport. These allow you to push to the production and staging web servers -- however, only push to the production web server if the group has decided to release a new version of the app. Should you wish to test the app in a production environment, push to the staging web server.

N.B. You can rename the Heroku remotes using the command git remote rename oldname newname. You can check the current names of the remote by running git remote -v.

##Source Control# Before you begin working on the application, ensure you have the most up-to-date version of the codebase by running git pull origin master from the command line. If you are only making minor changes or bug fixes you can make changes on the main branch. However, any feature additions or major alterations should be done on a separate branch -- run git checkout -b my-branch in order to create a new branch.

Once you've made all the necessary changes, run git add -A to add all new files to git, then git commit -a -m "Commit message" to commit your changes to your local repository. Ensure that your commit message is sufficiently descriptive that the other team members are able to understand what you did. Then run git checkout master to switch back to the master branch, followed by git merge my-branch in order to merge your changes back into the main branch. Finally, run git push origin master to push your changes back to the GitHub repository.

##Editing the Code# ###First Steps# After cloning the code to your local machine for the first time, it is necessary to install all the required Ruby gems for development. Open the command line, cd into the app directory and run bundle install to download the relevant dependencies. You are now ready to begin development!

###Best Practices# Since this is a collaborative project, ensure that you adequately comment your code so that others may build upon it. For major additions, create a new page on the wiki which outlines what you did and how you did it, including any vendor code or new gems you may have added to the app.

When adding a new gem, don't install it via gem install my-gem. This only installs it on your local machine, and doesn't tell Heroku to install it before deploying the app on the production server. Instead, add the gem to the Gemfile and run bundle install. This ensures that everyone has the most up-to-date set of dependencies.

##Publishing#

bundle exec rake test
git push staging master
heroku pg:reset DATABASE
heroku run rake db:migrate
heroku run rake db:seed