Skip to content

Commit 82cd6b2

Browse files
committed
(feature): Add Golang installation for mac and linux
1 parent 23fa788 commit 82cd6b2

File tree

4 files changed

+208
-0
lines changed

4 files changed

+208
-0
lines changed

GO/linux.sh

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
#colors
4+
5+
RED='\033[0;31m'
6+
BLUE='\033[40;38;5;82m'
7+
PURPLE='\033[0;35m'
8+
source ./installers/linux.sh
9+
10+
11+
echo "***** Installing PostgresqlDB, Go and NodeJS ********"
12+
sleep 2
13+
14+
echo "***** Updating services ****"
15+
sleep 3
16+
sudo apt-get update
17+
18+
19+
echo -e "Checking for Nodejs"
20+
sleep 2
21+
if [ -x "$(command -v node)" ];
22+
then
23+
echo -e " ${RED} You have NodeJS installed! \033[0m"
24+
else
25+
install_nodejs
26+
fi
27+
28+
29+
echo -e "Checking for Go"
30+
sleep 2
31+
if [-x "$(command go version)"];
32+
then
33+
echo -e "${RED} GO is installed on your machine! \033[0m"
34+
else
35+
install_go
36+
fi
37+
38+
echo "Checking for Postgresql Database"
39+
sleep 2
40+
if [ $(find /etc/init.d -name postgresql) ]
41+
then
42+
echo -e " ${RED} You have PostgresqlDB installed! \033[0m"
43+
else
44+
echo -e " ${BLUE} Installing Postgresql Database"
45+
sleep 2
46+
sudo apt-get install postgresql postgresql-contrib -y
47+
echo -e " ${BLUE} PostgresqlDB has been installed! \033[0m"
48+
49+
fi
50+
51+
echo Done
52+
echo -e " ${BLUE} Tweet me @odirionyeo \033[0m"

GO/mac.sh

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
#colors
4+
RED='\033[0;31m'
5+
BLUE='\033[40;38;5;82m'
6+
PURPLE='\033[0;35m'
7+
8+
#version
9+
NODEJS_VERSION='10'
10+
MONGODB_VERSION='3.6'
11+
12+
13+
14+
15+
echo "***** Installing PostgresqlDB, Go and NodeJS ********"
16+
sleep 2
17+
18+
19+
echo -e "Checking for Nodejs"
20+
sleep 2
21+
22+
if [ -x "$(command -v node)" ];
23+
then
24+
echo -e " ${RED} You have NodeJS installed!"
25+
else
26+
echo -e " ${BLUE} Installing Nodejs and npm "
27+
sleep 2
28+
brew install node@${NODEJS_VERSION}
29+
echo -e " ${BLUE} Nodejs and npm has been installed!"
30+
31+
fi
32+
33+
echo -e "Checking for Go"
34+
sleep 2
35+
36+
if [-x "$(command go version)"];
37+
then
38+
echo -e "${RED} You have Go installed!"
39+
else
40+
echo -e " ${BLUE} Installing Go"
41+
sleep 2
42+
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
43+
mkdir -p $HOME/go/{bin,src}
44+
echo 'export GOPATH=$HOME/go' >> ~/.bash_profile
45+
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bash_profile
46+
source ~/.bash_profile
47+
brew install go
48+
echo -e " ${BLUE} Go has been installed! \033[0m "
49+
50+
51+
echo "Checking for Postgresql Database"
52+
sleep 2
53+
if [ $(find /usr/local/bin -name postgresql) ]
54+
then
55+
echo -e " ${RED} You have PostgresqlDB installed! \033[0m"
56+
else
57+
echo -e " ${BLUE} Installing Postgresql Database"
58+
sleep 2
59+
brew tap homebrew/services && \
60+
brew install postgresql && \
61+
brew services start postgresql
62+
echo -e " ${BLUE} PostgresqlDB has been installed! \033[0m"
63+
64+
fi
65+
66+
echo Done
67+
echo -e " ${BLUE} Tweet me @odirionyeo"

RUBY/mac.sh

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
3+
#colors
4+
RED='\033[0;31m'
5+
BLUE='\033[40;38;5;82m'
6+
PURPLE='\033[0;35m'
7+
8+
#version
9+
NODEJS_VERSION='10'
10+
MONGODB_VERSION='3.6'
11+
12+
13+
14+
15+
echo "***** Installing PostgresqlDB, Ruby, Rails and NodeJS ********"
16+
sleep 2
17+
18+
19+
echo -e "Checking for Nodejs"
20+
sleep 2
21+
22+
if [ -x "$(command -v node)" ];
23+
then
24+
echo -e " ${RED} You have NodeJS installed!"
25+
else
26+
echo -e " ${BLUE} Installing Nodejs and npm "
27+
sleep 2
28+
brew install node@${NODEJS_VERSION}
29+
echo -e " ${BLUE} Nodejs and npm has been installed!"
30+
31+
fi
32+
33+
echo -e "Checking for Ruby"
34+
if [-x "$(command -v ruby)"];
35+
then
36+
echo -e " ${RED} You have Ruby installed!"
37+
else
38+
echo -e "${PURPLE} Installing Ruby "
39+
sleep 2
40+
brew install ruby
41+
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
42+
source ~/.bash_profile
43+
echo -e "${BLUE} Ruby has been installed!"
44+
fi
45+
46+
echo -e "Checking for Rails"
47+
if[-x "$(command -v rails)"];
48+
then
49+
echo -e "${RED} You have Rails Installed!"
50+
else
51+
echo -e "${PURPLE} Installing Rails"
52+
gem install rails
53+
echo -e "Rails has been installed!"
54+
fi
55+
56+
57+
echo "Checking for Postgresql Database"
58+
sleep 2
59+
if [ $(find /usr/local/bin -name postgresql) ]
60+
then
61+
echo -e " ${RED} You have PostgresqlDB installed! \033[0m"
62+
else
63+
echo -e " ${BLUE} Installing Postgresql Database"
64+
sleep 2
65+
brew tap homebrew/services && \
66+
brew install postgresql && \
67+
brew services start postgresql
68+
echo -e " ${BLUE} PostgresqlDB has been installed! \033[0m"
69+
70+
fi
71+
72+
echo Done
73+
echo -e " ${BLUE} Tweet me @odirionyeo"

installers/linux.sh

+16
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,19 @@ function install_ruby {
3737
sudo apt-get install ruby-full
3838
echo -e " ${BLUE} Ruby has been installed! \033[0m "
3939
}
40+
41+
function install_go {
42+
echo -e "${BLUE} Installing Go"
43+
sleep 2
44+
wget https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz
45+
sudo tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz
46+
echo "What do you want to call your go workspace?"
47+
read goworkspace
48+
mkdir -p ~/"$goworkspace"/{bin,src,pkg}
49+
echo "You selected $goworkspace as your workspace for go."
50+
echo 'export PATH="$PATH:/usr/local/go/bin"' >> ~/.profile
51+
echo "export GOPATH=~/$goworkspace" >> ~/.profile
52+
echo 'export GOBIN=$GOPATH/bin' >> ~/.profile
53+
source ~/.profile
54+
echo -e " ${BLUE} Go has been installed! \033[0m "
55+
}

0 commit comments

Comments
 (0)