Gr8Ladies Gr8Workshop Setup Instructions - gr8workshops/gr8workshops-content GitHub Wiki

Prerequisites

A working laptop with power cord. Internet access.

Overview

We’ll need a few developments tools to get setup. You are welcome to substitute the equivalent of your choice, but we have suggestions for each category if you don’t have a preference.

  1. Text Editor
  2. Shell program
  3. Java
  4. Groovy
  5. Grails
  6. Git

Text Editor

  • For the ‘New to Coding’ level, sublime text is sufficient and runs on most operating systems. Sublime can be downloaded from http://www.sublimetext.com/2.

  • For ‘New to Groovy’ learners, we suggest the IDE IntelliJ from JetBrains. You can download it at http://www.jetbrains.com/idea/. The community edition is available for free and sufficient for the scope of this course. Alternatively, you could use Eclipse or Netbeans for Groovy, but we might not be able to help you with IDE issues.

Shell Program

  • Mac: The shell program is built in and no installation is necessary. It is called the 'Terminal' and can be found by opening the Finder and going to Applications -> Utilities -> Terminal.

  • PC: we suggest downloading msysgit. The program Git Bash will serve as the terminal and it will also have git, curl, and other useful tools. Download from http://msysgit.github.io/ Please run as administrator to avoid issues with permissions. When installing, choose "use from bash only." Then, choose "Checkout Windows style commit unix-style endings."

SDKMAN

To install Groovy and Grails we suggest sdkman, the Software Development Kit Manager.

  • To install sdkman, open the terminal and type curl -s get.sdkman.io | bash The symbol between .io and bash is the pipe. This should be achieved by pressing shift along with the key above enter/return.
  • Then, ignore the output and restart the terminal (this means close all the terminal windows and reopen the terminal).

Next find the latest available version for each project you want to install and then install it.

  • For example, Type sdk list java. Then, type sdk use java 8u121 or use the most recent version that starts with 8. This is very important because many libraries will not work with java 9! When prompted, type y and press enter to install it. For java installations, you will also need to agree to the oracle license agreement. In the same way, type y and press enter. Installing java will require admin rights so when prompted, enter the password you use for this computer.
  • To verify the installation succeeded, type java -version and you should get a response like the one in the next section. If this step fails, try again or use the manual instructions below.

Next, install groovy and grails.

  • Start by typing sdk list groovy
  • Type sdk use groovy 2.4.9 or the newest version available. When prompted, type y and press enter.
  • Next type sdk list grails
  • Then, type sdk use grails 3.2.7 or the highest number available. When prompted, type y and press enter.
  • To verify your installs, type groovy -version and press enter. The output should begin with "Groovy Version: 2.4.9" or the version number you installed.
  • To verify your grails install, type grails -version and press enter. The output should be "Grails version: 3.2.7" or the version number you installed. Please note that the groovy version may be different than the one you installed. That is ok and grails will know how to handle it.

Java (if you are unable to install it through sdkman)

If you were unable to get it through sdkman, you will need to install the java jdk manually. To check if this is already installed, try typing ‘java -version’ (remove the quotes) from the terminal. You should see something like this:

java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

Any Java 7 or Java 8 installation will work. If there isn't a java JDK on your machine or if it's not 7 or 8, download the most recent java version for your operating system. Go to http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html and accept the license agreement.

  • Mac:

    • Select jdk-7u71-macosx-x64.dmg (for "Mac OS X x64") to download. Wait until the download completes. From your downloads, click on jdk-7u71-macosx-x64.dmg (if it says jdk-7u71-macosx-x64.dmg.part, it has not yet completed downloading). Find the window that pops up and double click on the icon. An installer window will open that can be found on the toolbar. Click "Continue" and then "Install." You will be asked to enter a password. This is the password you use to login to your computer. Enter it and hit enter or click "Install Software." When it is finished, you can select "Close" on the Installer window. To test that the install worked, go to your terminal and type java -version and hit enter.
    • Set the environment variable for JAVA_HOME. To do this, open the shell. To set java home in the current session you can type echo export JAVA_HOME=`/usr/libexec/java_home -v 1.7` >> .profile and press enter in your terminal. NOTE: the ` is the “back-tick,” not a comma. The back-tick is on the same key as the ~, in the upper left corner of the keyboard.
    • Type source .profile and press enter. To test, type echo $JAVA_HOME and press enter. /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home (or the location or your java installation) should print to the screen.
    • if you see this message: JAVA_HOME is not defined correctly, can not execute: /System/Library/Frameworks/JavaVM.framework/Home/bin/java
    • Try setting java home to /Library/Java/JavaVirtualMachines/(version number)/Contents/Home and then run source .profile
  • PC (before Windows 8):

    • Right-click on the My Computer icon on your desktop and select Properties.
    • Click the Advanced tab. Click the Environment Variables button.
    • Under System Variables, click New. Enter the variable name as JAVA_HOME.
    • Enter the variable value as the installation path for the Java Development Kit. The default is C:\Program Files\Java\jdk1.7.0_71
    • Click OK. Click Apply Changes.
  • Window 8.0+:

    • Scroll over the top right corner.
    • Select the magnifying glass and search for 'environment variables' .
    • Next, select 'Edit the system environment variables'.
    • In the window that pops up, select the 'Environment Variables' button.
    • In the second window from the top, find the row where the variable is 'Path' and click 'edit'.
    • At the end of the input titled 'Variable value', add a semi-colon if one doesn't exist and then add the path to where you installed Java.
    • For the suggested jdk7 download, the default is C:\Program Files\Java\jdk1.7.0_71 Also, add a new variable JAVA_HOME if it doesn't exist. Set this to the same path.
    • Try typing java -version from your terminal. You should see Java 1.7.0_71 as output. If java is still not installed, verify your path is set correctly.
    • Next type echo $JAVA_HOME in the terminal. You should see the path to your java installation. If it's blank, verify your settings.
  • Other: Set the environment variable for JAVA_HOME to the location where you install the download. For help specific to your operating system, search for it on google.

Verify your installs

  • From the terminal, navigate to the directory where you want to work. Type grails create-app demo and press enter. This will create a new grails application folder called demo.
  • Wait until the terminal prints "Created Grails Application."
  • Type cd demo and press enter. This will change your current directory to be the grails application directory you just created.
  • Type grails run-app and press enter. This will run the application you created.
  • Wait until the terminal prints "Grails application running at http://localhost:8080 in environment: development"
  • Navigate, in a browser, to http://localhost:8080
  • You should see a green and white screen that says "Welcome to Grails".

Version Control

For the advanced track only Git is the suggested version control for maintaining code. If you already downloaded msysgit fo PC, you have git installed already. Otherwise, please download the correct version for your operating system(os) at http://git-scm.com/downloads and start reading the docs at http://git-scm.com/book/en/Getting-Started-About-Version-Control if you aren’t familiar with version control already. To host your code, we suggest http://github.com. Please setup an account before the workshop. Some of the sessions will require the download of code from repositories hosted on github.

Need help?

If you get stuck, feel free to email [email protected]. There will also be a little time at the beginning of the day to help with setup.