-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·121 lines (102 loc) · 2.71 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
function notInstalled() {
if command -v $1 &> /dev/null ; then
echo "Already installed $1"
return 1
else
echo "Installing $1"
return 0
fi
}
function installResult() {
if [ $? -ne 0 ]; then
echo " -> Installation failed."
exit
else
echo " -> Installation success!"
source ~/.bash_profile
fi
}
function brewInstall() {
[[ $2 ]] && program=$2 || program=$1
if notInstalled $program ; then
brew install $1 &> /dev/null
installResult
fi
}
function npmInstall() {
[[ $2 ]] && program="$2" || program="$1"
if notInstalled $program ; then
npm install $1 --global &> /dev/null
installResult
fi
}
function gemInstall() {
[[ $2 ]] && program="$2" || program="$1"
if notInstalled $program ; then
gem install $1 &> /dev/null
installResult
fi
}
if notInstalled brew ; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew update &> /dev/null
brewInstall wget
brewInstall node
brewInstall vim
brewInstall zsh
brewInstall postgresql psql
brewInstall redis redis-cli
brewInstall gnupg, gpg
brewInstall rbenv
brewInstall openssl
# Install Docker
if notInstalled docker ; then
wget https://download.docker.com/mac/stable/Docker.dmg
hdiutil mount Docker.dmg
cp -R "/Volumes/Docker/Docker.app" /Applications
hdiutil detach /Volumes/Docker
open /Applications/Docker.app
rm Docker.dmg
fi
npmInstall nodemon
npmInstall release
# Install Ruby
if [ "$(rbenv global)" != "2.5.0" ]; then
rbenv install 2.5.0
rbenv global 2.5.0
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
fi
gemInstall jekyll
gemInstall bundler
# Small Config
defaults write com.apple.screencapture location ~/Pictures/Screenshots
# Heroku Login
heroku auth:whoami &> /dev/null
if [ $? -ne 0 ]; then
heroku login
fi
if [ -f ~/.bash_profile ]; then
read -t 10 -p 'Overwrite .bash_profile? (y/N) ' overwrite
else
read -t 10 -p 'Create .bash_profile? (y/N) ' overwrite
fi
if echo "$overwrite" | grep -iq "^y" ;then
curl -s https://raw.githubusercontent.com/lucasscariot/config/master/.bash_profile > ~/.bash_profile
installResult
source ~/.bash_profile
fi
if [ -f ~/.gitconfig ]; then
read -t 10 -p 'Overwrite .gitconfig? (y/N) ' overwrite
else
read -t 10 -p 'Create .gitconfig? (y/N) ' overwrite
fi
if echo "$overwrite" | grep -iq "^y" ;then
curl -s https://raw.githubusercontent.com/lucasscariot/config/master/.gitconfig > ~/.gitconfig
read -t 10 -p 'Enter your fullname: ' fullname
read -t 10 -p 'Enter your email: ' email
sed -i '' "s/{{fullname}}/$fullname/g" ~/.gitconfig
sed -i '' "s/{{email}}/$email/g" ~/.gitconfig
installResult
fi