Developing For Runsafe

From Runsafe
Revision as of 18:28, 19 June 2014 by Kruithne (Talk | contribs)

Jump to: navigation, search

NOT YET COMPLETE

Runsafe is an open-source project which means anyone can write code and we'll accept it providing the idea is liked and the code works! Below is a detailed guide on how to set-up a decent development environment for Runsafe and how to submit your changes to us!

Step 1: Git

Step 1A: Download

Navigate to the Git download page (http://git-scm.com/downloads) and from the top, select your operating system, for this guide we are using Windows. This will take you to another page where the download of the installer will start, once it's completed, run the installer executable and move onto the next step.

Step 1B: Installation

Follow the installation wizard through step-by-step and make sure your options match the images below.

Dev guide 2.png Dev guide 3.png Dev guide 4.png Dev guide 5.png

Once the installation wizard is complete, you can click Finish and then move onto the next step.

Step 1C: Set your details

This guide is assuming you have a GitHub account already set-up, if not you should go and do that now, this guide won't explain how to do that as it should be easy to figure out! Open up GitBash, you can do this by the short-cut on your desktop (if you selected that option) or through the start-menu (see image below).

Dev guide 6.png

Once you've clicked that you should see a Git console window, the first thing we're going to do is set your name which will appear on commits, this will make it easier to figure out who you are. Type in the command below and hit enter, obviously putting your name between the quotation marks.

git config --global user.name "Your Name Here"

Next we're going to do the same, but with your e-mail address, this step is important as it is used by GitHub to figure out who you are when pushing changes. Type in the command below and hit enter, obviously putting your e-mail address between the quotation marks. IMPORTANT: The e-mail address must be the one you used when creating your GitHub account.

git config --global user.email "your_email@example.com"

Now you're done, you can close the git console window.

Step 2: Grabbing a Project

Step 2A: Choose the project

Navigate to our GitHub profile (https://github.com/Runsafe/) and find the project you are wanting to make changes to, for this example we will be using Cheeves. Note the exact name we've using for the project and keep the page open as we'll be needing it again shortly.

Step 2B: Create a local repository

Find somewhere on your computer to store the files and create a new folder, call it the same thing we've called the project, as we're using Cheeves for this example, the folder we create will be called Cheeves, with matching case.

Right-click on the folder you've just created and select the option Git Bash Here, this will open a Git console. Type in git init to initialize your local repository, this should display the message "Initialized empty Git repository in <directory_location>". Keep the console window open as you will need it again shortly.

Step 2C: Pull the project from our GitHub

Go back onto the project page for the repository you are editing, Cheeves in this example. Make sure you are logged into your GitHub account and hit the Fork button in the top-right of the page. It might take a moment but when it's done, you will have a copy of the repository on your GitHub account which it should automatically navigate to. In the bottom-right you should see a small text-field with the text "You can clone with HTTPS, SSH, or Subversion." below it. Click on HTTPS and then copy the contents of the text-field which should look something similar to https://github.com/Kruithne/Cheeves.git. Switch back to the Git console window you should still have open from step 2B and type in the following command, replacing the URL at the end with the one you just copied.

git remote add origin https://github.com/Kruithne/Cheeves.git

TIP: To paste into the Git console window, you can paste by right-clicking on the title bar, go to Edit and select Paste.

Now we can pull the code down rather easily using the following command.

git pull

It shouldn't take too long and when it's done, all of the code for the repository will be inside your folder. Keep the Git console window open, as we'll need it again later.

Step 3: IntelliJ

Editing code on GitHub and with Notepad is easy and it works, but it's not intelligent and causes a lot of errors. Ideally you want to have an IDE set-up and this section of the guide will explain how to get our IDE of choice set-up, IntelliJ.

Step 3A: Download

Navigate to the download page for IntelliJ (http://www.jetbrains.com/idea/download/) and select the community edition (it's free)