This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup
executable file
·155 lines (133 loc) · 3.71 KB
/
setup
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
#!/bin/bash
set -euo pipefail
# Directories
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONF="${DIR}/conf"
BIN="${DIR}/bin"
update_brew_and_packages() {
echo "Updating brew and packages..."
ln -sf ${DIR}/Brewfile ${HOME}/Brewfile
brew update
brew bundle
brew upgrade
brew cask outdated --quiet | xargs -I % brew cask reinstall %
brew cleanup
}
update_brew_and_packages
install_nvim() {
echo "Installing nvim..."
pip3 install neovim
if [[ ! -e ${HOME}/.config/nvim ]]; then
git clone /~https://github.com/luan/nvim.git ${HOME}/.config/nvim
fi
}
install_nvim
bash_setup() {
echo "Setting up bash..."
ln -sf ${CONF}/profile ${HOME}/.profile
ln -sf ${CONF}/bash_aliases ${HOME}/.bash_aliases
}
bash_setup
setup_git() {
echo "Setting up git..."
write_git_config_header
ln -sf ${CONF}/git-authors ${HOME}/.git-authors
ln -sf ${CONF}/git-together ${HOME}/.git-together
ln -svnf ${CONF}/custom-gitconfig $HOME/.custom-gitconfig
find ${DIR} -name '.*' -type f -depth 1 | grep -v .DS_Store | xargs -I % ln -sf % $HOME
touch ${HOME}/.gitmessage
}
setup_git
write_git_config_header() {
cat << EOF > "$HOME/.gitconfig"
[include]
path=${HOME}/.git-together
path=${HOME}/.custom-gitconfig
[commit]
template = ~/.git-author-template
EOF
}
clone_repos() {
source ${BIN}/clone_repos
}
clone_repos
install_ruby(){
source ${BIN}/install_ruby
}
install_ruby
setup_nvim() {
echo "Setting up nvim..."
mkdir -p ${HOME}/.config/nvim/user
if [[ -e ${HOME}/.config/nvim/user/plug.vim ]]; then
rm ${HOME}/.config/nvim/user/plug.vim
fi
if [[ -e ${HOME}/.config/nvim/user/after.vim ]]; then
rm ${HOME}/.config/nvim/user/after.vim
fi
ln -sf ${CONF}/plug.vim ${HOME}/.config/nvim/user/plug.vim
ln -sf ${CONF}/after.vim ${HOME}/.config/nvim/user/after.vim
ln -sf ${CONF}/before.vim ${HOME}/.config/nvim/user/before.vim
}
setup_nvim
setup_tmux() {
echo "Setting up tmux..."
ln -sf ${CONF}/tmux.conf ${HOME}/.tmux.conf
if [[ ! -e ${HOME}/.tmux/plugins/tpm ]]; then
mkdir -p ${HOME}/.tmux/plugins/tpm
git clone /~https://github.com/tmux-plugins/tpm ${HOME}/.tmux/plugins/tpm
fi
}
setup_tmux
if [[ ! -e ~/workspace/git-hooks-core ]]; then
git clone /~https://github.com/pivotal-cf/git-hooks-core.git ~/workspace/git-hooks-core
fi
pushd ~/workspace/git-hooks-core > /dev/null
git pull
popd
setup_cred_alert(){
echo "Setting up cred alert..."
if [ ! -f /usr/local/bin/cred-alert-cli ]; then
os_name=$(uname | awk '{print tolower($1)}')
curl -o cred-alert-cli \
"https://s3.amazonaws.com/cred-alert/cli/current-release/cred-alert-cli_${os_name}"
chmod 755 cred-alert-cli
mv cred-alert-cli /usr/local/bin
fi
}
setup_cred_alert
update_gems() {
echo "Updating default ruby gems..."
# Update all default gems
gem update --system
gem update
gem cleanup
}
update_gems
install_kiln() {
echo "Installing kiln..."
# Install kiln
if [ ! -f /usr/local/bin/kiln ]; then
curl -SL -o /usr/local/bin/kiln /~https://github.com/pivotal-cf/kiln/releases/download/0.21.0/kiln-darwin
chmod 0755 /usr/local/bin/kiln
fi
}
install_kiln
install_om() {
echo "Installing Om CLI..."
# Install om
if [ ! -f /usr/local/bin/om ]; then
curl -SL -o /usr/local/bin/om /~https://github.com/pivotal-cf/om/releases/download/0.42.0/om-darwin
chmod 0755 /usr/local/bin/om
fi
}
install_om
update_gcloud_components() {
if gcloud info &> /dev/null; then
echo "Updating gcloud components..."
gcloud components update --quiet
gcloud compute config-ssh --ssh-config-file ${HOME}/.ssh/gcloud_ssh_config
fi
}
ln -sf ${DIR}/ssh_config ${HOME}/.ssh/config
echo "Setup successful!"