forked from carlhuda/janus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·44 lines (38 loc) · 930 Bytes
/
bootstrap.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
#!/bin/bash
function die()
{
echo "${@}"
exit 1
}
function backup_previous_install()
{
# Add .old to any existing Vim file in the home directory
for filepath in "${HOME}/.vim" "${HOME}/.vimrc" "${HOME}/.gvimrc"; do
if [ -e $filepath ]; then
mv "${filepath}" "${filepath}.old" || die "Could not move ${filepath} to ${filepath}.old"
echo "${filepath} has been renamed to ${filepath}.old"
fi
done
}
function clone_janus()
{
# Clone Janus into .vim
git clone --recursive https://github.com/carlhuda/janus.git "${HOME}/.vim" \
|| die "Could not clone the repository to ${HOME}/.vim"
}
function run_rake()
{
# Run rake inside .vim
pushd "${HOME}/.vim" || die "Could not go into the ${HOME}/.vim"
rake || die "Rake failed."
popd
}
function main()
{
if [ ! -e "${HOME}/.vim/janus" -o "$1" == "--force" ]; then
backup_previous_install
clone_janus
fi
run_rake
}
main $1