Skip to content

Instantly share code, notes, and snippets.

@pbyrne
Last active December 15, 2015 05:09
Show Gist options
  • Save pbyrne/5206866 to your computer and use it in GitHub Desktop.
Save pbyrne/5206866 to your computer and use it in GitHub Desktop.
Instructions to set up a Sport Ngin laptop.

These instructions focus on performing Automation commands for our Node.js applications. Additional work is required to run the applications, and further work to run our Rails applications.

Prepare Laptop

Install Xcode and Command-Line Build Tools

NOTE: Let's try skipping this whole section for newly set up laptops. The addition of brew install gcc-apple42 below should eliminate this necessity.

  1. Find Xcode in the App Store and install it. This may take a while to download.
  2. Launch Xcode.
  3. Choose Preferences from the Xcode menu.
  4. Select the Downloads tab.
  5. Choose to install the Command Line Tools.

Install Development Tools

We use RVM to manage the different versions of Ruby that our applications use. We use Homebrew to install additional tools (like Git) easily. Perform the following steps in the Terminal (/Applications/Utilities/Terminal).

  1. Install Homebrew with the following command: ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
  2. Install some development dependencies with the newly installed Homebrew: brew install apple-gcc42 git
  3. Install RVM with the following command: curl -L https://get.rvm.io | bash -s stable
  4. Tell RVM to use Homebrew to install any missing dependencies: rvm autolibs brew.
  5. Download Node.js 0.8 and install it with the included installer.
  6. Install Grunt (a Node.js tool to perform tasks in your project) with the command: sudo npm install -g grunt-cli
  7. Close your Teriminal window and open a new one. This will ensure that the settings changes from the above steps take effect.

Get Code from GitHub

Set Up SSH For GitHub

Before closing a repository from GitHub with SSH, you must set up an SSH key to authenticate your computer with their servers. This only needs to be done once. To confirm whether you have to perform this step, try this command: ssh git@github.com. If you see a message similar to "Hi pbyrne! You've successfully authenticated" then you do not need to perform this step, as it's already been done.

  1. Generate a new SSH key with ssh-keygen and follow the prompts.
    • When prompted to supply a name for the new key, use the default name ("id_rsa") by pressing Enter without typing anything, unless you have a good reason to give it a different name.
  2. Copy the contents of the newly generated public key with the following command: pbcopy < ~/.ssh/id_rsa.pub
  3. Browse to GitHub's SSH settings page and click the Add Key button.
  4. Give the new key a descriptive name ("Sport Ngin laptop SSH key") and paste the contents of the public key into the space provided.

Clone Repositories

  1. Fetch the URL to clone a repository from the project's page on GitHub.
  2. Create a directory to hold your checked-out projects: mkdir ~/workspace
  3. Navigate to that new directory: cd ~/workspace
  4. Clone the repository: git clone URL_FROM_STEP_1

Install Application-Specific Dependencies

  1. If working with an application that uses MySQL, install MySQL 5.5.
  2. If working with Ngin, install freeimage: brew install freeimage.

Perform Bundle

Bundler installs all necessary Ruby dependencies and provides access to the scripts provided by our Automation gem.

  1. Navigate into the checked-out project: cd ~/workspace/NAME_OF_DIRECTORY
  2. If you're prompted to install a missing version of Ruby, perform the command that RVM provides to you, to install that version of Ruby.
  3. Ensure that everything is installed with bundle command.
  4. Run whichever command you want, prefixed with bundle exec. For example, bundle exec deploy or bundle exec deployable 123.

If you want to run the application, some more steps are required.

Perform Grunt

@carlallen
Copy link

Brew pulled apple-gcc42, if you want it you need to get it from the command line tools. Fortunately if you have an apple developer account you can download them directly:

Go to: https://developer.apple.com/downloads/index.action
Sign in (or sign up for a free account if you need it)
search for "Command line tools"
Download and install the appropriate version for your OS

@carlallen
Copy link

Installing node from nvm:

curl https://raw.github.com/creationix/nvm/master/install.sh | sh
nvm install 0.8

You then also do not need to install grunt as root, you can just run

npm install -g grunt-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment