-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.zsh
executable file
·106 lines (89 loc) · 2.38 KB
/
update.zsh
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
#!/usr/bin/env zsh
set -e
set -u
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
NVM_DIR=${NVM_DIR:-$XDG_DATA_HOME/nvm}
PYENV_ROOT=${PYENV_ROOT:-$XDG_DATA_HOME/pyenv}
RBENV_ROOT=${RBENV_ROOT:-$XDG_DATA_HOME/rbenv}
function puts () {
echo "\n-- [$1] $2"
}
if [[ $(command -v gem) ]]; then
puts 'Updating' 'gems'
xargs -a config/rbenv/default-gems gem install
xargs -a config/rbenv/default-gems gem update
fi
if [[ $(command -v pyenv) ]]; then
puts 'Updating' 'pip and pipenv'
pyenv exec pip install --upgrade pip
fi
if [[ -d $HOME/.zgen.zsh ]]; then
puts 'Updating' 'zgen'
cd $HOME/.zgen.zsh
git pull
fi
if [[ -d $RBENV_ROOT ]]; then
puts 'Updating' 'rbenv'
cd $RBENV_ROOT
git checkout master
git pull
git checkout $(git describe --abbrev=0 --tags)
src/configure
make -C src
fi
if [[ -d $RBENV_ROOT/plugins/ruby-build ]]; then
puts 'Updating' 'ruby-build'
cd $RBENV_ROOT/plugins/ruby-build
git checkout master
git pull
git checkout $(git describe --abbrev=0 --tags)
fi
if [[ -d $RBENV_ROOT/plugins/rbenv-gem-rehash ]]; then
puts 'Updating' 'rbenv-gem-rehash'
cd $RBENV_ROOT/plugins/rbenv-gem-rehash
git pull
fi
if [[ -d $RBENV_ROOT/plugins/rbenv-default-gems ]]; then
puts 'Updating' 'rbenv-default-gems'
cd $RBENV_ROOT/plugins/rbenv-default-gems
git pull
fi
if [[ -d $RBENV_ROOT/plugins/rbenv-ctags ]]; then
puts 'Updating' 'rbenv-ctags'
cd $RBENV_ROOT/plugins/rbenv-ctags
git pull
fi
if [[ -d $PYENV_ROOT ]]; then
puts 'Updating' 'pyenv'
cd $PYENV_ROOT
git checkout master
git pull
git checkout $(git describe --abbrev=0 --tags)
fi
if [[ -d $PYENV_ROOT/plugins/pyenv-virtualenv ]]; then
puts 'Updating' 'pyenv-virtualenv'
cd $PYENV_ROOT/plugins/pyenv-virtualenv
git checkout master
git pull
git checkout $(git describe --abbrev=0 --tags)
fi
if [[ -d $NVM_DIR ]]; then
puts 'Updating' 'nvm'
cd $NVM_DIR
git checkout master
git pull
git checkout $(git describe --abbrev=0 --tags)
fi
if [[ -e $HOME/.config/zsh/promptline.zsh ]]; then
puts 'Updating' 'promptline'
nvim -c "PromptlineSnapshot ~/.config/zsh/promptline.zsh" -c qall!
fi
if [[ -e $HOME/.config/tmux/tmuxline.conf ]]; then
if [[ ! -z "${TMUX:-}" ]]; then
puts 'Updating' 'tmuxline'
nvim -c "Tmuxline airline" -c "TmuxlineSnapshot! ~/.config/tmux/tmuxline.conf" -c qall!
else
puts 'Info' 'Run in a tmux session to install tmuxline.'
fi
fi
exit