-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·146 lines (108 loc) · 3.19 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
#!/usr/bin/env zsh
libs=(brew dotfiles oh_my_zsh npm rubygems structure tools)
# Load utils
source ./lib/utils
# Help text
source ./lib/help
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
run_help
exit
fi
# Source the necessary files and helper scripts
for i in "${libs[@]}"; do
source ./lib/"$i"
done
if ! type_exists gcc; then
echo "GCC is missing"
fi
echo "Authentication required..."
sudo -v
if array_contains "$1" "${libs[@]}"; then
seek_confirmation "Do you want to install $1"
if is_confirmed; then
run_"$1"
fi
source "$HOME/.zshrc"
exit
else
seek_confirmation "Do you want to proceed with the installation"
if ! is_confirmed; then
exit
fi
fi
seek_confirmation "Install oh-my-zsh, plugins and themes"
if is_confirmed; then
# Symlink all necessary files
run_oh_my_zsh
e_success "Oh-my-zsh has been installed"
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"
exit 1
fi
# __ __
# _____/ /________ _______/ /___ __________
# / ___/ __/ ___/ / / / ___/ __/ / / / ___/ _ \
# (__ ) /_/ / / /_/ / /__/ /_/ /_/ / / / __/
# /____/\__/_/ \__,_/\___/\__/\__,_/_/ \___/
seek_confirmation "Setup HOME directory structure and global links?"
if is_confirmed; then
run_structure
e_success "Structure completed"
fi
# 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
# __ __ __
# / / / /___ ____ ___ ___ / /_ ________ _ __
# / /_/ / __ \/ __ `__ \/ _ \/ __ \/ ___/ _ \ | /| / /
# / __ / /_/ / / / / / / __/ /_/ / / / __/ |/ |/ /
# /_/ /_/\____/_/ /_/ /_/\___/_.___/_/ \___/|__/|__/
if ! type_exists 'brew'; then
e_process "Installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
e_process "Installing Homebrew packages"
run_brew
# ____ __
# / __ \__ __/ /_ __ __
# / /_/ / / / / __ \/ / / /
# / _, _/ /_/ / /_/ / /_/ /
# /_/ |_|\__,_/_.___/\__, /
# /____/
e_process "Installing Ruby gems"
run_rubygems
# _ ______ __ ___
# / | / / __ \/ |/ /
# / |/ / /_/ / /|_/ /
# / /| / ____/ / / /
# /_/ |_/_/ /_/ /_/
#
e_process "Installing NPM packages"
run_npm
# ______ __
# /_ __/___ ____ / /____
# / / / __ \/ __ \/ / ___/
# / / / /_/ / /_/ / (__ )
# /_/ \____/\____/_/____/
#
e_process "Installing Tools"
run_tools
e_success "Your Mac is ready to rock!"
exec zsh -l