Rails Girls Cloud9 Setup Guide

*Created by Sorcha Abel

Sign up for a Github account.

By now you should have received an email invite to use Cloud 9. The image below is a sample only :)

The link will take you to the Cloud 9 website and from here you should use your github credentials (created in the first step above) to login. Simply click on the github icon (see below)

Once you have signed up, you will be shown your dashboard. Create a New workspace by clicking the green plus icon.

Name your new workspace railsgirls, and make sure you are creating a Ruby workspace. Then click ‘Create workspace’.

You will then be taken directly to your new workspace.

Upgrading to Rails Version 5

By default Cloud9 comes with rails version 4 installed. But there is a newer version of Rails available and at Rails Girls we like to stay ahead of the game. Lets upgrade our environment to Rails 5

These steps can be a little tricky so if you are unsure just ask a mentor for help. Lets get started

  1. Ensure your cursor is in the bash window (also known as terminal window, see the screen shot below) and type cd .. This command will ensure we are in the root of the project and not inside our workspace folder. This folder will contain our app but we don’t need to be in it to do our rails version install.

  2. When ready type gem install rails

  3. When completed type sudo apt-get update this will ensure we have the latest packages

  4. Next type rails new rails5-proj this will be a temp project, we will remove it a bit later

  5. Then enter mv workspace workspace.bck here we are taking a backup of our workspace (its the workspace with the old version of Rails and we don’t really need it again but generally it’s safer to rename a directory than deleting especially when you are learning)

  6. Enter mkdir workspace here we are making a new workspace, this will be for our Rails 5 version. The Blog App that we are about to build will be contained within the workspace folder.

  7. Enter cd rails5-proj this will move you into the rails5-proj directory

  8. Then cp -r * ../workspace here we are simply copying everything into our new workspace directory (this is the Rails 5 one)

  9. Type cd .. to simply move up one level in the directory structure and then type ls to see a list of the files in the current directory. It should be similar to this

  10. You should see a folder called rails5-proj we are going to remove it now, simply type rm -rf rails5-proj

  11. Finally move into the workspace folder so we can start building our Rails 5 app, type cd workspace

  12. Let’s type bundle install so we know all our gems are up to date (gems are basically libraries that contains pre-written code so that you don’t have to write it from scratch)

Workspace environment

The workspace is made up of a few important areas.

Set up the text editor

The Ruby global convention is to use 2 spaces for indentation. Lets change the default editor to use 2 spaces.

Click on the settings icon in the upper right side of the window. A preferences window will open edit the Soft Tabs setting to reduce it to 2. Cloud 9 editor

Viewing your project in the Browser

From the ruby-railsgirls terminal you need to start the rails server. Click the ‘Run Project’ button.

Cloud 9 Rails Server

Click on the share button in the top right window. From the Share this workspace window click on the url in Application and select the open option

You may see the Cloud 9 preview page, if so click on the Open the App button

Welcome

The Welcome Aboard Ruby page will be displayed

Welcome

Keep in touch

Follow us on twitter

Sorcha

Rachelle

Rails Girls Brisbane

Read the Rails Girls Brisbane blog http://railsgirlsbne.com/

Email us: Rails Girls Brisbane

Join our Facebook Group: Rails Girls BNE Group