Setting up Development Environment - addisonmartin/share-the-food GitHub Wiki

These instructions will get you a local copy of the project up and running on your local development machine. See the table of contents, for instructions on testing or deployment.

If you encounter any errors with this wiki, or the project in general, please submit a new issue!

Prerequisites

You will need:

  • Git.
  • Ruby, or a Ruby language version manager such as rbenv.
  • Ruby on Rails.
  • PostgreSQL.

Optional

  • Heroku Command Line Interface, for production configuration, deployment, etc.

Installation

Git

Make sure git is installed on your local development machine. If it's not, install it now.

Ruby

Install rvm (or another similar Ruby language version manager).

The project's specified Ruby version is located in the file share-the-food/.ruby-version. Rvm and most other version managers will automatically look for that file and use the version it specifies.

If you need to manually install and use a Ruby version, run the following commands.

rvm install 2.6
rvm use 2.6

Ruby on Rails

Install the Ruby on Rails framework using the built-in Ruby package manager. Simply run the following command once Ruby is installed.

gem install rails

PostgreSQL

Make sure PostgreSQL is installed on your local development machine. If it's not, install it now.

Start a PostgreSQL server on your local development machine.

service postgresql start

Heroku (Optional)

Optionally, if you would like to configure production server or deployment settings, install the Heroku CLI.

Cloning the Project

First, clone the repository onto your local machine.

git clone https://github.com/addisonmartin/share-the-food.git

Navigate into the project's root folder.

cd share-the-food/

Next, checkout a branch other than master, as no one can push directly into master.

git checkout development

Project Dependencies and Database

Install all the project's dependencies using Rail's built-in package manager. Dependencies are listed in share-the-food/Gemfile.

bundle install

Create the database on your local machine.

bundle exec rake db:create

Migrate the database schema into the newly created database. The database schemas are defined in share-the-food/db/migrate/*.

bundle exec rake db:migrate

Seed some sample data into the newly created database. The seed data is stored in share-the-food/db/seeds.rb.

bundle exec rake db:seed

Launching the Server

Navigate into the project's root folder.

cd share-the-food/

Start the server.

rails server

Open your web browser, and visit the site.

localhost:3000

If everything is fully working, you are ready to go! Press crtl+c to stop the server.