-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·80 lines (66 loc) · 1.64 KB
/
install.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
#!/usr/bin/env bash
set -e
cd "$(dirname "${BASH_SOURCE}")"
git pull origin master
function brew_all_the_things() {
if [[ -z "$(command -v brew)" ]]; then
echo "Installing homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo "Running the Brewfile..."
brew update
brew upgrade
brew tap Homebrew/bundle
ln -sf "$(pwd)/Brewfile" "${HOME}/.Brewfile"
brew bundle --global
brew bundle cleanup
}
function setup_vim() {
if [[ -d "${HOME}/.vim" ]]; then
echo "removing ~/.vim dir"
rm -rf "${HOME}/*.vim"
else
echo "Installing luan's vimfiles..."
curl vimfiles.luan.sh/install | FORCE=1 bash
fi
echo "Updating vim..."
vim-update
}
function setup_fasd() {
local fasd_cache
fasd_cache="${HOME}/.fasd-init-bash"
if [[ "$(command -v fasd)" -nt "$fasd_cache" ]] || [[ ! -s "${fasd_cache}" ]]; then
fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install >| "$fasd_cache"
fi
source "${fasd_cache}"
eval "$(fasd --init auto)"
}
function rsync_and_source() {
rsync --exclude ".git/" \
--exclude ".DS_Store" \
--exclude ".macos" \
--exclude "bootstrap.sh" \
--exclude "Brewfile" \
--exclude "LICENSE" \
--exclude "README.md" \
-avh --no-perms . ~
source ~/.bash_profile
}
function do_it() {
brew_all_the_things
setup_vim
setup_fasd
rsync_and_source
}
function main() {
if [[ "$1" == "-f" ]]; then
do_it
else
read -rp "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1
echo ""
if [[ "${REPLY}" =~ ^[Yy]$ ]]; then
do_it
fi
fi
}
main