Skip to content
This repository has been archived by the owner on Oct 18, 2018. It is now read-only.

Latest commit

 

History

History
108 lines (95 loc) · 4.56 KB

UBUNTU_SETUP.md

File metadata and controls

108 lines (95 loc) · 4.56 KB

Setting up your Ubuntu computer so you can contribute

We will walk through the steps, but at a high level, they are:

  1. Install Git
  2. Install Curl
  3. Install RVM (Ruby Version Manager)
  4. Install Ruby 1.9.3
  5. Install PostgreSQL
  6. Clone the source
  7. Create a gemset
  8. Install required libraries
  9. Create and migrate databases
  10. Contribute!

Install Git

git is an extremely powerful source-code management tool. We use it in conjunction with Github to manage changes to the code that runs this project. You can install it with apt:

sudo apt-get install git

Install Curl

Curl is a command-line tool for fetching data from remote servers. In a moment we'll use it to install RVM. For now, install it from apt:

sudo apt-get install curl

Install RVM

RVM is a tool for installing and managing different versions of Ruby, as well as creating "gemsets", self-contained environments for Ruby libraries that prevent subtle, hard-to-diagnose, hard-to-resolve problems when working on multiple Ruby projects. In short, RVM is a cheap solution to an expensive problem. You can install RVM by pasting a single line into your terminal:

\curl -L https://get.rvm.io | bash -s stable

Now that RVM is installed, you need to import it into your shell:

source ~/.rvm/scripts/rvm

Install Ruby 1.9.3

The production environment runs Ruby 1.9.3, so you should use that version during development as well. Having installed RVM, installing this version of Ruby is easy:

rvm install 1.9.3
rvm use --default 1.9.3

Install PostgreSQL

This project relies on a PostgreSQL database. You can install PostgreSQL using apt:

sudo apt-get install postgresql libpq-dev

Clone the Source

It is best to create your own fork of this project to contribute to it. You can do that by clicking this here link. Now that you have your own fork, you can use git to get a copy of the source for this site (remember to replace <your-github-username> with your actual Github username):

git clone [email protected]:<your-github-username>/green_mercury.git
cd green_mercury
git remote add upstream https://github.com/code-scouts/green_mercury.git

Note that the first command will fail if you have not yet set up ssh keys for Github. They provide an excellent guide to this, which you should follow if you need help. The full range of things you can do to the code using Git and Github is outside the scope of this document, but it is extensive. If you're new to Git and Github, try Github's interactive tutorial for a crash course.

Create a Gemset

Remember earlier, when we said RVM could create Gemsets, and they were important? Time to put that to work:

rvm gemset create green_mercury
rvm gemset use green_mercury

Install required libraries

This project uses Bundler to manage its dependencies. That means it takes only a single command to get all the code libraries you need:

bundle install

Create And Migrate Databases

Now that you have the dependencies installed, it's time to create the databases for the site. At your terminal run sudo -u postgres psql postgres. This will open a Psql prompt, where you'll create a user and a database. Replace <me> with your Ubuntu username below:

create role <me> with login createdb password 'hacktehplanit';
create database green_mercury owner <me>;
create database green_mercury_test owner <me>;
commit;
\q

That creates an empty database, so you just need to set it up with the proper tables:

rake db:migrate
rake db:migrate RAILS_ENV=test

Contribute!

Whew! That was quite a bit of setup. Fortunately, most of it was one-time-only: If you want to contribute to another project you'll be able to skip most of what you did this time around.

Once you have some changes that you think will improve the site, commit them with git:

git commit -a -m "A brief summary of what you did"
git push origin

Then use the new-pull-request page to create a pull request so we can see your great work!