-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.sh
executable file
·191 lines (144 loc) · 4.42 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/usr/bin/env bash
libs=(apps brew dotfiles fonts npm quicklook ruby sublime tools)
# Help text
source ./lib/help
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
run_help
exit
fi
source ./lib/utils
# Source the necessary files and helper scripts
for i in "${libs[@]}"; do
source ./lib/$i
done
if array_contains "$1" "${libs[@]}"; then
seek_confirmation "Do you want to install $1"
if is_confirmed; then
run_$1
fi
exit
else
seek_confirmation "Do you want to proceed with the installation"
if ! is_confirmed; then
exit
fi
fi
sudo -v
sudo chown -R $USER /usr/local/
git pull
# Before relying on Homebrew, check that packages can be compiled
if ! type_exists 'gcc'; then
e_error "The XCode Command Line Tools must be installed first."
printf " run 'xcode-select --install' and follow the instrucctions\n"
printf " Then run this setup script again.\n"
exit 1
fi
# __ __ __
# / / / /___ ____ ___ ___ / /_ ________ _ __
# / /_/ / __ \/ __ `__ \/ _ \/ __ \/ ___/ _ \ | /| / /
# / __ / /_/ / / / / / / __/ /_/ / / / __/ |/ |/ /
# /_/ /_/\____/_/ /_/ /_/\___/_.___/_/ \___/|__/|__/
# Check for Homebrew
if ! type_exists 'brew'; then
e_process "Installing Homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
e_process "Installing Homebrew packages"
run_brew
# ____ __
# / __ \__ __/ /_ __ __
# / /_/ / / / / __ \/ / / /
# / _, _/ /_/ / /_/ / /_/ /
# /_/ |_|\__,_/_.___/\__, /
# /____/
# Check for rvm
if ! type_exists 'rvm'; then
e_process "Installing RVM..."
curl -L https://get.rvm.io | bash -s stable --ruby
fi
e_process "Installing Gems"
run_ruby
# _ ______ __ ___
# / | / / __ \/ |/ /
# / |/ / /_/ / /|_/ /
# / /| / ____/ / / /
# /_/ |_/_/ /_/ /_/
#
e_process "Installing NPM Packages"
run_npm
# ______ __
# /_ __/___ ____ / /____
# / / / __ \/ __ \/ / ___/
# / / / /_/ / /_/ / (__ )
# /_/ \____/\____/_/____/
#
if ! type_exists 'push'; then
e_process "Installing git-friendly"
sudo bash < <( curl https://raw.githubusercontent.com/jamiew/git-friendly/master/install.sh)
fi
if ! type_exists 'pygmentize'; then
e_process "Installing pygments"
sudo easy_install Pygments
fi
e_success "All packages have been installed"
# ____ __
# / __ )____ ______/ /_
# / __ / __ `/ ___/ __ \
# / /_/ / /_/ (__ ) / / /
# /_____/\__,_/____/_/ /_/
#
if [ -f /usr/local/bin/bash ]; then
if grep -Fxq "/usr/local/bin/bash" /etc/shells; then
echo ""
else
sudo sh lib/bash
fi
if [[ $SHELL != '/usr/local/bin/bash' ]]; then
chsh -s /usr/local/bin/bash
fi
fi
# __ __ _____ __
# ____/ /___ / /_/ __(_) /__ _____
# / __ / __ \/ __/ /_/ / / _ \/ ___/
# / /_/ / /_/ / /_/ __/ / / __(__ )
# \__,_/\____/\__/_/ /_/_/\___/____/
# Ask before potentially overwriting files
seek_confirmation "Overwrite your existing dotfiles"
if is_confirmed; then
# Symlink all necessary files
run_dotfiles
e_success "All files have been symlinked"
else
e_error "This step is required. When you're ready, run this script to start up again"
fi
# ____ _____ _ __ ___
# / __ \/ ___/ | |/ / / | ____ ____ _____
# / / / /\__ \ | / / /| | / __ \/ __ \/ ___/
# / /_/ /___/ / / | / ___ |/ /_/ / /_/ (__ )
# \____//____/ /_/|_| /_/ |_/ .___/ .___/____/
# /_/ /_/
# Ask installing OS X Applications?
seek_confirmation "Do you want to install Mac OS X Apps and stuff"
if is_confirmed; then
e_process "Installing Mac OS X Applications"
run_apps
e_process "Installing Mac OS X fonts"
run_fonts
e_process "Installing Mac OS X Quick Look plugins for developers"
run_quicklook
e_success "All Mac OS X Applications have been installed"
e_warning "Please consider using cask commands for Updating/Upgrading or Uninstalling a Mac OS X Application"
fi
# _____ __ ___
# / ___/__ __/ /_ / (_)___ ___ ___
# \__ \/ / / / __ \/ / / __ `__ \/ _ \
# ___/ / /_/ / /_/ / / / / / / / / __/
# /____/\__,_/_.___/_/_/_/ /_/ /_/\___/
#
# Ask installing Sublime packages
seek_confirmation "Do you want to install Sublime Packages and Preferences"
if is_confirmed; then
e_process "Installing Sublime package"
run_sublime
fi
e_success "Your Mac is ready to rock!"