-
-
Save tai271828/a932b6cdb1b0ce6813ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Plant rope vim's plugin | |
# This is a script to install or update 'ropevim' | |
# Copyright Alexander Artemenko, 2008 | |
# Contact me at svetlyak.40wt at gmail com | |
release_ubuntu=`lsb_release -r | awk {'print $2'}` | |
#url_rope='http://bitbucket.org/agr/rope' | |
#url_ropevim='http://bitbucket.org/agr/ropevim' | |
#url_ropemod='http://bitbucket.org/agr/ropemode' | |
url_rope='https://github.com/python-rope/rope' | |
url_ropevim='https://github.com/python-rope/ropevim' | |
url_ropemode='https://github.com/python-rope/ropemode' | |
function create_dirs | |
{ | |
mkdir -p src | |
mkdir -p pylibs | |
} | |
function check_vim | |
{ | |
if vim --version | grep '\-python' > /dev/null | |
then | |
# vim-python is an virtual package in Ubuntu 14.04 | |
if $release_ubuntu != '14.04' | |
then | |
echo You vim does not support python plugins. | |
echo Please, install vim with python support. | |
echo On debian or ubuntu you can do this: | |
echo " sudo apt-get install vim-python" | |
exit 1 | |
else | |
echo "Ubuntu 14.04 is detected." | |
echo "vim-python is an virtual package in Ubuntu 14.04" | |
echo "Let's skip the apt installation for vim-python" | |
fi | |
fi | |
} | |
function get_or_update_git | |
{ | |
if [ -e $1 ] | |
then | |
cd $1 | |
echo Pulling updates from $2 | |
git pull > /dev/null | |
cd .. | |
else | |
echo Cloning $2 | |
git clone $2 $1 > /dev/null | |
fi | |
} | |
function get_or_update_hg | |
{ | |
if [ -e $1 ] | |
then | |
cd $1 | |
echo Pulling updates from $2 | |
hg pull > /dev/null | |
cd .. | |
else | |
echo Cloning $2 | |
hg clone $2 $1 > /dev/null | |
fi | |
} | |
function pull_sources | |
{ | |
cd src | |
get_or_update_git rope $url_rope | |
get_or_update_git ropevim $url_ropevim | |
get_or_update_git ropemode $url_ropemode | |
cd ../pylibs | |
ln -f -s ../src/rope/rope | |
ln -f -s ../src/ropemode/ropemode | |
ln -f -s ../src/ropevim/ropevim.py | |
cd .. | |
} | |
function gen_vim_config | |
{ | |
echo "let \$PYTHONPATH .= \":`pwd`/pylibs\"" > rope.vim | |
echo "source `pwd`/src/ropevim/ropevim.vim" >> rope.vim | |
echo "Now, just add \"source `pwd`/rope.vim\" to your .vimrc" | |
} | |
check_vim | |
create_dirs | |
pull_sources | |
gen_vim_config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment