Skip to content

Commit 0e0d32d

Browse files
committed
update script for java dev environment
add installers for all of the tools we'll need for the back-end of the course
1 parent 934fde1 commit 0e0d32d

File tree

2 files changed

+49
-12
lines changed

2 files changed

+49
-12
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ If students already have and `id_rsa` ssh key generated the script will *not* tr
1212
generate a new ones, and you will need to walk them through the process of adding
1313
their existing key to Github.
1414

15-
The following should do the trick if they have a ssh key pair, but it's not
16-
wired up to Github.
15+
The following should do the trick if they already have a ssh key pair, but it's
16+
not wired up to Github.
1717

1818
```bash
1919
pbcopy < ~/.ssh/id_rsa.pub

install.sh

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
#!/bin/bash
22

33
# Setup script for codeup student's laptops
4-
5-
# TODO: setup mysql
6-
# TODO: setup tomcat
7-
# - both should be installable with brew.
8-
# - brew has versions mysql 5.7, tomcat 8.5.5
9-
10-
# Overview
11-
# ========
4+
# =========================================
5+
#
6+
# This script will
7+
#
128
# 1. check for xcode, if it does not exist go ahead and install it
139
# 2. do the same for brew
1410
# 3. if $HOME/.ssh/id_rsa does not exist, generate ssh keys and open github so
15-
# it can be configured there
11+
# they can be configured there
12+
# 4. install java with brew cask
13+
# 5. check for maven and tomcat, install them with brew if not present
14+
# 6. check for mysql, install it and configure if not present
1615

1716
wait-to-continue(){
1817
echo
@@ -36,6 +35,26 @@ install-xcode(){
3635
echo
3736
}
3837

38+
install-java(){
39+
echo 'We are now going to use homebrew to install java. While your mac comes'
40+
echo 'with a version of java, it may not be the most recent version, and we want'
41+
echo 'everyone to be on the same version.'
42+
wait-to-continue
43+
brew cask install java
44+
}
45+
46+
install-tomcat(){
47+
echo 'We are now going to install tomcat, the java web server we will use for this course'
48+
wait-to-continue
49+
brew install tomcat
50+
}
51+
52+
install-maven(){
53+
echo 'We will now install maven, a build tool and dependency manager for java'
54+
wait-to-continue
55+
brew install maven
56+
}
57+
3958
install-brew(){
4059
echo 'We are now going to install homebrew, a package manager for OSX.'
4160
wait-to-continue
@@ -76,6 +95,8 @@ setup-ssh-keys(){
7695
install-mysql(){
7796
echo 'We are now going to install and configure MySQL, the database managment system we will'
7897
echo 'use for this course.'
98+
echo 'We will lock down your local MySQL install so that only you can only access it'
99+
echo 'from this computer'
79100
wait-to-continue
80101

81102
brew install mysql
@@ -95,10 +116,19 @@ DELETE FROM mysql.user WHERE User='';
95116
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
96117
FLUSH PRIVILEGES;
97118
EOF
98-
99119
}
100120

101121
echo 'We are going to check if xcode and brew are installed, and if you have ssh keys setup.'
122+
echo 'We will then setup our java development environment, including installing MySQL.'
123+
echo ''
124+
echo 'All together we will be installing: '
125+
echo ' - xcode tools - brew'
126+
echo ' - java - maven'
127+
echo ' - tomcat - mysql'
128+
echo '*Note*: if you have already setup any of the above on your computer, this script will _not_'
129+
echo ' attempt to reinstall them, please talk to an instructor to ensure everything'
130+
echo ' is configured properly'
131+
echo ''
102132
echo 'During this process you may be asked for your password several times. This is the password'
103133
echo 'you use to log into your computer. When you type it in, you will not see any output in the'
104134
echo 'terminal, this is normal.'
@@ -110,6 +140,13 @@ xcode-select --print-path >/dev/null 2>&1 || install-xcode
110140
which brew >/dev/null 2>&1 || install-brew
111141
[ -d $HOME/.ssh ] && [ -f $HOME/.ssh/id_rsa ] || setup-ssh-keys
112142

143+
# check if java was installed with brew cask if not install it
144+
brew cask list java >/dev/null 2>&1 || install-java
145+
# check for tomcat, maven, and mysql
146+
which mvn >/dev/null || install-maven
147+
which catalina >/dev/null || install-tomcat
148+
which mysql >/dev/null || install-mysql
149+
113150
echo "Ok! We've gotten everything setup and you should be ready to go!"
114151
echo "Good luck in class!"
115152
echo

0 commit comments

Comments
 (0)