-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup
executable file
·137 lines (113 loc) · 3.16 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
#!/bin/bash
set -eu
main() {
pushd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null
ensure_brew_exists
update_brew_things
set_git_authors
set_git_config
set_zsh
install_cred_alert
install_local_scripts
install_ginkgo
install_tmux_config
install_luan_nvim
update_vim
popd > /dev/null
echo "💾 All done. Enjoy! ️"
}
ensure_brew_exists() {
echo "Ensuring brew exists..."
if [[ ! -x /usr/local/bin/brew ]] ; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
}
update_brew_things() {
echo "Updating brew things..."
# brew bundle cleanup --force
brew bundle
brew update
brew upgrade
}
set_git_authors() {
if [[ ! -f "${HOME}"/.git-authors ]]; then
ln -s "${PWD}/git-authors" "${HOME}/.git-authors"
fi
}
set_git_config() {
echo "Ensuring git configs are set up..."
write_git_config_header
cp gitconfig ~/.gitconfig-shared
}
write_git_config_header() {
if ! grep --quiet "path=${HOME}/.gitconfig-shared" "$HOME/.gitconfig"; then
cat << EOF >> "$HOME/.gitconfig"
[include]
path=${HOME}/.gitconfig-shared
EOF
fi
}
set_zsh() {
echo "Setting zsh"
if [[ -d "${ZDOTDIR:-$HOME}/.zprezto" ]]; then
pushd "${ZDOTDIR:-$HOME}/.zprezto" > /dev/null
git pull origin eirini
popd
else
git clone --recursive -b eirini https://github.com/akshaymankar/prezto-eirini.git "${ZDOTDIR:-$HOME}/.zprezto"
fi
if [[ -d "${ZDOTDIR:-$HOME}/.zprezto/contrib" ]]; then
pushd "${ZDOTDIR:-$HOME}/.zprezto/contrib" > /dev/null
git pull
popd
else
git clone --recursive https://github.com/belak/prezto-contrib "${ZDOTDIR:-$HOME}/.zprezto/contrib"
fi
}
update_vim() {
echo "Ensuring that we have neovim python plugins"
pip3 install --upgrade neovim
npm install -g neovim
gem install neovim --user-install
mkdir -p ~/.config
}
install_cred_alert() {
if ! curl -f "https://s3.amazonaws.com/cred-alert/cli/current-release/cred-alert-cli_darwin" > "/usr/local/bin/cred-alert-cli"; then
echo -n "Failed to get the most recent version of the cred-alert-cli, continuing..."
fi
chmod +x "/usr/local/bin/cred-alert-cli"
echo "Getting last version of git-hooks"
if [[ -d "$HOME/workspace/git-hooks-core" ]]; then
pushd "$HOME/workspace/git-hooks-core" > /dev/null
git pull
popd > /dev/null
else
git clone https://github.com/pivotal-cf/git-hooks-core "$HOME/workspace/git-hooks-core"
fi
}
install_local_scripts() {
echo "Installing local scripts:..."
local_scripts_path="${HOME}"/.local
if [[ -d "${local_scripts_path}" ]]; then
rm -rf "${local_scripts_path}"
fi
mkdir -p "${local_scripts_path}"
ln -svnfF "$PWD/bin/" "${local_scripts_path}"
}
install_ginkgo() {
go get -u github.com/onsi/gomega
go get -u github.com/onsi/ginkgo/ginkgo
}
install_tmux_config() {
ln -svnf $PWD/tmux.conf "${HOME}/.tmux.conf"
if [[ ! -d "${HOME}/.tmux" ]]; then
mkdir -p "${HOME}/.tmux/plugins"
git clone https://github.com/tmux-plugins/tpm "${HOME}/.tmux/plugins/tpm"
fi
}
install_luan_nvim() {
if [[ ! -d ~/.config/nvim ]]; then
git clone https://github.com/alex-slynko/nvim ~/.config/nvim
fi
}
main